restore rman backup to another server for testing disaster recovery procedures as well as for...

8
« 12c Database Upgrade – 11.2.0.3 to 12.1.0.1 upgrade using DBUA Home Enterprise Manager 12c Agentless Automatic Target Discovery » Restore RMAN backup to another server for testing disaster recovery procedures as well as for cloning This note explains the procedure used to restore an Oracle Suggested Strategy incremental backup on another server. This is useful when we have to do periodic testing of disaster recovery procedures where we simulate a scenario when the complete database server has crashed and a new server has been provisioned. But let us assume that the directory structure on the new or target server is different to that of the source server. So in this case the backup has been restored to the staging location /home/oracle/stage on the new server and all the database files are being restored in a different location to that on the source – /home/oracle/sqlfun Restore the SPFILE RMAN> startup nomount force; startup failed: ORA01078: failure in processing system parameters LRM00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_2/dbs starting Oracle instance without parameter file for retrieval of spfile Oracle instance started Total System Global Area 158662656 bytes Fixed Size 2226456 bytes Variable Size 104859368 bytes Database Buffers 46137344 bytes Redo Buffers 5439488 bytes RMAN> restore spfile from '/home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkp'; Starting restore at 04JUL13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=162 device type=DISK channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/stage/o1_mf_s_81982 channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete Finished restore at 04JUL13 Create the PFILE from SPFILE and make parameter changes as required $ sqlplus sys as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 09:43:48 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Enter password: Connected to an idle instance. SQL> create pfile from spfile; File created. Note make required changes here in the init.ora file to take care of new directories for control files, audit dump, fast recovery area etc

Upload: theahmadkhan

Post on 06-Dec-2015

2 views

Category:

Documents


0 download

DESCRIPTION

a

TRANSCRIPT

Page 1: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

« 12c Database Upgrade – 11.2.0.3 to 12.1.0.1 upgradeusing DBUA

Home Enterprise Manager 12c Agentless Automatic TargetDiscovery »

Restore RMAN backup to another server for testing disaster recovery proceduresas well as for cloning

This note explains the procedure used to restore an Oracle Suggested Strategy incremental backup on another server.

This is useful when we have to do periodic testing of disaster recovery procedures where we simulate a scenario whenthe complete database server has crashed and a new server has been provisioned.

But let us assume that the directory structure on the new or target server is different to that of the sourceserver.

So in this case the backup has been restored to the staging location /home/oracle/stage on the new server and all thedatabase files are being restored in a different location to that on the source – /home/oracle/sqlfun

Restore the SPFILE

RMAN> startup nomount force;

startup failed: ORA­01078: failure in processing system parametersLRM­00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initsqlfun.ora'

starting Oracle instance without parameter file for retrieval of spfileOracle instance started

Total System Global Area 158662656 bytes

Fixed Size 2226456 bytesVariable Size 104859368 bytesDatabase Buffers 46137344 bytesRedo Buffers 5439488 bytes

RMAN> restore spfile from '/home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkp';

Starting restore at 04­JUL­13using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=162 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkpchannel ORA_DISK_1: SPFILE restore from AUTOBACKUP completeFinished restore at 04­JUL­13

Create the PFILE from SPFILE and make parameter changes as required

$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 09:43:48 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Enter password:Connected to an idle instance.

SQL> create pfile from spfile;

File created.

Note­ make required changes here in the init.ora file to take care of new directories for control files, auditdump, fast recovery area etc

Page 2: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

SQL> create spfile from pfile;

File created.

Restore the Control Files

RMAN> restore controlfile from '/home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkp';

Starting restore at 04­JUL­13using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control filechannel ORA_DISK_1: restore complete, elapsed time: 00:00:01output file name=/home/oracle/sqlfun/control01.ctloutput file name=/home/oracle/sqlfun/control02.ctlFinished restore at 04­JUL­13

Mount the database and catalog the backup pieces which have been restored in the new location

RMAN> alter database mount;

database mountedreleased channel: ORA_DISK_1

RMAN> catalog start with '/home/oracle/stage';

