RMAN Active Database Duplication

March 4, 2017

What is RMAN Active Database Duplication? Well it is just as it sounds you can clone your database from backup without shutting down your DB.

In order to do this there are a few prerequisite before proceeding which needs to be checked.

  1. Free space
  2. check in your target database pfile that these two lines exist:

*.db_file_name_convert=’{SOURCEDB_DATAFILE_LOC}’,’{TARGTDB_DATAFILE_LOC}'

*.log_file_name_convert=’{SOURCEDB_DATAFILE_LOC}’,’{TARGTDB_DATAFILE_LOC}'

  1. Password on the both side should be the same.
  2. ARCHIVELOG mode must be enabled on both sides.
  3. both source and destination(target) database servers require “tnsnames.ora” entry.

Enable Archive Log

$ sqlplus / as sysdba
$ SQL> archive log list;
        Database log mode No Archive Mode
        Automatic archival Disabled
        Archive destination USE_DB_RECOVERY_FILE_DEST
        Oldest online log sequence 15
        Current log sequence 17
$ SQL> alter database archivelog;
$ SQL> archive log list;
        Database log mode No Archive Mode
        Automatic archival Disabled
        Archive destination USE_DB_RECOVERY_FILE_DEST
        Oldest online log sequence 15
        Current log sequence 17 

Drop Database using SQLPLUS

  1. connect to your target database
  2. export ORACLE_SID= ${ORACLE_SID} –> for multiple oracle instance
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 23 10:21:34 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
$ SQL> shutdown transactional;
        Database closed.
        Database dismounted.
        ORACLE instance shut down.
$ SQL> startup mount exclusive restrict;
        ORACLE instance started.
        Total System Global Area 8584982528 bytes
        Fixed Size 2253256 bytes
        Variable Size 1744834104 bytes
        Database Buffers 6677331968 bytes
        Redo Buffers 160563200 bytes
        Database mounted.
$ SQL> drop database;
        Database dropped.
        Disconnected from Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
$ SQL> startup nomount;
        ORACLE instance started.
        Total System Global Area 4776853504 bytes
        Fixed Size 2254416 bytes
        Variable Size 1258293680 bytes
        Database Buffers 3372220416 bytes
        Redo Buffers 144084992 bytes

Note : if you can get your database to “startup nomount” try to exit and then login as sys again.

  1. After adding the servers in the “tnsnames.ora” confirm that they can connect to each other :

from the source “tnsping ${auxiliary_database_name}”

from the auxiliary “tnsping ${source_database_name}”

  1. For cross-checking chech the password, from the source

    $ sqlplus /nolog
    $ SQL> conn sys@${source_database_name}
        ### enter password
        ### do the same from target database if they can be connected.

  2. For Target Database Do:

    $ rman target sys@${SOURCE_DBNAME} auxiliary sys@${AUXILIARY_DB}
        #### ENTER THE PASSWORDS
        #### after connecting run:
    $ RMAN> duplicate target database to ${ORACLE_SID} from active database nofilenamecheck;