How to Duplicate a RAC database using RMAN

Posted at Monday, September 24, 2007
Duplicating a RAC database via RMAN can be a bit tricky. In essence, it is the same as duplicating a single instance to a single instance with a couple of twists.

In my example, I am cloning a 2 instance 10gR2 (10.2.0.3) database to another 10gR2(10.2.0.3) on the same server. In reality, I am cloning a template database that will become my RMAN repository. Therefore, in this example, I will be using a disk backup without an RMAN repository. In order to duplicate a RAC database (RAC to RAC), you need to follow these basic steps:

1.) Create a password file for the new database you wish to create (the auxiliary)

2.) Create a new parameter file for your new database and REMOVE all RAC-centric (multiple-instance) parameters. In effect, you are duplicating to a single instance and then make it a clustered database afterwards.

3.) Create a static listener entry for your new database and reload the listener as appropriate. This step is necessary, because an RMAN duplicate uses an auxiliary database that is in no mount and therefore will not automatically register itself with the listener(s) as specified by local_listener, remote_listener and or the default, 1521.

For example:

      (SID_DESC =   
(GLOBAL_DBNAME = rman.colestock.test)
(ORACLE_HOME = /u03/app/oracle/product/db/10.2)
(SID_NAME = rman2)
)

4.) Connect to the auxiliary database and put it in no mount

5.) Change the RMAN configuration of the target database to reflect a location for a disk backup:

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/%U';

and then take a full backup - including archivelogs - via:

backup database plus archivelog;

The DUPLICATE operation uses this backup, including a connection to the TARGET database in order to create the auxiliary

6.) Create an RMAN script file - similar to the following - that renames files as appropriate:

run {
allocate auxiliary channel ch1 device type disk format '/u03/%U';
set newname for tempfile 1 to '/u02/app/oradata/rman/temp01.dbf';
configure auxname for datafile 1 to '/u02/app/oradata/rman/system01.dbf';
configure auxname for datafile 2 to '/u02/app/oradata/rman/undotbs01.dbf';
configure auxname for datafile 3 to '/u02/app/oradata/rman/sysaux01.dbf';
configure auxname for datafile 4 to '/u02/app/oradata/rman/users01.dbf';
configure auxname for datafile 5 to '/u02/app/oradata/rman/undotbs02.dbf';
duplicate target database to "rman"
logfile
group 1 ('/u02/app/oradata/rman/redo01a.log',
'/u02/app/oradata2/rman/redo01b.log') size 50M reuse,
group 2 ('/u02/app/oradata/rman/redo02a.log',
'/u02/app/oradata2/rman/redo02b.log') size 50M reuse;
}

Notice how the auxiliary channel points to where the disk backup is.

7.) In order to avoid 'Internal Bug 4355382 ORA-38856: FAILED TO OPEN DATABASE WITH RESETLOGS WHEN USING RAC BACKUP,' set the following initialization parameter on the auxiliary; shutdown immediate; and then put the database back into no mount:

_no_recovery_through_resetlogs=TRUE

8.) Run the aforementioned script to duplicate the database:

rman target=/ auxiliary=sys/password@rman2

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Sep 24 14:40:29 2007

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

connected to target database: CUBS (DBID=2121269038)
connected to auxiliary database: RMAN (not mounted)

RMAN> @duplicate_cubs.rman

9.) If Step 8 is successful, then turn the auxiliary database into a RAC database by adding back all the necessary parameters, such as cluster_database, cluster_instances, thread, local_listener, etc.

10.) Add the second thread of online redo logs and enable that thread; startup the second instance:

SQL> alter database add logfile thread 2 group 3 ('/u02/app/oradata/rman/redo03a.log',
'/u02/app/oradata2/rman/redo03b.log') size 50m reuse;

Database altered.

SQL> alter database add logfile thread 2 group 4 ('/u02/app/oradata/rman/redo04a.log',
'/u02/app/oradata2/rman/redo04b.log') size 50m reuse;

SQL> alter database enable public thread 2;

Database altered.

SQL> startup;

11.) Optionally, add the new database to srvctl:

srvctl add database -d rman -o /u03/app/oracle/product/db/10.2
srvctl add instance -d rman -i rman2 -n rac2
srvctl add instance -d rman -i rman1 -n rac1


Labels: , ,