Starting implicit crosscheck backup at 04­JUL­13using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=134 device type=DISKCrosschecked 25 objectsFinished implicit crosscheck backup at 04­JUL­13

Starting implicit crosscheck copy at 04­JUL­13using channel ORA_DISK_1Crosschecked 10 objectsFinished implicit crosscheck copy at 04­JUL­13

searching for all files in the recovery areacataloging files...cataloging done

List of Cataloged Files=======================File Name: /u01/app/oracle/flash_recovery_area/SQLFUN/autobackup/2013_07_04/o1_mf_n_819884144_8x9ncjfl_.bkpFile Name: /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_33_8x84ld7x_.arcFile Name: /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_35_8x8db3hp_.arcFile Name: /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_36_8x8dbgcm_.arcFile Name: /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_34_8x8d9y2h_.arcFile Name: /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_32_8x6mflv0_.arc

searching for all files that match the pattern /home/oracle/stage

List of Files Unknown to the Database=====================================File Name: /home/oracle/stage/o1_mf_sysaux_7zpgb1hd_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w6zcb_.bkpFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w76jv_.bkp

Page 3: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

File Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w76jv_.bkpFile Name: /home/oracle/stage/o1_mf_undotbs1_7zpgck9f_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w65l9_.bkpFile Name: /home/oracle/stage/o1_mf_example_7zgkdp6p_.dbfFile Name: /home/oracle/stage/o1_mf_threaten_7zpgbyck_.dbfFile Name: /home/oracle/stage/o1_mf_users_7zpgcnno_.dbfFile Name: /home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkpFile Name: /home/oracle/stage/o1_mf_index_da_7zgkcz04_.dbfFile Name: /home/oracle/stage/o1_mf_example__7zpgcg0x_.dbfFile Name: /home/oracle/stage/o1_mf_system_7zpgbh79_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w7b0f_.bkp

Do you really want to catalog the above files (enter YES or NO)? YEScataloging files...cataloging done

List of Cataloged Files=======================File Name: /home/oracle/stage/o1_mf_sysaux_7zpgb1hd_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w6zcb_.bkpFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w76jv_.bkpFile Name: /home/oracle/stage/o1_mf_undotbs1_7zpgck9f_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w65l9_.bkpFile Name: /home/oracle/stage/o1_mf_example_7zgkdp6p_.dbfFile Name: /home/oracle/stage/o1_mf_threaten_7zpgbyck_.dbfFile Name: /home/oracle/stage/o1_mf_users_7zpgcnno_.dbfFile Name: /home/oracle/stage/o1_mf_s_819826669_8x7w7g70_.bkpFile Name: /home/oracle/stage/o1_mf_index_da_7zgkcz04_.dbfFile Name: /home/oracle/stage/o1_mf_example__7zpgcg0x_.dbfFile Name: /home/oracle/stage/o1_mf_system_7zpgbh79_.dbfFile Name: /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w7b0f_.bkp

Generate the SET NEWNAME FOR DATAFILE command

Note:

Since the OSS backup image copy is based on Oracle Managed File format (OMF), I find this error even though wehave set the DB_FILE_NAME_CONVERT parameter to account for the directory path change between source andtarget.

RMAN is not restoring the data files in the new location but is looking for the directory path which existed on the sourcedatabase, but which is not present on the new or target server where we are doing the restore.

RMAN> restore database;

Starting restore at 04­JUL­13using channel ORA_DISK_1

channel ORA_DISK_1: restoring datafile 00001input datafile copy RECID=3060 STAMP=819884997 file name=/home/oracle/stage/o1_mf_system_7zpgbh79_.dbfdestination for restore of datafile 00001: /u01/app/oracle/oradata/sqlfun/system01.dbfORA­19504: failed to create file “/u01/app/oracle/oradata/sqlfun/system01.dbf”ORA­27040: file create error, unable to create fileLinux­x86_64 Error: 2: No such file or directoryAdditional information: 1ORA­19600: input file is datafile­copy 3060 (/home/oracle/stage/o1_mf_system_7zpgbh79_.dbf)ORA­19601: output file is datafile 1 (/u01/app/oracle/oradata/sqlfun/system01.dbf)

