Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Step by Step Restore rman to different host

48,707 views

Published on

Step by Step Restore RMAN to New Host
Twitter : @osamaoracle

Published in: Technology, News & Politics
  • getting error RMAN-03002: failure of switch command at 01/03/2018 11:17:37 ORA-19563: header validation failed for file Starting restore at 03-JAN-18 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=19 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/wizer/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/wizer/noencrypt_data.dbf channel ORA_DISK_1: reading from backup piece /u01/rman_bkp/WIZER/backupset/2018_01_02/o1_mf_nnndf_TAG20180102T165811_f4pv6hpm_.bkp channel ORA_DISK_1: piece handle=/u01/rman_bkp/WIZER/backupset/2018_01_02/o1_mf_nnndf_TAG20180102T165811_f4pv6hpm_.bkp tag=TAG20180102T165811 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:01:05 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/wizer/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/wizer/users01.dbf channel ORA_DISK_1: reading from backup piece /u01/rman_bkp/WIZER/backupset/2018_01_02/o1_mf_nnndf_TAG20180102T165811_f4pv6hsl_.bkp channel ORA_DISK_1: piece handle=/u01/rman_bkp/WIZER/backupset/2018_01_02/o1_mf_nnndf_TAG20180102T165811_f4pv6hsl_.bkp tag=TAG20180102T165811 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:37 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/wizer/system01.dbf channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/wizer/noencrypt_data.dbf channel ORA_DISK_1: reading from backup piece /u01/rman_bkp/Database_1asnm916_1_1 channel ORA_DISK_1: piece handle=/u01/rman_bkp/Database_1asnm916_1_1 tag=TAG20180102T165811 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:45 Finished restore at 03-JAN-18 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of switch command at 01/03/2018 11:17:37 ORA-19563: header validation failed for file
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • RMAN>catalog start with 'your location'; as mr osama shown in 4 of 7 step.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • hi wim, you have to catalog the location where you put on different server for example f:\
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • What if it is not possible to place the generated backup file in the same directory? I'm in a windows environment and the backup file was located on a server with a totally different name.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • In page 3, you started up the database in NOMOUONT mode. But which pfile/spfile did you use?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Step by Step Restore rman to different host

  1. 1. Restore RMAN to New Host Osama Mustafa Page 1 Steps On Source Database **Most Of work will be done on target database 1- Get DBID By Using The below : SQL > Select Db_id from v$database ; Or RMAN target / 2- Get the last SCN On Database since we will not have active redolog using the below document : SQL > select max(next_change#) from v$archived_log where archived = 'YES' group by thread#; Or Using RMAN: RMAN> list backup of archivelog all;
  2. 2. Restore RMAN to New Host Osama Mustafa Page 2 3- Take Backup Using RMAN : run { allocate channel d1 type disk format 'YOUR-PATH/Database_%U; allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk; BACKUP DATABASE PLUS ARCHIVELOG; backup current controlfile format 'YOUR_PATH/controlfile_%U'; release channel c1; release channel c2; release channel c3; } Now move all generated backup file to the new host with the same directory for example if you backup on folder /u01/app then on new host should be the same.
  3. 3. Restore RMAN to New Host Osama Mustafa Page 3 Steps On New Server After copy file do the below steps: 1- export ORACLE_SID=SID_SAME_AS_PROD RMAN TARGET / RMAN > set dbid <as you get it from above query>; RMAN > Startup nomount; RMAN > restore spfile to pfile '/u01/app/oracle/oradata/orcl/initorcl.ora' from autobackup; RMAN> shutdown abort; Now you have to edit SPFile ; *.audit_file_dest=’LOCATION’ *.control_files=’LOCATION’ *.db_recovery_file_dest_size=Size *.db_recovery_file_dest=’LOCATION’ *.diagnostic_dest=’LOCATION’ *.log_archive_dest_1='LOCATION=LOCATION’ *.local_listener='LISTENER_ORCL'
  4. 4. Restore RMAN to New Host Osama Mustafa Page 4 RMAN> startup nomount pfile='/u01/app/oracle/oradata/orcl/initorcl.ora'; RMAN> restore controlfile from autobackup; RMAN> alter database mount; Note: now you have 2 options 1 - move the backup to same location on target server 2- Copy Backup to any location but you need to use CATALOG Command check below : RMAN> catalog start with 'Where You copy Backup'; You are almost Done, You have But before restore database you can move datafile to any location using (all the below steps on RMAN ) But Remember don't run the below yet: SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf'; SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf'; SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/users01.dbf'; SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/example01.dbf'; SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/test.dbf'; SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/dbfs01.dbf'; **Note: After TO: New Location.
  5. 5. Restore RMAN to New Host Osama Mustafa Page 5 SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo01.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo01.log'' "; SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo02.log'' "; SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo03.log'' "; Are you still having SCN that we see it above :) Ok Now you RMAN Script will looks like below RUN { SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/orcl/system01.dbf'; SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/orcl/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/orcl/undotbs01.dbf'; SET NEWNAME FOR DATAFILE 4 TO '/u01/app/oracle/oradata/orcl/users01.dbf'; SET NEWNAME FOR DATAFILE 5 TO '/u01/app/oracle/oradata/orcl/example01.dbf'; SET NEWNAME FOR DATAFILE 6 TO '/u01/app/oracle/oradata/orcl/test.dbf'; SET NEWNAME FOR DATAFILE 7 TO '/u01/app/oracle/oradata/orcl/dbfs01.dbf'; SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo01.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo01.log'' "; SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo02.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo02.log'' "; SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/orcl/redo/redo03.log'' TO ''/u01/app/oracle/oradata/orcl/redo/redo03.log'' ";
  6. 6. Restore RMAN to New Host Osama Mustafa Page 6 SET UNTIL SCN <ABOVE_QUERY>; ESTORE DATABASE; SWITCH DATAFILE ALL; RECOVER DATABASE; } Sqlplus / as sysdba SQL > Alter database open Resetlogs ; Thank you Osama Mustafa http://osamamustafa.blogspot.com Twitter: @OsamaOracle
  7. 7. Restore RMAN to New Host Osama Mustafa Page 7

×