rman备份与恢复:用user_command方式基于时间的不完全恢复
备份与恢复:用user_command方式基于时间的不完全恢复
SQL> select * from test;
ID
----------
1
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
这时备份所有数据文件
SQL> startup
ORACLE instance started.
Total System Global Area 546382300 bytes
Fixed Size 455132 bytes
Variable Size 520093696 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> insert into test values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> select sysdate from dual;
SYSDATE
---------
09-APR-08
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi;ss';
Session altered.
SQL> select sysdate from dual;
SYSDATE
-------------------
2008-04-09 09:44;37 --基于这个时间点之前的
SQL> drop table test;
Table dropped.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
把备份的所有数据文件拷贝回来
SQL> startup mount;
ORACLE instance started.
Total System Global Area 546382300 bytes
Fixed Size 455132 bytes
Variable Size 520093696 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> recover database until time '2008-04-09 09:44:37'; 做基于时间的不完全恢复
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from test;
ID
----------
1
2
SQL>