So to work around this we will generate a text file via SQL*PLUS which will contain the SET NEWNAME commandsand call this file from RMAN.

These are the contents of the text file rename_files.sql

Page 4: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

These are the contents of the text file rename_files.sql

set head off pages 0 feed off echo off verify offset lines 200spool rename_datafiles.lstselect ‘SET NEWNAME FOR DATAFILE ‘ || FILE# || ‘ TO ”’ || ‘/home/oracle/sqlfun/’ || substr(name,instr(name,’/’,­1)+1)|| ”’;’ from v$datafile;spool offexit;

$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 09:52:44 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Enter password:

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 ­ 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @rename_files.sqlSET NEWNAME FOR DATAFILE 1 TO '/home/oracle/sqlfun/system01.dbf';SET NEWNAME FOR DATAFILE 2 TO '/home/oracle/sqlfun/sysaux01.dbf';SET NEWNAME FOR DATAFILE 3 TO '/home/oracle/sqlfun/undotbs01.dbf';SET NEWNAME FOR DATAFILE 4 TO '/home/oracle/sqlfun/users01.dbf';SET NEWNAME FOR DATAFILE 5 TO '/home/oracle/sqlfun/threatened_fauna_data.dbf';SET NEWNAME FOR DATAFILE 6 TO '/home/oracle/sqlfun/example_temp01.dbf';SET NEWNAME FOR DATAFILE 7 TO '/home/oracle/sqlfun/EXAMPLE_5';SET NEWNAME FOR DATAFILE 8 TO '/home/oracle/sqlfun/INDEX_DATA_6';

Restore and Recover the databaseNow pass this file name to the RMAN run block

RMAN> run 2> @rename_datafiles.lst3> SET NEWNAME FOR DATAFILE 1 TO '/home/oracle/sqlfun/system01.dbf';4> SET NEWNAME FOR DATAFILE 2 TO '/home/oracle/sqlfun/sysaux01.dbf';5> SET NEWNAME FOR DATAFILE 3 TO '/home/oracle/sqlfun/undotbs01.dbf';6> SET NEWNAME FOR DATAFILE 4 TO '/home/oracle/sqlfun/users01.dbf';7> SET NEWNAME FOR DATAFILE 5 TO '/home/oracle/sqlfun/threatened_fauna_data.dbf';8> SET NEWNAME FOR DATAFILE 6 TO '/home/oracle/sqlfun/example_temp01.dbf';9> SET NEWNAME FOR DATAFILE 7 TO '/home/oracle/sqlfun/EXAMPLE_5';10> SET NEWNAME FOR DATAFILE 8 TO '/home/oracle/sqlfun/INDEX_DATA_6';11> **end­of­file**12> restore database;13> switch datafile all;14> recover database;15>

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Page 5: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 04­JUL­13using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=125 device type=DISK

