1.shutdown the target database
3.Ouput of script to reset the database to previous incarnation
4.Script to recover the database
5.Output of script execution to recover the database at particular time
RMAN> shutdown immediate; database closed database dismounted Oracle instance shut down2.Script to reset the database to previous incarnation
startup nomount; restore controlfile from autobackup until time "to_date('26-05-2014 06:35:10','dd-mm-yyyy hh24:mi:ss')"; alter database mount; list incarnation of database; reset database to incarnation 7;
3.Ouput of script to reset the database to previous incarnation
RMAN> @ ./rman/rman_reset_db_prev_incr.cmd RMAN> startup nomount; connected to target database (not started) Oracle instance started Total System Global Area 730714112 bytes Fixed Size 2256832 bytes Variable Size 452984896 bytes Database Buffers 272629760 bytes Redo Buffers 2842624 bytes RMAN> restore controlfile from autobackup until time "to_date('26-05-2014 06:35:10','dd-mm-yyyy hh24:mi:ss')"; Starting restore at 27-05-2014 12:36:16 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=23 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=26 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=24 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=27 device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=28 device type=DISK recovery area destination: +DATA database name (or database unique name) used for search: CVRMAN channel ORA_DISK_2: AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 found in the recovery area channel ORA_DISK_2: looking for AUTOBACKUP on day: 20140526 channel ORA_DISK_2: looking for AUTOBACKUP on day: 20140525 recovery area destination: +DATA database name (or database unique name) used for search: CVRMAN channel ORA_DISK_3: AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 found in the recovery area channel ORA_DISK_3: looking for AUTOBACKUP on day: 20140526 channel ORA_DISK_3: looking for AUTOBACKUP on day: 20140525 channel ORA_DISK_3: skipped, AUTOBACKUP already found recovery area destination: +DATA database name (or database unique name) used for search: CVRMAN channel ORA_DISK_5: AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 found in the recovery area channel ORA_DISK_5: looking for AUTOBACKUP on day: 20140526 channel ORA_DISK_5: looking for AUTOBACKUP on day: 20140525 channel ORA_DISK_5: skipped, AUTOBACKUP already found recovery area destination: +DATA database name (or database unique name) used for search: CVRMAN channel ORA_DISK_1: AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 found in the recovery area channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140526 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140525 channel ORA_DISK_1: skipped, AUTOBACKUP already found recovery area destination: +DATA database name (or database unique name) used for search: CVRMAN channel ORA_DISK_4: AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 found in the recovery area channel ORA_DISK_4: looking for AUTOBACKUP on day: 20140526 channel ORA_DISK_4: looking for AUTOBACKUP on day: 20140525 channel ORA_DISK_4: skipped, AUTOBACKUP already found channel ORA_DISK_2: restoring control file from AUTOBACKUP +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 channel ORA_DISK_2: control file restore from AUTOBACKUP complete output file name=+DATA/cvrman/controlfile/current.307.847862851 output file name=+DATA/cvrman/controlfile/current.275.847862853 Finished restore at 27-05-2014 12:36:39 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 released channel: ORA_DISK_2 released channel: ORA_DISK_3 released channel: ORA_DISK_4 released channel: ORA_DISK_5 RMAN> list incarnation of database; List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------------- --- ---------- ---------- 1 1 CVRMAN 657566608 PARENT 1 24-08-2013 11:37:30 2 2 CVRMAN 657566608 PARENT 925702 12-05-2014 08:28:06 3 3 CVRMAN 657566608 PARENT 1014824 13-05-2014 07:00:00 4 4 CVRMAN 657566608 PARENT 1089078 14-05-2014 10:10:49 5 5 CVRMAN 657566608 PARENT 1218607 17-05-2014 03:35:32 6 6 CVRMAN 657566608 PARENT 1285008 18-05-2014 05:29:56 7 7 CVRMAN 657566608 CURRENT 1517897 25-05-2014 04:52:38 reset database to incarnation 7; database reset to incarnation 7 RMAN> **end-of-file**
4.Script to recover the database
run { set until time ="to_date('26-05-2014 06:35:10','dd-mm-yyyy hh24:mi:ss')"; restore database; recover database; sql "alter database open resetlogs"; }
5.Output of script execution to recover the database at particular time
RMAN> @ ./rman/rman_reset_db_prev_incr_2.cmd RMAN> run 2> { 3> set until time ="to_date('26-05-2014 06:35:10','dd-mm-yyyy hh24:mi:ss')"; 4> restore database; 5> recover database; 6> sql "alter database open resetlogs"; 7> } executing command: SET until clause Starting restore at 27-05-2014 12:41:32 Starting implicit crosscheck backup at 27-05-2014 12:41:32 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=28 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=27 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=24 device type=DISK allocated channel: ORA_DISK_5 channel ORA_DISK_5: SID=26 device type=DISK Crosschecked 14 objects Crosschecked 17 objects Finished implicit crosscheck backup at 27-05-2014 12:41:50 Starting implicit crosscheck copy at 27-05-2014 12:41:50 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 using channel ORA_DISK_5 Crosschecked 8 objects Finished implicit crosscheck copy at 27-05-2014 12:41:54 searching for all files in the recovery area cataloging files... cataloging done List of Cataloged Files ======================= File Name: +data/CVRMAN/AUTOBACKUP/2014_05_22/s_848234751.333.848234751 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_26/s_848558156.273.848558159 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_26/s_848563392.327.848563395 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_26/s_848563796.306.848563797 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_26/s_848572162.352.848572165 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_26/s_848578992.322.848578995 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_18/s_847859913.339.847859915 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_16/s_847715018.261.847715019 File Name: +data/CVRMAN/AUTOBACKUP/2014_05_25/s_848470395.297.848470397 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_27/thread_1_seq_2.291.848642459 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_7.337.848558117 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_8.347.848558119 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_6.329.848558119 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_1.340.848560257 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_2.338.848560891 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_3.324.848560897 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_4.341.848560897 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_5.285.848561997 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_4.298.848563339 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_5.260.848563339 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_6.276.848563339 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_1.326.848571335 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_2.343.848571337 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_3.345.848571341 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_4.282.848571519 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_5.346.848571521 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_6.348.848571521 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_7.349.848572129 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_5.350.848572129 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_6.351.848572129 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_1.353.848573413 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_2.354.848573415 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_26/thread_1_seq_1.314.848613647 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_25/thread_1_seq_3.309.848480471 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_25/thread_1_seq_4.280.848480485 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_25/thread_1_seq_5.286.848480517 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_25/thread_1_seq_6.281.848513485 File Name: +data/CVRMAN/ARCHIVELOG/2014_05_25/thread_1_seq_7.334.848527963 File Name: +data/CVRMAN/DATAFILE/tbs2.bkp using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 using channel ORA_DISK_5 skipping datafile 4; already restored to file +DATA/cvrman/datafile/users.259.847354795 skipping datafile 5; already restored to file +DATA/cvrman/datafile/example_new.dbf channel ORA_DISK_1: restoring datafile 00006 input datafile copy RECID=83 STAMP=848217961 file name=+DATA/cvrman/datafile/tbs1.294.847433665 destination for restore of datafile 00006: +DATA/cvrman/datafile/tbs1_new.dbf channel ORA_DISK_2: starting datafile backup set restore channel ORA_DISK_2: specifying datafile(s) to restore from backup set channel ORA_DISK_2: restoring datafile 00003 to +DATA/cvrman/datafile/undotbs1.318.848201233 channel ORA_DISK_2: reading from backup piece +DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.290.848207929 channel ORA_DISK_3: starting datafile backup set restore channel ORA_DISK_3: specifying datafile(s) to restore from backup set channel ORA_DISK_3: restoring datafile 00002 to +DATA/cvrman/datafile/sysaux.257.847354793 channel ORA_DISK_3: reading from backup piece +DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.287.848207921 channel ORA_DISK_4: starting datafile backup set restore channel ORA_DISK_4: specifying datafile(s) to restore from backup set channel ORA_DISK_4: restoring datafile 00001 to +DATA/cvrman/datafile/system.256.847354793 channel ORA_DISK_4: reading from backup piece +DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.313.848207917 channel ORA_DISK_5: restoring datafile 00007 input datafile copy RECID=88 STAMP=848666518 file name=+DATA/cvrman/datafile/tbs2.bkp destination for restore of datafile 00007: +DATA/cvrman/datafile/tbs2.328.848469625 channel ORA_DISK_1: copied datafile copy of datafile 00006 output file name=+DATA/cvrman/datafile/tbs1_new.dbf RECID=0 STAMP=0 channel ORA_DISK_2: piece handle=+DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.290.848207929 tag=TAG20140522T051830 channel ORA_DISK_2: restored backup piece 1 channel ORA_DISK_2: restore complete, elapsed time: 00:00:17 channel ORA_DISK_5: copied datafile copy of datafile 00007 output file name=+DATA/cvrman/datafile/tbs2.328.848469625 RECID=0 STAMP=0 channel ORA_DISK_3: piece handle=+DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.287.848207921 tag=TAG20140522T051830 channel ORA_DISK_3: restored backup piece 1 channel ORA_DISK_3: restore complete, elapsed time: 00:01:07 channel ORA_DISK_4: piece handle=+DATA/cvrman/backupset/2014_05_22/nnndf0_tag20140522t051830_0.313.848207917 tag=TAG20140522T051830 channel ORA_DISK_4: restored backup piece 1 channel ORA_DISK_4: restore complete, elapsed time: 00:01:16 Finished restore at 27-05-2014 12:43:21 Starting recover at 27-05-2014 12:43:22 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 using channel ORA_DISK_5 datafile 4 not processed because file is read-only datafile 5 not processed because file is read-only starting media recovery archived log for thread 1 with sequence 8 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_8.319.848465559 archived log for thread 1 with sequence 9 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_9.320.848465561 archived log for thread 1 with sequence 10 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_10.317.848465559 archived log for thread 1 with sequence 1 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_1.325.848467105 archived log for thread 1 with sequence 2 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_2.301.848469759 archived log for thread 1 with sequence 3 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_3.309.848480471 archived log for thread 1 with sequence 4 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_4.280.848480485 archived log for thread 1 with sequence 5 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_5.286.848480517 archived log for thread 1 with sequence 6 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_6.281.848513485 archived log for thread 1 with sequence 7 is already on disk as file +DATA/cvrman/archivelog/2014_05_25/thread_1_seq_7.334.848527963 archived log for thread 1 with sequence 8 is already on disk as file +DATA/cvrman/archivelog/2014_05_26/thread_1_seq_8.347.848558119 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_8.319.848465559 thread=1 sequence=8 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_9.320.848465561 thread=1 sequence=9 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_10.317.848465559 thread=1 sequence=10 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_1.325.848467105 thread=1 sequence=1 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_2.301.848469759 thread=1 sequence=2 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_3.309.848480471 thread=1 sequence=3 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_4.280.848480485 thread=1 sequence=4 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_5.286.848480517 thread=1 sequence=5 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_6.281.848513485 thread=1 sequence=6 archived log file name=+DATA/cvrman/archivelog/2014_05_25/thread_1_seq_7.334.848527963 thread=1 sequence=7 archived log file name=+DATA/cvrman/archivelog/2014_05_26/thread_1_seq_8.347.848558119 thread=1 sequence=8 media recovery complete, elapsed time: 00:01:15 Finished recover at 27-05-2014 12:44:44 sql statement: alter database open resetlogs RMAN> **end-of-file**
No comments:
Post a Comment