HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node (Doc ID 415579.1)
APPLIES TO:
Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.
***Checked for relevance on 15-Apr-2014***
GOAL
- You have a RAC database backed up by RMAN to disk location you have a backup to disk by RMAN position RAC database
- You need to restore this backup as Single Instance on another node you need to restore this backup on another node single instance
SOLUTION
1) Take appropriate RMAN backup of the production RAC database. Note that you should turn on the CONTROLFILE AUTOBACKUP configuration so that we have the controlfile backed up after the database backup. When we restore the controlfile on new host from this autobackup piece, it will have the information of the latest backup.
Production RAC database appropriate RMAN backup. Please note that you should open CONTROLFILE AUTOBACKUP configured to back up the control file after the database backup. When we fragment from automatic backup restore control files to the new host, it will have the latest information backup.
RMAN> run{ 2> allocate channel c1 type disk format '/<PATH>/%U'; 3> backup database; 4> backup archivelog all; 5> } allocated channel: c1 channel c1: sid=133 instance=<oracle_sid> devtype=DISK Starting backup at 12-FEB-07 channel c1: starting full datafile backupset channel c1: specifying datafile(s) in backupset input datafile fno=00001 name=/<PATH>/system01.dbf input datafile fno=00002 name=/<PATH>/undotbs01.dbf input datafile fno=00005 name=/<PATH>/undotbs02.dbf input datafile fno=00003 name=/<PATH>/sysaux01.dbf input datafile fno=00004 name=/<PATH>/users01.dbf channel c1: starting piece 1 at 12-FEB-07 channel c1: finished piece 1 at 12-FEB-07 piece handle=/<PATH>/09i9sruq_1_1 tag=TAG20070212T162458 comment=NONE channel c1: backup set complete, elapsed time: 00:01:05 Finished backup at 12-FEB-07 Starting backup at 12-FEB-07 current log archived channel c1: starting archive log backupset channel c1: specifying archive log(s) in backup set input archive log thread=1 sequence=56 recid=3 stamp=613417105 input archive log thread=1 sequence=57 recid=4 stamp=613417106 input archive log thread=1 sequence=58 recid=5 stamp=614363168 input archive log thread=2 sequence=1 recid=1 stamp=613417090 input archive log thread=2 sequence=2 recid=2 stamp=613417093 input archive log thread=2 sequence=3 recid=6 stamp=614363170 channel c1: starting piece 1 at 12-FEB-07 channel c1: finished piece 1 at 12-FEB-07 piece handle=/<PATH>/0ai9ss14_1_1 tag=TAG20070212T162610 comment=NONE channel c1: backup set complete, elapsed time: 00:00:04 Finished backup at 12-FEB-07 Starting Control File and SPFILE Autobackup at 12-FEB-07 piece handle=/<PATH>/c-610677177-20070212-00 comment=NONE Finished Control File and SPFILE Autobackup at 12-FEB-07 released channel: c1
2) Create a PFILE for the single instance database using the production RAC parameter file so created PFILE single instance database files with the parameters produced RAC
a) do not forget to modify the following parameters depending on the directory structure of the new host: audit_file_dest , background_dump_dest, control_files, core_dump_dest, log_archive_dest_1 , user_dump_dest etc do not forget that according to the directory structure of the new host modify the following parameters: audit_file_dest, background_dump_dest, control_files, core_dump_dest , log_archive_dest_1, user_dump_dest etc.
b) remove RAC specific parameters such as cluster_database_instances, cluster_database etc delete RAC-specific parameters, e.g. cluster_database_instances, cluster_database etc.
c) for the parameter undo_tablespace, mention any one undo tablespace name for UNDO_TABLESPACE parameters, using any of a tablespace name undo
Issue Which May The require AN Known the Parameter Additional to the SET BE: - may need to set other parameters known issues
Note 334,899.1 RMAN Duplicate from RAC Backup fails Total ORA-38856
3) Move the backup pieces and the modified INIT.ORA file to the new host. Starting from 10g it is NO longer compulsory to copy the RMAN backup pieces to exactly the same location on the new host as the production location.
The backup pieces and INIT.ORA modified file to the new host. 10g from the start, no longer has to be copied to the backup pieces RMAN and production of new host location exactly the same place.
4) Use the pfile created above to STARTUP NOMOUNT the database on the new host using the above created pfile start NOMOUNT database on the new host
oracle@test-br ractest]$ sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 16 03:14:23 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount; ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218292 bytes Variable Size 62916876 bytes Database Buffers 96468992 bytes Redo Buffers 7168000 bytes
5) Now invoke RMAN and restore the controlfile specifying the location where the controlfile autobackup piece is restored on this new server. You can mount the database once the controlfile is restored successfully.
Now calls RMAN and restore the control file, restore and specify the location of the file on the new server. After successfully restored control files, you can load the database
[oracle@test-br ractest]$ rman target / nocatalog Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 16 03:16:31 2007 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: <db_name> (not mounted) using target database control file instead of recovery catalog RMAN> restore controlfile from '/<PATH>/c-610677177-20070212-00'; Starting restore at 16-FEB-07 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:02 output filename=/<PATH>/control01.ctl Finished restore at 16-FEB-07 RMAN> alter database mount; database mounted released channel: ORA_DISK_1
6) You can skip this step if you have restored the RMAN backup pieces to exactly the same location they were backed up on production. If this is not the case then you need to catalog the RMAN backup pieces to make RMAN aware of their new location on the new host. Note that CATALOG BACKUPPIECE command is available only starting from 10g.
If RMAN backup pieces have exactly the same position to restore the production of the backup, you can skip this step. If this is not the case, it is necessary to classify RMAN backup block, so that they know RMAN new position on the new host. Note, CATALOG BACKUPPIECE command is available only from the start of 10g.
RMAN> catalog backuppiece '/<PATH>/09i9sruq_1_1'; cataloged backuppiece backup piece handle=/<PATH>/09i9sruq_1_1 recid=10 stamp=614661579 RMAN> catalog backuppiece '/<PATH>/0ai9ss14_1_1'; cataloged backuppiece backup piece handle=/<PATH>/0ai9ss14_1_1 recid=11 stamp=614661599
7) Now we'll determine the point upto which media recovery should run on the restored database.
Now, we determine the point in time on the restored database should run media recovery
RMAN> list backup of archivelog all; List of Archived Logs in backup set 9 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 56 214541 01-FEB-07 226238 01-FEB-07 1 57 226238 01-FEB-07 226240 01-FEB-07 1 58 226240 01-FEB-07 233107 12-FEB-07 2 1 186185 28-JAN-07 225714 01-FEB-07 2 2 225714 01-FEB-07 226037 01-FEB-07 2 3 226037 01-FEB-07 233110 12-FEB-07
Check the last archive sequence for all redo threads and select the archive sequence having LEAST "Next SCN" among them. In our case sequence 58 of thread 1 has Next SCN of 233107 while sequence 3 of thread 2 has Next SCN of 233110. Since squence 58 of thread 1 has least Next SCN we will recover upto this point. (If you are keen to have recovery run until some specific time you can always give SET UNTIL TIME)
Last archived redo sequence check all threads, and select one with the lowest "Next SCN" archive sequence. In our case, the thread 1 sequence of 58 Next SCN to 233,107, while the sequence of the thread 2 Next SCN 3 is 233,110. Since the minimal sequence thread 1 Next SCN 58, we will return to this point. (If you want to perform a recovery before a specific time, you can always set the SET UNTIL the TIME)
8) Having Determined at The Point upto Which Media Recovery Should RUN, Start at The Restore / Recovery a using: OK should run the point in time media recovery after use the following command to start restore / recovery
Please note in below example we choose Until sequence as 59(one more then the value selected in step 7 that is sequence 58) because When we specify a sequence number, it is considered as an UPPER limit, RMAN selects only
Use the following steps to start recovery: Note In the following example, we have chosen Until sequence of 59 (ratio value selected in step 7 (a sequence of more than 58)), because when we specify the serial number, it is considered limit UPPER , RMAN selects only
those files which are needed for the recovery and uses 59 as an upper log sequence number while recovering database and would recovery upt log sequence number upto 58 .
Restore the required files, using 59 as a log sequence number in a higher recovery of the database, and the recovery log sequence number up to 58.
RMAN> run { 2> set until sequence 59 thread 1; 3> set newname for datafile 1 to '/<PATH>/system01.dbf'; 4> set newname for datafile 2 to '/<PATH>/undotbs01.dbf'; 5> set newname for datafile 3 to '/<PATH>/sysaux01.dbf'; 6> set newname for datafile 4 to '/<PATH>/users01.dbf'; 7> set newname for datafile 5 to '/<PATH>/undotbs02.dbf'; 8> restore database; 9> switch datafile all; 10> recover database; 11> }
set newname for datafile 1 to '+<disk_group>'; set newname for datafile 2 to '+<disk_group>'; ....
Known issue in Oracle10g:
Note 1146703.1 Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0]
If Online Redolog's (ORL's) are Oracle Managed Files (OM), and the Clone is being done on any of Source RAC Node (where ORLs are accessible from), renaming ORL will try to remove Source ORL files!
Please Review: http://docs.oracle .com / cd / E11882_01 / server.112 / e25494 / omf.htm # ADMIN11517
at the following statements are used to the rename files : the following statement is used to rename files
ALTER DATABASE RENAME FILE ALTER TABLESPACE ... RENAME DATAFILE
These statements do not actually rename the files on the operating system, but rather, the names in the control file are changed. If the old file is an Oracle managed file and it exists, then it is deleted. You must specify each filename using the conventions for filenames on your operating system when you issue this statement."
These statements do not actually rename the file on the operating system, but to change the name of the control file. If the old file is an Oracle managed file and there, it is removed. When issuing this statement, you must use the operating system conventions specify the file name of each file nameInstead of renaming, we can recreate the controlfile with desired name for ORLs: In addition to renaming, we can also use the name that you want to re-create ORL control file
SQL> alter database backup controlfile to trace as '/tmp/control.sql' resetlogs ;
Since we determined previously that media recovery should run until sequence 58 hence we use SET UNTIL SEQUENCE 59 (+1) above. You also need to use SET NEWNAME clause to restore datafiles to a location on the new host which is different from the production path. Finally, SWITCH DATAFILE ALL clause updates these new datafile locations in the controlfile.
As we previously determined sequence of media recovery should run to 58, we use the above SET UNTIL SEQUENCE 59 (+1). You also need to use SET NEWNAME clause to restore the data files to the new host and production path different locations. Finally, SWITCH DATAFILE ALL clause update these new data file locations control file.
9) Once RMAN restore / recovery finishes , you will want to rename the online redolog files before opening the database in case the production path of redo log files is not available on the new host. After renaming the redolog files, the database can be opened with RESETLOGS
After RMAN restore / recovery is complete, if online redolog files production path on the new host is not available, you will need to open the database before you rename online redolog files. After you rename the redo log file, you can open the database using the RESETLOGS
SQL> select member from v$logfile; MEMBER -------------------------------------------------------------------------------- /<old_path>/redo01.log /<old_path>/redo02.log /<old_path>/redo03.log /<old_path>/redo04.log /<old_path>/redo05.log /<old_path>/redo06.log 6 rows selected. SQL> alter database rename file '/<old_path>/redo01.log' to '/<new_path>/redo01.log'; Database altered. SQL> alter database rename file '/<old_path>/redo02.log' to '/<new_path>/redo02.log'; Database altered. SQL> alter database rename file '/<old_path>/redo03.log' to '/<new_path>/redo03.log'; Database altered. SQL> alter database rename file '/<old_path>/redo04.log' to '/<new_path>/redo04.log'; Database altered. SQL> alter database rename file '/<old_path>/redo05.log' to '/<new_path>/redo05.log'; Database altered. SQL> alter database rename file '/<old_path>/redo06.log' to '/<new_path>/redo06.log'; Database altered. SQL> alter database open resetlogs; Database altered.
If you want to clone / target ASM disk group (e.g. + DATA) database Creating online redo logs, you can use the following command
alter database rename file '/<old_path>/redo01.log' to '+<disk_group>'; alter database rename file '/<old_path>/redo02.log' to '+<disk_group>'; ...
10) Once the database is opened successfully, you may remove the redolog groups for redo threads of other instances
After successfully opening the database, you can delete redo redo thread group of other instances
SQL> select THREAD#, STATUS, ENABLED 2 from v$thread; THREAD# STATUS ENABLED ---------- ------ -------- 1 OPEN PUBLIC 2 CLOSED PRIVATE SQL> select group# from v$log where THREAD#=2; GROUP# ---------- 4 5 6 SQL> alter database disable thread 2; Database altered. SQL> alter database drop logfile group 4; alter database drop logfile group 4 * ERROR at line 1: ORA-00350: log 4 of instance racdb2 (thread 2) needs to be archived ORA-00312: online log 4 thread 2: '/<PATH>/redo04.log' SQL> alter database clear unarchived logfile group 4; Database altered. SQL> alter database drop logfile group 4; Database altered. SQL> alter database drop logfile group 5; Database altered. SQL> alter database drop logfile group 6; Database altered. SQL> select THREAD#, STATUS, ENABLED from v$thread; THREAD# STATUS ENABLED ---------- ------ -------- 1 OPEN PUBLIC
11) Now you can remove the undo tablespaces of other instances and create a new temporary tablespace to complete the activity.
You can now delete other instances of UNDO table space, and create a new TEMP table space to complete the activity
SQL> sho parameter undo; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ undo_management string AUTO undo_retention integer 900 undo_tablespace string UNDOTBS1 SQL> SQL> SQL> select tablespace_name from dba_tablespaces where contents='UNDO'; TABLESPACE_NAME ------------------------------ UNDOTBS1 UNDOTBS2 SQL> drop tablespace UNDOTBS2 including contents and datafiles; Tablespace dropped. SQL> select name from v$tempfile; NAME -------------------------------------------------------------------------------- /<PATH>/temp01.dbf SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY'; TABLESPACE_NAME ------------------------------ TEMP SQL> create temporary tablespace TEMP1 2 tempfile '/<PATH>/temp01.dbf' 3 size 50M; Tablespace created. SQL> alter database default temporary tablespace TEMP1; Database altered. SQL> drop tablespace TEMP including contents and datafiles; Tablespace dropped.
REFERENCES
NOTE:1146703.1 - Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0]