Friday, July 13, 2018

RAC Cloning using RMAN DUPLICATE command


Create pfile on target host 

Mark below in pfile and rest as pfile of source database just change the target DB name in place of source DB name

*.db_unique_name='<DB_NAME>'
*.cluster_database=FLASE
#TARGET2.instance_number=2
#TARGET2.thread=2
#TARGET2.undo_tablespace='UNDOTBS2'

On target database >> create listener on db level, not on grid level

LISTENER_CLONEDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_CLONEDB))
    (ADDRESS = (PROTOCOL = TCP) (HOST = target2300.india.testing.com) (PORT = 1527))
      )
    )
  )

SID_LIST_LISTENER_CLONEDB =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = TARGET)
      (SID_NAME = TARGET1)
      (ORACLE_HOME = /u00/app/oracle_base/product/12.1.0.2/db_home)
    )

  )

lsnrctl start LISTENER_CLONEDB

On source and target database

SOURCE1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = source2350.india.testing.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (ORACLE_SID = SORUCE1)
    )
  )

TARGET1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = target2300.india.testing.com)(PORT = 1527))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (ORACLE_SID = TARGET1)
    )
  )
  
Create password file for target -
orapwd file=orapwSOURCE1 password=passwordSOURCE entries=5 force=y

Check connectivity for source and target auxiliary, considering source database sys password is same as "passwordSOURCE"
  
sqlplus sys/passwordSOURCE@SOURCE1 as sysdba
sqlplus sys/passwordSOURCE@TARGET1 as sysdba

Once connectivity verified, run below DUPLICATE command to clone source database

rman target sys/passwordSOURCE@SOURCE1 auxiliary sys/passwordSOURCE@TARGET1
DUPLICATE TARGET DATABASE TO TARGET FROM ACTIVE DATABASE;

Create pfile from spfile and remove "_" underscore parameters from it which gets automatically created by rman duplicate
Mark back below parameters in spfile
From 
FLASE to *.cluster_database=TRUE
uncomment this --> #TARGET2.instance_number=2
uncomment this --> #TARGET2.thread=2
uncomment this --> #TARGET2.undo_tablespace='UNDOTBS2'

Create spfile on ASM and mention the location in init<DB_SID>.ora on both the nodes
cat init<DB_SID>.ora
spfile='+<DISK_GROUP>/<DB_SID>/spfile<DB_SID>.ora

Bounce the database to start it with spfile

Add the database in cluster

srvctl add database -d TARGET -o /u00/app/oracle_base/product/12.1.0.2/db_home -c RAC -p '+TARGET_DATADG/TARGET/spfileTARGET.ora' -r PRIMARY -n TARGET

srvctl add instance -d TARGET -i TARGET1 -n target2300
srvctl add instance -d TARGET -i TARGET2 -n target2301

No comments:

Post a Comment