DUPLICATE from ACTIVE Database Using RMAN, a Step-by-Step Guide
Duplicate using RMAN
Recently, I had a request from one of our clients to duplicate a single instance database into a two node RAC database. Both source and destination databases were 11g Rel 2 on Linux. I could take the old approach and use RMAN backups or use 11g's new feature DUPLICATE FROM ACTIVE database, which doesn't need any backup from target database. I preferred to use the second approach.Duplicate from ACTIVE database
Duplicating from an active database doesn't require any RMAN backup to be taken from the source database. Actually, it reads all database structure from the source database that needs to be mounted or opened during the duplication. Although this method seems easy as we don't need to backup source database or make it accessible for auxiliary instance anymore, it has its own disadvantages as well. Two big disadvantages of the ACTIVE database duplication method are:- Negative performance impact on the source database. This impact applies to the whole duplication time.
- High network traffic on the connection between the source and target databases.
Step-by-step instructions
1- Prepare auxiliary instance HRPRD1 on prd-db-01:
Stop all instances of your cluster database except one. In this example, we will use only the HRPRD1 instance, which runs on prd-db-01. We need to stop the other instance, HRPRD2: [code] srvctl stop instance -d HRPRD -i HRPRD2 [/code] Set the following parameters on HRPRD1 instance: [code] . oraenv HRPRD1 sqlplus / as sysdba alter system set db_name=HRPRD scope=spfile; alter system set cluster_database=false scope=spfile; alter system set db_create_file_dest='+HR'; alter system set db_create_online_log_dest_1='+HR'; shutdown immediate startup nomount [/code]2- Enable status registration for HRPRD1 to run LISTENER:
Add the following entries into listener.ora file in GI_HOME.
Make sure that ORACLE_HOME in this entry points to correct home, which is the home from which HRPRD database runs.
3- Add following TNS entries to BOTH auxiliary and target tnsnames.ora file:
[code] HRDEV = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dev-db-01)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = HRDEV) ) ) HRPRD1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = prd-db-01)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = HRPRD) ) ) [/code]4- Ceate a password file for auxiliary instance HRPRD1 on prd-db-01:
Connections to both instances will be through listener and TNS, so we need to use passwords for both auxiliary and target connections.
For HRPRD, since it is a new and empty database, we may need to create a password file for it as follows:
[code] . oraenv HRPRD1 cd $ORACLE_HOME/dbs orapwd password=sys file=orapwHRPRD1 [/code]5- Test connectivity to auxiliary and target instances from BOTH hosts using TNS:
Make sure your connectivity to the source database and to your auxiliary instance works fine; otherwise, duplicate from active database won't work.
[code] sqlplus sys/sys@HRPRD1 as sysdba sqlplus sys/sys@HRDEV as sysdba [/code]6- On the auxiliary host, start RMAN and run the DUPLICATE command:
From host prd-db-01, which runs auxiliary instance hrprd1, start RMAN. Make sure the auxiliary connection is established through listener and not through OS authentication.
[code] . oraenv HRPRD1 rman target sys/sys@HRDEV auxiliary sys/sys@hrprd1 RMAN>run{ DUPLICATE TARGET DATABASE TO HRPRD FROM ACTIVE DATABASE; } [/code]7- When step 6 finishes successfully, start HRPRD database using srvctl. You need to enable the second thread as well:
Share this
You May Also Like
These Related Stories
No Comments Yet
Let us know what you think