From Oracle 10G,RMAN can be seamless restore and backup from previous incarnation to current incarnation or restore and recover to prior point-in-time from previous incarnation。however,you must run the RESET DATABASE command to reset the database to the incartion at the target time first。restore database to previous incarnation you must be restore whole database。
first, We are query the current database incarnation in catalog or controlfile:
RMAN> list incarnation; using target database control file instead of recovery catalog List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------------- --- ---------- ---------- 1 1 RAC 2291673877 PARENT 848487328 2009-11-09 15:09:10 2 2 RAC 2291673877 PARENT 848959908 2009-11-23 13:57:47 3 3 RAC 2291673877 PARENT 876634092 2010-06-09 14:30:01 4 4 RAC 2291673877 CURRENT 881216366 2010-08-19 14:58:29
this database has four incations in past.current is four,we will restore database from incarnation three and incartion three has a full backupsets. during the reostore,if current controlfile is correct and no have failures,not have be restore controlfile;if current controlfile have failures or misses,must be restore controlfile from controlfile autobackup or previous controlfile backupsets first。currrent assumed controlfile is correct and present.
shutdown and mount instance:
shutdown immediate RMAN> alter database mount; database mounted
run RESET DATABAE command,reset current incarnation to previous
RMAN> reset database to incarnation 3; database reset to incarnation 3
starting restore and recover database to incarnation three:
RMAN> restore database; Starting restore at 2010-08-19 15:13:31 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=149 instance=rac1 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=147 instance=rac1 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=146 instance=rac1 devtype=DISK channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00008 to /racdata/RAC/datafile/o1_mf_undo_c_5jn8smkc_.dbf restoring datafile 00010 to /racdata/RAC/datafile/o1_mf_imptest_5jn8sml4_.dbf restoring datafile 00014 to /racdata/RAC/datafile/o1_mf_imptest_61p22chm_.dbf channel ORA_DISK_1: reading from backup piece /datavg/mayp/full_rac_727195560_87_RAC.rman channel ORA_DISK_2: starting datafile backupset restore channel ORA_DISK_2: specifying datafile(s) to restore from backup set restoring datafile 00002 to /racdata/RAC/datafile/o1_mf_ts16_5phvgho5_.dbf channel ORA_DISK_2: reading from backup piece /datavg/mayp/full_rac_727195731_89_RAC.rman channel ORA_DISK_3: starting datafile backupset restore channel ORA_DISK_3: specifying datafile(s) to restore from backup set restoring datafile 00006 to /racdata/RAC/datafile/o1_mf_ts16_5phwml21_.dbf channel ORA_DISK_3: reading from backup piece /datavg/mayp/full_rac_727195738_90_RAC.rman channel ORA_DISK_2: restored backup piece 1 piece handle=/datavg/mayp/full_rac_727195731_89_RAC.rman tag=TAG20100816T144559 channel ORA_DISK_2: restore complete, elapsed time: 00:00:26 channel ORA_DISK_2: starting datafile backupset restore channel ORA_DISK_2: specifying datafile(s) to restore from backup set restoring datafile 00001 to /racdata/RAC/datafile/o1_mf_system_5jn8smdd_.dbf restoring datafile 00003 to /racdata/RAC/datafile/o1_mf_sysaux_5jn8smd1_.dbf restoring datafile 00007 to /racdata/RAC/datafile/o1_mf_as_test_5s8s3z03_.dbf restoring datafile 00012 to /racdata/RAC/datafile/o1_mf_person_l_5jn8sml3_.dbf restoring datafile 00015 to /racdata/RAC/datafile/o1_mf_read_1_63o0vr6l_.dbf channel ORA_DISK_2: reading from backup piece /datavg/mayp/full_rac_727195561_88_RAC.rman channel ORA_DISK_3: restored backup piece 1 piece handle=/datavg/mayp/full_rac_727195738_90_RAC.rman tag=TAG20100816T144559 channel ORA_DISK_3: restore complete, elapsed time: 00:00:28 channel ORA_DISK_3: starting datafile backupset restore channel ORA_DISK_3: specifying datafile(s) to restore from backup set restoring datafile 00004 to /racdata/RAC/datafile/o1_mf_users_5jn8smk0_.dbf restoring datafile 00005 to /racdata/RAC/datafile/o1_mf_imptest_5jn8sw5k_.dbf restoring datafile 00009 to /racdata/RAC/datafile/o1_mf_imptest_5jn8smf8_.dbf restoring datafile 00011 to /racdata/RAC/datafile/o1_mf_users_5jn8smmt_.dbf restoring datafile 00013 to /racdata/RAC/datafile/o1_mf_block_60g4b40f_.dbf channel ORA_DISK_3: reading from backup piece /datavg/mayp/full_rac_727195560_86_RAC.rman channel ORA_DISK_1: restored backup piece 1 piece handle=/datavg/mayp/full_rac_727195560_87_RAC.rman tag=TAG20100816T144559 channel ORA_DISK_1: restore complete, elapsed time: 00:06:05 channel ORA_DISK_2: restored backup piece 1 piece handle=/datavg/mayp/full_rac_727195561_88_RAC.rman tag=TAG20100816T144559 channel ORA_DISK_2: restore complete, elapsed time: 00:06:23 channel ORA_DISK_3: restored backup piece 1 piece handle=/datavg/mayp/full_rac_727195560_86_RAC.rman tag=TAG20100816T144559 channel ORA_DISK_3: restore complete, elapsed time: 00:06:47 Finished restore at 2010-08-19 15:20:51 RMAN> recover database; Starting recover at 2010-08-19 15:21:29 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 starting media recovery media recovery failed RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 08/19/2010 15:21:32 ORA-00283: recovery session canceled due to errors RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed start ORA-00283: recovery session canceled due to errors ORA-38727: FLASHBACK DATABASE requires a current control file.
return a error from recover database.because in current incarnation,the instance enable flashback database.but flashback database not running on the past backup controlfile.so we are disable flashback database before running the recover command.
RMAN> sql 'alter database flashback off'; sql statement: alter database flashback off RMAN> recover database; Starting recover at 2010-08-19 15:24:38 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 starting media recovery archive log thread 1 sequence 167 is already on disk as file /racdata/rac/archivelog/1_167_721233001.dbf archive log thread 1 sequence 168 is already on disk as file /racdata/rac/archivelog/1_168_721233001.dbf archive log thread 1 sequence 169 is already on disk as file /racdata/rac/archivelog/1_169_721233001.dbf archive log thread 1 sequence 170 is already on disk as file /racdata/rac/archivelog/1_170_721233001.dbf archive log thread 1 sequence 171 is already on disk as file /racdata/rac/archivelog/1_171_721233001.dbf archive log thread 1 sequence 172 is already on disk as file /racdata/rac/archivelog/1_172_721233001.dbf archive log thread 1 sequence 173 is already on disk as file /racdata/rac/archivelog/1_173_721233001.dbf archive log filename=/racdata/rac/archivelog/1_167_721233001.dbf thread=1 sequence=167 archive log filename=/racdata/rac/archivelog/1_168_721233001.dbf thread=1 sequence=168 archive log filename=/racdata/rac/archivelog/1_169_721233001.dbf thread=1 sequence=169 archive log filename=/racdata/rac/archivelog/1_170_721233001.dbf thread=1 sequence=170 archive log filename=/racdata/rac/archivelog/1_171_721233001.dbf thread=1 sequence=171 archive log filename=/racdata/rac/archivelog/1_172_721233001.dbf thread=1 sequence=172 archive log filename=/racdata/rac/archivelog/1_173_721233001.dbf thread=1 sequence=173 unable to find archive log archive log thread=1 sequence=174 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 08/19/2010 15:27:41 RMAN-06054: media recovery requesting unknown log: thread 1 seq 174 lowscn 881216366 RMAN> recover database until sequence 174; Starting recover at 2010-08-19 15:29:41 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 starting media recovery media recovery complete, elapsed time: 00:00:01 Finished recover at 2010-08-19 15:29:51 RMAN> alter database open resetlogs; database opened RMAN>
conclude:this function is very usefull of span the resetlogs point-in-time recvoer。in Oracle 9i,first must backup and then previous backupset expired after the resetlogs。10g change all that。