日期:2014-05-16 浏览次数:20571 次
Oracle RMAN 备份的恢复分2个步骤:RESTRE 和 RECOVER。
在这个过程中,Recover 是依赖与归档文件的。
假设一种情况:周一对数据库做了全备,然后保留归档。周四发现数据库有异常,准备恢复,发现周二的时候少了一个归档。
按照正常的情况,我们只能将数据库恢复到周二缺失归档的之前的点。
那么我这里就是一个研究,如何跳过这个缺失的归档,让数据库继续进行Recover。
根据测试结果,Recover 是可以继续,但是测试的结果意义不是很大,因为还是有数据丢失。
所以这里更多的是对这种方法的抛砖引玉。
此步骤直接备份即可。
SQL> select sequence# from v$log wherethread#=1;
SEQUENCE#
----------
152
151
SQL> create table dave1 as select * fromdba_users;
Table created.
SQL> alter system switch logfile;
System altered.
SQL> select sequence# from v$log wherethread#=1;
SEQUENCE#
----------
152
153
SQL> create table dave2 as select * fromdba_users;
Table created.
SQL> alter system switch logfile;
System altered.
SQL> select sequence#,status from v$logwhere thread#=1;
SEQUENCE# STATUS
---------- ----------------
154 CURRENT
153 ACTIVE
SQL> select sequence# fromv$archived_log where thread#=1;
SEQUENCE#
----------
148
149
150
151
152
153
6 rows selected.
[oracle@dave arch]$ ll
total 42200
-rw-r-----. 1 oracle oinstall 42715136Jul 5 22:56 1_125_816661296.dbf
-rw-r-----. 1 oracle oinstall 248320 Jul 6 23:14 1_152_816661296.dbf
-rw-r-----. 1 oracle oinstall 127488 Jul 6 23:15 1_153_816661296.dbf
-rw-r-----. 1 oracle oinstall 113664 Jul 6 23:19 1_154_816661296.dbf
[oracle@dave arch]$ rm-rf 1_153_816661296.dbf
[oracle@dave arch]$ ll
total 42072
-rw-r-----. 1 oracle oinstall 42715136Jul 5 22:56 1_125_816661296.dbf
-rw-r-----. 1 oracle oinstall 248320 Jul 6 23:14 1_152_816661296.dbf
-rw-r-----. 1 oracle oinstall 113664 Jul 6 23:19 1_154_816661296.dbf
[oracle@dave arch]$
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
RMAN> restore database;
Starting restore at 06-JUL-13
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
channel ORA_DISK_1: starting datafilebackup set restore
channel ORA_DISK_1: specifying datafile(s)to restore from backup set
channel ORA_DISK_1: restoring datafile00001 to /u01/app/oracle/oradata/dave/system.256.816661027
channel ORA_DISK_1: restoring datafile00003 to /u01/app/oracle/oradata/dave/undotbs1.258.816661037
channel ORA_DISK_1: restoring datafile00005 to /u01/app/oracle/oradata/dave/undotbs2.265.816661787
channel ORA_DISK_1: reading from backuppiece /u01/backup/dave_lev0_06oe3kdv_1_1_20130706