channel ORA_DISK_1: restoring datafile 00001input datafile copy RECID=3060 STAMP=819884997 file name=/home/oracle/stage/o1_mf_system_7zpgbh79_.dbfdestination for restore of datafile 00001: /home/oracle/sqlfun/system01.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00001output file name=/home/oracle/sqlfun/system01.dbf RECID=3061 STAMP=819885296channel ORA_DISK_1: restoring datafile 00002input datafile copy RECID=3053 STAMP=819884997 file name=/home/oracle/stage/o1_mf_sysaux_7zpgb1hd_.dbfdestination for restore of datafile 00002: /home/oracle/sqlfun/sysaux01.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00002output file name=/home/oracle/sqlfun/sysaux01.dbf RECID=3062 STAMP=819885313channel ORA_DISK_1: restoring datafile 00003input datafile copy RECID=3054 STAMP=819884997 file name=/home/oracle/stage/o1_mf_undotbs1_7zpgck9f_.dbfdestination for restore of datafile 00003: /home/oracle/sqlfun/undotbs01.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00003output file name=/home/oracle/sqlfun/undotbs01.dbf RECID=3063 STAMP=819885321channel ORA_DISK_1: restoring datafile 00004input datafile copy RECID=3057 STAMP=819884997 file name=/home/oracle/stage/o1_mf_users_7zpgcnno_.dbfdestination for restore of datafile 00004: /home/oracle/sqlfun/users01.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00004output file name=/home/oracle/sqlfun/users01.dbf RECID=3064 STAMP=819885322channel ORA_DISK_1: restoring datafile 00005input datafile copy RECID=3056 STAMP=819884997 file name=/home/oracle/stage/o1_mf_threaten_7zpgbyck_.dbfdestination for restore of datafile 00005: /home/oracle/sqlfun/threatened_fauna_data.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00005output file name=/home/oracle/sqlfun/threatened_fauna_data.dbf RECID=3065 STAMP=819885327channel ORA_DISK_1: restoring datafile 00006input datafile copy RECID=3059 STAMP=819884997 file name=/home/oracle/stage/o1_mf_example__7zpgcg0x_.dbfdestination for restore of datafile 00006: /home/oracle/sqlfun/example_temp01.dbfchannel ORA_DISK_1: copied datafile copy of datafile 00006output file name=/home/oracle/sqlfun/example_temp01.dbf RECID=3066 STAMP=819885331channel ORA_DISK_1: restoring datafile 00007input datafile copy RECID=3055 STAMP=819884997 file name=/home/oracle/stage/o1_mf_example_7zgkdp6p_.dbfdestination for restore of datafile 00007: /home/oracle/sqlfun/EXAMPLE_5channel ORA_DISK_1: copied datafile copy of datafile 00007output file name=/home/oracle/sqlfun/EXAMPLE_5 RECID=3067 STAMP=819885334channel ORA_DISK_1: restoring datafile 00008input datafile copy RECID=3058 STAMP=819884997 file name=/home/oracle/stage/o1_mf_index_da_7zgkcz04_.dbfdestination for restore of datafile 00008: /home/oracle/sqlfun/INDEX_DATA_6channel ORA_DISK_1: copied datafile copy of datafile 00008output file name=/home/oracle/sqlfun/INDEX_DATA_6 RECID=3068 STAMP=819885339Finished restore at 04­JUL­13

datafile 1 switched to datafile copyinput datafile copy RECID=3069 STAMP=819885343 file name=/home/oracle/sqlfun/system01.dbfdatafile 2 switched to datafile copyinput datafile copy RECID=3070 STAMP=819885343 file name=/home/oracle/sqlfun/sysaux01.dbf

datafile 3 switched to datafile copyinput datafile copy RECID=3071 STAMP=819885343 file name=/home/oracle/sqlfun/undotbs01.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=3072 STAMP=819885343 file name=/home/oracle/sqlfun/users01.dbfdatafile 5 switched to datafile copyinput datafile copy RECID=3073 STAMP=819885343 file name=/home/oracle/sqlfun/threatened_fauna_data.dbfdatafile 6 switched to datafile copyinput datafile copy RECID=3074 STAMP=819885343 file name=/home/oracle/sqlfun/example_temp01.dbfdatafile 7 switched to datafile copyinput datafile copy RECID=3075 STAMP=819885343 file name=/home/oracle/sqlfun/EXAMPLE_5datafile 8 switched to datafile copy

Page 6: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

datafile 8 switched to datafile copyinput datafile copy RECID=3076 STAMP=819885343 file name=/home/oracle/sqlfun/INDEX_DATA_6

