Total Pageviews

clone database with RMAN Duplicate from active database


SOP: Below is the method to clone the database from source to target :




Benefit:

  • Do not need any backup to be in place.
  • Do not need to shutdown the source database. Its completely online.

High Level steps:

  • Configure listener and start the listener for source and target database.
  • Start the listeners. 
  • Create pfile from source and transfer to target DB node.
  • make changes in pfile at target side.
  • Start target database in NOMOUNT mode using pfile at target nodes.
  • Check sqlplus and RMAN connectivity with source and target from both sides.
  • Set DB environment at target side.
  • Create RMAN command file.
  • Run the rman command file in nohup 


Detailed steps are as following:

DUP DB (target Database) listener.ora file:

Listener.ora file:

ADR_BASE_LISTENER_LOCAL = /u01/app/oracle
LISTENER_DUP =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST =<HOST_NAME_OF_DUP_DB>)(PORT = <PORTNUMBER_OF_DUP_DB>))
    )
  )
  
  
SID_LIST_LISTENER_DUP = (SID_LIST =
(SID_DESC = (GLOBAL_DBNAME = <DB_UNIQE__NAME_OF_DUP_DB>) (ORACLE_HOME = <ORACLE_HOME_PATH_OF_DUP_DB>) (SID_NAME = <DBSID_OF_DUP_DB>))
)



Source DB Listener.ora file:

Listener.ora file:

ADR_BASE_LISTENER_LOCAL = /u01/app/oracle
LISTENER_SRC =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST =<HOST_NAME_OF_SOURCE_DB>)(PORT = <PORTNUMBER_OF_SOURCE_DB>))
    )
  )
  
  
SID_LIST_LISTENER_SRC = (SID_LIST =
(SID_DESC = (GLOBAL_DBNAME = <DB_UNIQE_NAME_OF_SOURCE_DB>) (ORACLE_HOME = <ORACLE_HOME_PATH_OF_SOURCE_DB>) (SID_NAME = <DBSID_OF_SOURCE_DB>))
)




Start the listener of SOURCE_DB: 
Lsnrctl start listener_src
Lsnrctl status listener_src

Start the listener of TARGET_DB i.e. DUP: 
Lsnrctl start listener_dup
lsnrctl status listener_dup


Put the entry of DB_DUP in tnsnames.ora file of ORALE_HOME of DB_SOURCE and DB_DUP 

DB_DUP=
        (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=<HOSTNAME_OF_DUP_DB>)(PORT=<PORT_FOR_DUP_DB>))
            (CONNECT_DATA=
            (SERVER=DEDICATED)
                (SERVICE_NAME=<SERVICE_NAME_OF_DUP_DB>)
                (INSTANCE_NAME=<SID_NAME_OF_DUP_DB>)
            )
        )

DB_SRC=
        (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=<HOSTNAME_OF_DB_SOURCE>)(PORT=<PORT_FOR_DB_SOURCE>))
            (CONNECT_DATA=
            (SERVER=DEDICATED)
                (SERVICE_NAME=<SERVICE_NAME_OF_DB_SOURCE>)
                (INSTANCE_NAME=<SID_NAME_OF_DB_SOURCE>)
            )
        )



Copy PFILE from DB_SOURCE  to target DB_DUP home
Make appropriate changes   --> Change the DB_NAME to DUP_DB and instance name details as DUP_DB

set DUP_DB environment:
>> ORACLE_SID, ORACLE_HONME, TNS_ADMIN

Start DUP_DB DATABASE in NOMOUNT state using copied pfile:
>> SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0.4/dbhome_2/dbs/initDBDUP.ora';

Make listener information in local_listener and remote listener
>> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=<HOSTNAME_OF_DUP_DB>)(PORT=<PORT_OF_DUP_DB>))';

Check connectivity with DB_SRC and DB_DUP using sqlplus as well as RMAN
$ rman target  sys@DB_SRC auxiliary  sys@DB_DUP
        
On Target database set ORACLE_SID as DUP_DB

Create Rman command file:
$ vi rmanDBClone.rcv

and add below script in the rmanDBClone.rcv file 

connect target sys/<PASSOWD_OF_SYS_IN_DB_SRC>@DB_SRC
connect auxiliary /

run
{
allocate channel d1 type disk;
allocate channel d2 type disk;
allocate channel d3 type disk;
allocate channel d4 type disk;
allocate channel d5 type disk;
allocate channel d6 type disk;
allocate channel d7 type disk;
allocate channel d8 type disk;
allocate auxiliary channel DUPDB1 type disk;
allocate auxiliary channel DUPDB2 type disk;
allocate auxiliary channel DUPDB3 type disk;
allocate auxiliary channel DUPDB4 type disk;
allocate auxiliary channel DUPDB5 type disk;
allocate auxiliary channel DUPDB6 type disk;
allocate auxiliary channel DUPDB7 type disk;
allocate auxiliary channel DUPDB8 type disk;
DUPLICATE TARGET DATABASE TO DB_DUP FROM ACTIVE DATABASE;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
release channel d5;
release channel d6;
release channel d7;
release channel d8;
release channel DUPDB1;
release channel DUPDB2;
release channel DUPDB3;
release channel DUPDB4;
release channel DUPDB5;
release channel DUPDB6;
release channel DUPDB7;
release channel DUPDB8;
}
            
From the Server run rman job in nohup state:
nohup rman cmdfile=rman_DBClone.rsv log=logrmanDBClone.log &

No comments:

Post a Comment