HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node
时间:2022-03-13 23:58
In this Document
APPLIES TO:
Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Information in this document applies to any platform.
***Checked for relevance on 15-Apr-2014***
8) Having determined the point upto which media recovery should run, start the restore/recovery using:
RMAN> run {
2> set until sequence 59 thread 1;
3> set newname for datafile 1 to ‘/u01/oracle/oradata/ractest/data/system01.dbf‘;
4> set newname for datafile 2 to ‘/u01/oracle/oradata/ractest/data/undotbs01.dbf‘;
5> set newname for datafile 3 to ‘/u01/oracle/oradata/ractest/data/sysaux01.dbf‘;
6> set newname for datafile 4 to ‘/u01/oracle/oradata/ractest/data/users01.dbf‘;
7> set newname for datafile 5 to ‘/u01/oracle/oradata/ractest/data/undotbs02.dbf‘;
8> restore database;
9> switch datafile all;
10> recover database;
11> }
In case you want to have the datafiles on a ASM diskgroup (+DATA for eg) for the clone/destination database, you may use SET NEWNAME as below:
set newname for datafile 1 to ‘+DATA‘;
set newname for datafile 2 to ‘+DATA‘;
....
Known issue in Oracle10g:
Rman Restore From RAC ASM To Single Instance Non ASM Fails With ORA-00600 [kgeade_is_0]
CAUTION !!!!:
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:
The following statements are 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."
Instead of renaming, we can recreate the controlfile with desired name for ORLs:
SQL> alter database backup controlfile to trace as ‘/tmp/control.sql‘ resetlogs ;
Edit /tmp/control.sql and modify desired ORL names.
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.
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
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/ocfs2/oradata/racdb/redo01.log
/ocfs2/oradata/racdb/redo02.log
/ocfs2/oradata/racdb/redo03.log
/ocfs2/oradata/racdb/redo04.log
/ocfs2/oradata/racdb/redo05.log
/ocfs2/oradata/racdb/redo06.log
6 rows selected.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo01.log‘ to ‘/u01/oracle/oradata/ractest/log/redo01.log‘;
Database altered.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo02.log‘ to ‘/u01/oracle/oradata/ractest/log/redo02.log‘;
Database altered.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo03.log‘ to ‘/u01/oracle/oradata/ractest/log/redo03.log‘;
Database altered.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo04.log‘ to ‘/u01/oracle/oradata/ractest/log/redo04.log‘;
Database altered.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo05.log‘ to ‘/u01/oracle/oradata/ractest/log/redo05.log‘;
Database altered.
SQL> alter database rename file ‘/ocfs2/oradata/racdb/redo06.log‘ to ‘/u01/oracle/oradata/ractest/log/redo06.log‘;
Database altered.
SQL> alter database open resetlogs;
Database altered.
In case you want to create the online redo logs on a ASM diskgroup (+DATA for eg) for the clone/destination database, you may use below commands:
alter database rename file ‘/ocfs2/oradata/racdb/redo01.log‘ to ‘+DATA‘;
alter database rename file ‘/ocfs2/oradata/racdb/redo02.log‘ to ‘+DATA‘;
...
10) Once the database is opened successfully, you may remove the redolog groups for redo threads 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: ‘/u01/oracle/oradata/ractest/log/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.
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
--------------------------------------------------------------------------------
/ocfs2/oradata/racdb/temp01.dbf
SQL> select tablespace_name from dba_tablespaces where contents=‘TEMPORARY‘;
TABLESPACE_NAME
------------------------------
TEMP
SQL> create temporary tablespace TEMP1
2 tempfile ‘/u01/oracle/oradata/ractest/data/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.
本文出自 “” 博客,请务必保留此出处