Starting recover at 04­JUL­13using channel ORA_DISK_1channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00001: /home/oracle/sqlfun/system01.dbfdestination for restore of datafile 00002: /home/oracle/sqlfun/sysaux01.dbfdestination for restore of datafile 00007: /home/oracle/sqlfun/EXAMPLE_5destination for restore of datafile 00008: /home/oracle/sqlfun/INDEX_DATA_6channel ORA_DISK_1: reading from backup piece /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w65l9_.bkpchannel ORA_DISK_1: piece handle=/home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w65l9_.bkp tag=ORA_OEM_LEVEL_0channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:03channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00003: /home/oracle/sqlfun/undotbs01.dbfchannel ORA_DISK_1: reading from backup piece /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w6zcb_.bkpchannel ORA_DISK_1: piece handle=/home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w6zcb_.bkp tag=ORA_OEM_LEVEL_0channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00004: /home/oracle/sqlfun/users01.dbfdestination for restore of datafile 00005: /home/oracle/sqlfun/threatened_fauna_data.dbfchannel ORA_DISK_1: reading from backup piece /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w76jv_.bkpchannel ORA_DISK_1: piece handle=/home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w76jv_.bkp tag=ORA_OEM_LEVEL_0channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_DISK_1: starting incremental datafile backup set restorechannel ORA_DISK_1: specifying datafile(s) to restore from backup setdestination for restore of datafile 00006: /home/oracle/sqlfun/example_temp01.dbfchannel ORA_DISK_1: reading from backup piece /home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w7b0f_.bkpchannel ORA_DISK_1: piece handle=/home/oracle/stage/o1_mf_nnnd1_ORA_OEM_LEVEL_0_8x7w7b0f_.bkp tag=ORA_OEM_LEVEL_0channel ORA_DISK_1: restored backup piece 1channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

starting media recovery

archived log for thread 1 with sequence 33 is already on disk as file /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_33_8x84ld7x_.arcarchived log for thread 1 with sequence 34 is already on disk as file /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_34_8x8d9y2h_.arcarchived log for thread 1 with sequence 35 is already on disk as file /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_35_8x8db3hp_.arcarchived log for thread 1 with sequence 36 is already on disk as file /u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_36_8x8dbgcm_.arcarchived log file name=/u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_33_8x84ld7x_.arc thread=1 sequence=33archived log file name=/u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_34_8x8d9y2h_.arc thread=1 sequence=34archived log file name=/u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_35_8x8db3hp_.arc thread=1 sequence=35archived log file name=/u01/app/oracle/flash_recovery_area/SQLFUN/archivelog/2013_07_04/2013_07_03/o1_mf_1_36_8x8dbgcm_.arc thread=1 sequence=36unable to find archived logarchived log thread=1 sequence=37RMAN­00571: ===========================================================RMAN­00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN­00571: ===========================================================

RMAN­03002: failure of recover command at 07/04/2013 09:55:58RMAN­06054: media recovery requesting unknown archived log for thread 1 with sequence 37 and starting SCN of 33985482

RMAN>

the error can be ignored as RMAN has applied all the available archive log files and is now trying to apply a non­existentarchive log file.Open the database with RESETLOGSThe RESETLOGS command will fail because we do not have the same directory path which existed on the source forthe Online Redo Log files.

So we create a script which will generate the new online redo log file names.

Page 7: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques

So we create a script which will generate the new online redo log file names.

These are the contents of the rename_logfiles.sql file

set head off pages 0 feed off echo off verify offset lines 200spool rename_logfiles.lstselect ‘alter database rename file ”’|| member ||”’ ‘||chr(10)|| ‘ TO ”’ || ‘/home/oracle/sqlfun/’ ||substr(member,instr(member,’/’,­1)+1) || ”’;’ from v$logfile;spool offexit;

$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 10:05:17 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Enter password:

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 ­ 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @rename_logfiles.sqlalter database rename file '/u01/app/oracle/oradata/sqlfun/redo03.log'TO '/home/oracle/sqlfun/redo03.log';

alter database rename file '/u01/app/oracle/oradata/sqlfun/redo02.log'TO '/home/oracle/sqlfun/redo02.log';

alter database rename file '/u01/app/oracle/oradata/sqlfun/redo01.log'TO '/home/oracle/sqlfun/redo01.log';

Note – we can do all this from the RMAN prompt as well using the RMAN SQL command. But for this example we do itfrom SQL*PLUS

$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 10:50:44 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Enter password:

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 ­ 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @rename_logfiles.lst

Database altered.

Database altered.

Database altered.

SQL> alter database open resetlogs;

Database altered.

July 5th, 2013 | Tags: Disaster Recovery, loss of all database files, resetlogs, restore, rman, rman clone | Category: Backupand Recovery

Page 8: Restore RMAN Backup to Another Server for Testing Disaster Recovery Procedures as Well as for Cloning « Oracle DBA – Tips and Techniques