Database Cloning steps using RMAN


In Oracle, Recovery Manager (RMAN) has the ability to duplicate or clone a database from a backup or from an active database using DUPLICATE command to copy all the data in a source database.

Why to use RMAN over traditional OS duplicate command? The answer is that, if you copy a database with operating system utilities instead of the DUPLICATE command, then the DBID (an internal, uniquely generated number that differentiates databases) of the copied database remains the same as the original database but the DUPLICATE command automatically assigns the duplicate database a different DBID so that it can be registered in the same recovery catalog as the source database.

RMAN supports two basic types of duplication:

(A) Active Database Duplication:—

In active database duplication, RMAN connects as TARGET to the source database instance and as AUXILIARY to the auxiliary instance. Auxiliary instance is a database instance used in the recovery process to perform the work of recovery. RMAN copies the live source database over the network to the auxiliary instance.Here no backups of the source database are required. Figure 24-2 illustrates active database duplication.

(B) Backup-Based Duplication:–

In backup-based duplication, RMAN creates the duplicate database by using pre-existing RMAN backups and copies. RMAN can perform backup-based duplication with or without either of the following connections:

* Target

* Recovery catalog

How RMAN Duplicates a Database

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

(1) Creates a default server parameter file for the auxiliary instance.

(2) Mounts the restored or copied backup control file from the active database.

(3) Uses the RMAN repository to select the backups for restoring the data files to the auxiliary instance.

(4) Restores and copies the duplicate data files and recovers them with incremental backups and archived redo log files to a noncurrent point in time.

(5) Shuts down and restarts the database instance in NOMOUNT mode.

(6) Creates a new control file, which then creates and stores the new DBID in the data files.

(7) Opens the duplicate database with the RESETLOGS option and creates the online redo log for the new database.

Backup-Based Duplication Steps:

(1) Create a backup of the source database by setting auto backup ON, by default CONTROLFILE AUTOBACKUP is OFF.

$ rman target=/


(2) Create a password file for the duplicate instance.

$ orapwd file=filename password=password entries=max_users

Notes: The Oracle orapwd command line utility assists the DBA with granting SYSDBA and SYSOPER privileges to other users.

(3) Add the appropriate entries into the “tnsnames.ora” file in the “$ORACLE_HOME/network/admin” directory to allow connections to the target database from the duplicate server.

(4) Create pfile on source and get that file copied to target.

(5) Make the backup files from the source database available to the destination server using scp command (linux copy command).

(6) Now connact to the duplicate instance as

$ sqlplus / as sysdba

(7) Start the database in NOMOUNT mode using pfile which is created earlier.


(8) Now we need to connect auxiliary instance (db instance used in the recovery process to perform the recovery work)

$ rman AUXILIARY / /*No target or catalog. Metadata comes from backups.

(9) And then finally duplicate the database as:

DUPLICATE DATABASE TO kkdb */ kkdb is new db name
BACKUP LOCATION ‘/source/app/oracle/fast_recovery_area/kkdb’

That’s it.

automatically assigns the duplicate database a different DBID so that it can be registered in the same recovery catalog as the source database.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s