使用backup controlfile做恢复过程中,并未发生归档切换,因此控制文件中记录的redo log sequence是备份控制文件时的数据,与当前DB redo log日志的sequence不符,因此需要在开启时,使用resetlogs而达到相同。
验证如下:
一。RMAN 做一次全备。
二。查看当时的current sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
67 INACTIVE
68 INACTIVE
66 INACTIVE
64 INACTIVE
65 INACTIVE
69 CURRENT
6 rows selected.
三。连续十几次切换归档。
SQL> alter system archive log current;
System altered.
SQL> /
四。查看当前sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
79 INACTIVE
80 INACTIVE
81 INACTIVE
82 INACTIVE
83 ACTIVE
84 CURRENT
五。正常关闭DB.
SQL> shutdown immediate;
六。模拟控制文件删除
$move control* bak/
七。SQL>startup nomount;
八。使用Rman还原控制文件。
RMAN> restore controlfile from '/u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_ncnnf_TAG20120713T175133_801f4f0h_.bkp';
Starting restore at 13-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/data/mxtest01/control01.ctl
output filename=/data/mxtest01/control02.ctl
output filename=/data/mxtest01/control03.ctl
Finished restore at 13-JUL-12
九。MOUNT DATABASE
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
十。还原DB。
RMAN> restore database;
Starting restore at 13-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /data/mxtest01/system01.dbf
restoring datafile 00002 to /data/mxtest01/undotbs01.dbf
restoring datafile 00003 to /data/mxtest01/sysaux01.dbf
restoring datafile 00004 to /data/mxtest01/users01.dbf
restoring datafile 00005 to /data/mxtest01/data01.dbf
channel ORA_DISK_1: reading from backup piece /u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T175133_801f45x9_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T175133_801f45x9_.bkp tag=TAG20120713T175133
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 13-JUL-12
十一。恢复DB
RMAN> recover database;
Starting recover at 13-JUL-12
using channel ORA_DISK_1
starting media recovery
archive log filename=/data/mxtest01/arc/1_ 69_788542228.arc thread=1 sequence=69
archive log filename=/data/mxtest01/arc/1_70_788542228.arc thread=1 sequence=70
archive log filename=/data/mxtest01/arc/1_71_788542228.arc thread=1 sequence=71
archive log filename=/data/mxtest01/arc/1_72_788542228.arc thread=1 sequence=72
archive log filename=/data/mxtest01/arc/1_73_788542228.arc thread=1 sequence=73
archive log filename=/data/mxtest01/arc/1_74_788542228.arc thread=1 sequence=74
archive log filename=/data/mxtest01/arc/1_75_788542228.arc thread=1 sequence=75
archive log filename=/data/mxtest01/arc/1_76_788542228.arc thread=1 sequence=76
archive log filename=/data/mxtest01/arc/1_77_788542228.arc thread=1 sequence=77
archive log filename=/data/mxtest01/arc/1_78_788542228.arc thread=1 sequence=78
archive log filename=/data/mxtest01/arc/1_79_788542228.arc thread=1 sequence=79
archive log filename=/data/mxtest01/arc/1_80_788542228.arc thread=1 sequence=80
archive log filename=/data/mxtest01/arc/1_81_788542228.arc thread=1 sequence=81
archive log filename=/data/mxtest01/arc/1_ 82_788542228.arc thread=1 sequence=82
archive log filename=/data/mxtest01/arc/1_ 83_788542228.arc thread=1 sequence=83
media recovery complete, elapsed time: 00:00:05
Finished recover at 13-JUL-12
十二。查看当前current redo log的sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
67 INACTIVE
68 INACTIVE
66 INACTIVE
64 INACTIVE
65 INACTIVE
69 CURRENT --是控制文件备份时的状态。
6 rows selected.
十三。open resetlogs.
RMAN> alter database open resetlogs;
database opened
十四。current redolog sequece.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
0 UNUSED
0 UNUSED
0 UNUSED
6 rows selected
验证如下:
一。RMAN 做一次全备。
二。查看当时的current sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
67 INACTIVE
68 INACTIVE
66 INACTIVE
64 INACTIVE
65 INACTIVE
69 CURRENT
6 rows selected.
三。连续十几次切换归档。
SQL> alter system archive log current;
System altered.
SQL> /
四。查看当前sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
79 INACTIVE
80 INACTIVE
81 INACTIVE
82 INACTIVE
83 ACTIVE
84 CURRENT
五。正常关闭DB.
SQL> shutdown immediate;
六。模拟控制文件删除
$move control* bak/
七。SQL>startup nomount;
八。使用Rman还原控制文件。
RMAN> restore controlfile from '/u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_ncnnf_TAG20120713T175133_801f4f0h_.bkp';
Starting restore at 13-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/data/mxtest01/control01.ctl
output filename=/data/mxtest01/control02.ctl
output filename=/data/mxtest01/control03.ctl
Finished restore at 13-JUL-12
九。MOUNT DATABASE
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
十。还原DB。
RMAN> restore database;
Starting restore at 13-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /data/mxtest01/system01.dbf
restoring datafile 00002 to /data/mxtest01/undotbs01.dbf
restoring datafile 00003 to /data/mxtest01/sysaux01.dbf
restoring datafile 00004 to /data/mxtest01/users01.dbf
restoring datafile 00005 to /data/mxtest01/data01.dbf
channel ORA_DISK_1: reading from backup piece /u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T175133_801f45x9_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/product/flash_recovery_area/MXTEST01/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T175133_801f45x9_.bkp tag=TAG20120713T175133
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 13-JUL-12
十一。恢复DB
RMAN> recover database;
Starting recover at 13-JUL-12
using channel ORA_DISK_1
starting media recovery
archive log filename=/data/mxtest01/arc/1_ 69_788542228.arc thread=1 sequence=69
archive log filename=/data/mxtest01/arc/1_70_788542228.arc thread=1 sequence=70
archive log filename=/data/mxtest01/arc/1_71_788542228.arc thread=1 sequence=71
archive log filename=/data/mxtest01/arc/1_72_788542228.arc thread=1 sequence=72
archive log filename=/data/mxtest01/arc/1_73_788542228.arc thread=1 sequence=73
archive log filename=/data/mxtest01/arc/1_74_788542228.arc thread=1 sequence=74
archive log filename=/data/mxtest01/arc/1_75_788542228.arc thread=1 sequence=75
archive log filename=/data/mxtest01/arc/1_76_788542228.arc thread=1 sequence=76
archive log filename=/data/mxtest01/arc/1_77_788542228.arc thread=1 sequence=77
archive log filename=/data/mxtest01/arc/1_78_788542228.arc thread=1 sequence=78
archive log filename=/data/mxtest01/arc/1_79_788542228.arc thread=1 sequence=79
archive log filename=/data/mxtest01/arc/1_80_788542228.arc thread=1 sequence=80
archive log filename=/data/mxtest01/arc/1_81_788542228.arc thread=1 sequence=81
archive log filename=/data/mxtest01/arc/1_ 82_788542228.arc thread=1 sequence=82
archive log filename=/data/mxtest01/arc/1_ 83_788542228.arc thread=1 sequence=83
media recovery complete, elapsed time: 00:00:05
Finished recover at 13-JUL-12
十二。查看当前current redo log的sequence.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
67 INACTIVE
68 INACTIVE
66 INACTIVE
64 INACTIVE
65 INACTIVE
69 CURRENT --是控制文件备份时的状态。
6 rows selected.
十三。open resetlogs.
RMAN> alter database open resetlogs;
database opened
十四。current redolog sequece.
SQL> select sequence#,status from v$log;
SEQUENCE# STATUS
---------- ----------------
1 CURRENT
0 UNUSED
0 UNUSED
0 UNUSED
0 UNUSED
0 UNUSED
6 rows selected
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23154475/viewspace-735447/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23154475/viewspace-735447/