Home » Oracle » Oracle Database » RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE

RMAN DUPLICATE DATABASE CLONING WITH ACTIVE DATABASE

  • We have already learned manual hot backup cloning and RMAN DUPLICATE 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, recovery is done and resetlogs are 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 the Active database :

RMAN DUPLICATE DATABASE CLONING WITH 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:

(1)Creates a control file for the duplicate database.
(2)Restarts the auxiliary instance and mounts the duplicate control file.
(3) Creates the duplicate data files and recovers them with incremental backups and archived redo logs.
(4) Open the duplicate database with the resetlogs option.
(5)For the active database duplication, RMAN will copy the target database data files over the network to the auxiliary instance.

See also  How to rollback the Oracle patch


Disadvantage of this approach

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

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 the Destination node with the same password as the Source database
(3) Create init<DBname>.ora on the destination side
(4) Startup mount the database and run duplicate command with active database to clone the database

Detailed Steps for RMAN DUPLICATE DATABASE CLONING WITH ACTIVE 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

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 necessary

$ 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.

See also  How to add any node to Oracle RAC cluster in 10g and 11g

Step 3
create password file in oracle

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;

You will get database cloned when this command is completed. This is very easy.

Also Reads
RMAN backup commands : Check out the RMAN Backup commands in this post. This is going to be very helpful for the person who is involved in backup and recovery
RMAN List backup commands : RMAN List backup commands are used to list the backup taken using RMAN ,Date and Time and many other details are included
Oracle RMAN interview questions : Oracle RMAN Interview Questions are must for Oracle DBA’s looking for change. Oracle Backup and recovery is one of the essential duties of Oracle DBA
RMAN Recovery Catalog : Learn how to create RMAN recovery catalog, how to register database in catalog, how to catalog archived log files on the filesystem,
RMAN-06059 : Check out how to resolve the RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
RMAN-20004 : RMAN-20004 happens when a Database has been cloned and a connection made from the clone to Catalog using rman with out changing the DBID of the clone
https://docs.oracle.com/cd/B10501_01/server.920/a96566/rcmintro.htm

Leave a Comment

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

Scroll to Top