RMAN Duplicate

Last week I had a chance to work on RMAN to duplicate the existing 3-node RAC database to another 2-node RAC database. In my case, the 2-node target already has running instances, the task here is to wipe out and copy data from production.

Here is my note. I tried to put some comments to cover in case of when duplicating from a scratch – meaning there is no target database before as well.

Source:
3-node Oracle 10.2.0.3 RAC on Solaris 10: hostA1, hostA2 and hostA3
Database: racA (instance racA1, racA2 and racA3)

Target:
2-node Oracle 10.2.0.3 RAC on Solaris 10: hostB1 and hostB2
Database: racB (instance racB1 and racB2)

1. On source host, backup on source using RMAN (either using catalog or control file to disk or tape). Sample here is shown using control file to disk.

$ORACLE_HOME/bin/rman

RMAN> connect target /
connected to target database: RACA (DBID=2748812654)

run {
allocate channel d1 type disk;
backup format ‘/u1/df_%t_%s_%p’ database
include current controlfile
plus archivelog;
release channel d1;
}

2. Copy all backupset files to one of the target hosts to the same location of backup

$ scp /u1/df* hostB1:/u1/

If this is a new target database, copy the pfile or spfile from source host too.

Also create a password file using orapwd on the target hosts.

3. Modify the initialization parameters.

You can modify the existing spfile directly if the target database exists before. However, I prefer not to touch the original spfile. My suggestion is to create an init file and use that instead. Make sure this new init file will be used everything instance is restarted because during duplicate, database will be restarted by RMAN. To ensure that it will not use the existing spfile, I would recommend renaming it temporarily.

SQL> create pfile=’$ORACLE_HOME/dbs/initracB.ora’ from spfile;

$> mv spfileRACDB.ora spfileRACDB_temp.ora

In initracB.ora
Change
*.cluster_database=false

add convert if names or paths are different
*.db_file_name_convert = (‘/u1/racA’,’/u1/racB’)
*.log_file_name_convert= (‘/u2/racA’,’/u1/racB’)

Due to a bug in note:334899.1, add this
_no_recovery_through_resetlogs=TRUE

4. On target host, create a TNSNAME alias pointing to the source database.

racA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostA1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hostA2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hostA3)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = racA)
(FAILOVER_MODE =
(TYPE = SELECT)
)
)
)

5. Shutdown all instance if up and startup “nomount” only one instance. Leave other instances on other nodes down. The RMAN duplicate will recreate a database instance for one node only.

6. Start RMAN duplicate

$ORACLE_HOME/bin/rman

RMAN> connect target sys/syspassword@racA
connected to target database: RACA (DBID=2748812654)

RMAN> connect auxiliary /
connected to auxiliary database: RACB (DBID=215163916, not open)

RMAN> run {
allocate channel D1 device type disk;
allocate auxiliary channel D2 device type disk;
DUPLICATE TARGET DATABASE TO RACB;
}

You can use “SKIP” option to not duplicate some tablespaces if needed.

If you encountered missing archive files, copy them from source to target on the same path, and re-run RMAN duplicate.

7. Once completed, restart instance to use the original spfile or the one after reverting additional parameters in step #3.

If you try to restart the 2nd instance, it will fail with an error that there is no log thread.

8. Recreate redo logs of thread 2.

ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 4 (‘u01/racB/redo/redo4a’,
‘u02/racB/redo/redo4a’) size 100M,
GROUP 5 (‘u01/racB/redo/redo5a’,
‘u02/racB/redo/redo5a’) size 100M,
GROUP 6 (‘u01/racB/redo/redo6a’,
‘u02/racB/redo/redo6a’) size 100M ;

Then
alter database enable public thread 2;

You now should be able to start the second instance.

9. Add a new temporary file into the temporary tablespace

SQL> alter tablespace temp add tempfile ‘/u1/racB/oradata/temp2.dbf’ size 1024m reuse;

That’s it!!!

5 thoughts on “RMAN Duplicate”

    1. Arshad,
      It was set to false only during the duplication occurs. Once done, the spfile with two instances (cluster_database=true) will be used (mentioned in the step 7).

  1. Pingback: Duplicate RAC database to another new RAC system « Mike Desouza's Blog

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top