Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

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 use old approach using rman backups or using 11g new feature DUPLICATE FROM ACTIVE database which doesnt need any backup from target database and I preferred to use second approach.

Duplicate from ACTIVE database


Duplicate from active database doesnt need any rman backup to be tak en from source database and actually it reads all database structure from the source database which needs to be mounted or opened during duplication. Although it seems good as we dont need to backup source dat abase anymore for duplication but if you have a latest backup of your source database available and it can be accessed by auxiliary instance , still the best method for duplication is backup-based approach as it doesnt have an performance issue on source database.

Two bold disadvantages of ACTIVE database duplication method are:

1. 2.

Negative performance impact that it causes on source database and this impact applies to whole duplication time. High network traffic on connection between source and target database.

If either of these negative impacts are not acceptable in your environment , you will need to switch to old backup-based approach.

Duplicate from active database is an easy task only IF you follow all steps accurately otherwise it can be a complicated task and can waste lots of your time for troubleshooting.

Following part is a simplified step-by-step instructions for DUPLICATE from ACTIVE database:

Step by Step instruction


In this guide assume we are migrating a single instance database HRDEV to a two node RAC database HRPRD with following specifications: Source database: Database name: HRDEV Single instance Version: 11.2.0.3 Hostname: dev-db-01 Filesystem: ASM Target database: Database name: HRPRD RAC 2 nodes Version: 11.2.0.3 ORACLE_HOME: /apps/oracle/product/11.2.0/db_1 GI_HOME: /apps/grid/11.2.0/ Hostname: prd-db-01/prd-db-02 Filesystem: ASM Diskgroup: +HR On target database HRPRD we assume that database has been already created with two instances and spfile already exists. We will use only HRPRD1 instance which runs on prd-db-01 The diskgroup that will be used for this database is +HR

1- Prepare auxiliary instance HRPRD1 on prd-db-01 ,


set following parameters on instance:

. oraenv HRPRD1
1

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

10

startup nomount

2- Enable statis registration for HRPRD1 to running listener LISTENER.


Add following entries into listener.ora file in GI_HOME. Edit /apps/grid/11.2.0/network/admin/listener.ora and add following lines: 1

SID_LIST_LISTENER =
2

(SID_LIST =

(SID_DESC =

(SID_NAME = HRPRD1)

(ORACLE_HOME = /apps/oracle/product/11.2.0/db_1)
8

(GLOBAL_DBNAME = HRPRD)
9

Make sure that ORACLE_HOME in this entry points to correct home which is the home that HRPRD database runs from

3- Add following tns entries to BOTH auxiliary and target tnsnames.ora file :
1

HRDEV =
2

(DESCRIPTION =
3

(ADDRESS = (PROTOCOL = TCP)(HOST = dev-db-01)(PORT = 1521))


4

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = HRDEV)

)
10

11

HRPRD1 =
12

(DESCRIPTION =
13

(ADDRESS = (PROTOCOL = TCP)(HOST = prd-db-01)(PORT = 1521))


14

(CONNECT_DATA =
15

16

(SERVER = DEDICATED)

17

(SERVICE_NAME = HRPRD)

4- Ceate a password file for auxiliary instance HRPRD1 on prd-db-01:


Connections to both instances will be through listener and using TNS , so we need to use passwords for both auxiliary and target connections.

For HRPRD as a new and empty database we may need to create a password file for it as follow:

. oraenv

HRPRD1

cd $ORACLE_HOME/dbs

orapwd password=sys file=orapwHRPRD1

I have assumed that SYS password on source database HRDEV is sys

5- Test connectivity to auxiliary and target instance from BOTH hosts using TNS
Make sure your connectivity to source database and also to your auxiliary instance works fine , otherwise duplicate from acti ve database wont work.

sqlplus sys/sys@HRPRD1 as sysdba

sqlplus sys/sys@HRDEV as sysdba

Try above commands on both target and auxiliary hosts prd-db-01 and dev-db-01

6- On auxiliary host start RMAN and run the DUPLICATE command:


From host prd-db-01 which runs auxiliary instance hrprd1 start rman. Make sure auxiliary connection is established through listener not through OS authentication.

. oraenv
1

HRPRD1

rman target sys/sys@HRDEV auxiliary sys/sys@hrprd1

RMAN>run{

DUPLICATE TARGET DATABASE TO HRPRD

FROM ACTIVE DATABASE;

7- When step 6 finished successfully , start HRPRD database using srvctl


Change the HRPRD database to be cluster database again and start both instances: 1

. oraenv HRPRD1

sqlplus / as sysdba

alter system set cluster_database=true scope=spfile;

shutdown immediate

srvctl start db -d HRPRD

You might also like