RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE



Last updated on August 27th, 2016 at 10:28 am

We have already learned manual hot backup cloning and RMAN DUPILCATE DATABASE Cloning.RMAN in 11g and above provides the RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE which does not need backup files for cloning.Files are restored to the target database through the network and recovery done and resetlogs done to complete the clone.All the preceding steps are performed automatically by RMAN without any intervention from the DBA.The passwords in the password files must match for both servers, so remember to set the correct password when creating the password file on the destination server. Both the source and destination database servers require a “tnsnames.ora” entry for the destination database.

What is duplicate using Active database :

Active database duplication copies the target database over the network to the destination and then creates the duplicate database. Only difference is you don’t need to have the pre-existing RMAN backups and copies. The duplication work is performed by an auxiliary channel. This channel corresponds to a server session on the auxiliary instance on the auxiliary host.

As part of the duplicating operation, RMAN automates the following steps:

Creates a control file for the duplicate database.
Restarts the auxiliary instance and mounts the duplicate control file.
Creates the duplicate data files and recovers them with incremental backups and archived redo logs.
Opens the duplicate database with the resetlogs option.
For the active database duplication, RMAN will copy the target database data files over the network to the auxiliary instance.
Disadvantage to this approach

Very high bandwidth required over the network to perform it
Primary database performance will be impacted due to direct copy

The high level steps for RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE
1) Create the tnsnames.ora entries on both the source and destination side
2) Password files are created on Destinate node with the same password as Source database
3) Create init.ora on the destination side
4) Startup mount the database and run duplicate command with active database to clone the database

Let us take an example

Source Database Name: TEST
Source Database physical files path=/u001/oracle/TEST/oradata
Source Server Name: mygoeasy1

Cloned Database Name: TEST_NEW
Target Database physical files path=/u001/oracle/TEST_NEW/oradata
Source Server Name: mygoeasy1

Detailed Steps for RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE

Step 1

Configure the tnsnames.ora at the destination server

TEST_NEW =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =mygoeasy2)(PORT = 1529))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST_NEW)
)
)

TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =mygoeasy1)(PORT = 1529))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST)
)
)

Configure the tnsnames.ora at the source server
TEST_NEW =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =mygoeasy2)(PORT = 1529))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST_NEW)
)
)

TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =mygoeasy1)(PORT = 1529))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST)
)
)

Step 2. On the target node

a) Copy the backup init.ora to the $ORACLE_HOME/dbs and then change the db_name,control file paths ,dump parameter and other things as neccessary

$ cd $ORACLE_HOME/dbs
$ vi initTEST_NEW.ora
db_name=TEST_NEW
control_files=/u001/oracle/TEST_NEW/oradata
….

We need to put the two below parameter extra for RMAN cloning

db_file_name_convert=(‘/u001/oracle/TEST/oradata’,’/u001/oracle/TEST_NEW/oradata’)
# This parameter specifies from where to where the datafiles should be cloned
log_file_name_convert=(‘/u001/oracle/TEST/oradata’,’/u001/oracle/TEST_NEW/oradata’)

NOTE: db_file_name_convert and log_file_name_convert parameters are required only if the source database directory structure and clone database directory structure differs.

Step 3) Create password file

orapwd file=orapwTEST_NEW password=oracle ignorecase=Y

Destination Side

Check the connectivity
[oracle@mygoeasy2] sqlplus sys/oracle@TEST as sysdba
The above command should connect successfully

[oracle@mygoeasy2] sqlplus sys/oracle@TEST_NEW as sysdba
The above command should connect successfully

Source Side

[oracle@mygoeasy1] sqlplus sys/oracle@TEST as sysdba
The above command should connect successfully

[oracle@mygoeasy1] sqlplus sys/oracle@TEST_NEW as sysdba
The above command should connect successfully
Step 4)

Startup the database in NOMOUNT stage and start the duplicate

rman target sys/oracle@TEST auxiliary sys/oracle@TEST_NEW

RMAN> duplicate target database to ‘TEST_NEW’ with ACTIVE DATABASE;


Leave a Reply