Wednesday, December 9, 2015

RAC TO RAC Duplicate Database




SOURCE DATABASE
MYDB

SOURCE DATAGROUPS
DBDATA DBFLASH

-------------------------------------------------------------

DESTINATION DATABASE
DUPDB

DESTINATION DATAGROUPS
MYDATA MYFLASH



  • In example environment both databases are in same cluster. If your cluster is different you should install and configure CRS first.
  • Then you must create a local listener on any of nodes and after starting instance with pfile you must register service in this local listener because you must connect with auxiliary database from source as sysdba.
  • First we will first create single instance duplicate database and then will convert it to RAC.



-----------------------------------------------------------
Steps


  1. Create a database home (local) listener on any of cluster nodes.
  2. Create a pfile and start instance with the dummy parameter file.
  3. Create a password file for duplicate database instance.
  4. Register service in local listener so you will be able to remotely connect to auxilairy instance using this service.

----------------------------------------------------------
Make TNS entry on one of source servers

Make TNS entries for both source instance clone database on any of source database node. Below is example



MYDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = MYDB)
    )
  )



DUPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DUPDB)
    )
  )

Note: Second entry we configures with port 1522 because our local listener on node 192.168.1.11 is running on port 1522.

==================================================
Create Duplicate Database

connect on source (MYDB1) Server to both nodes through rman

set ORACLE_SID=MYDB1

rman target / auxiliary sys/******@dupdb as sysdba

DUPLICATE TARGET DATABASE TO DUPDB
  FROM ACTIVE DATABASE
  SPFILE
    parameter_value_convert ('MYDB','DUPDB')
set db_create_file_dest='+MYDATA'
    set db_file_name_convert='+DBDATA','+MYDATA'
    set log_file_name_convert='+DBDATA','+MYDATA'
    set control_files='+MYDATA'
    set db_name='DUPDB'
set cluster_database='FALSE'
    set db_recovery_file_dest='+MYFLASH';


 *********Note you must add cluster_database=FALSE parameter in script****************

 ------------------------------------------------------
Create SPFILE for RAC

Connect with newly created duplicate database and get names of controlfiles and add in below pfile which we will use later to create a spfile on asm.

SQL > select name from v$controlfile;

Once duplicate database is created. we created spfile from below pfile for cluster after adding controlfile and cluster parameters. Cluster related parameters are highlighted.

SGA_TARGET=5151653888
audit_file_dest='D:\app\orabin\admin\DUPDB\adump'
audit_trail='db'
compatible='11.2.0.0.0'
control_files='+MYDATA/DUPDB/controlfile/current.257.897918009'
db_block_size=8192
db_create_file_dest='+MYDATA'
db_name='DUPDB'
db_recovery_file_dest_size=209030479872
db_recovery_file_dest='+MYFLASH'
CLUSTER_DATABASE=TRUE
DUPDB1.instance_number=1
DUPDB2.instance_number=2
DUPDB2.thread=2
DUPDB1.thread=1
DUPDB1.undo_tablespace='UNDOTBS01'
DUPDB2.undo_tablespace='UNDOTBS02'
CLUSTER_DATABASE_INSTANCES=2
LOG_ARCHIVE_FORMAT='ARC%S_%R.%T'
OPEN_CURSORS=3000
PGA_AGGREGATE_TARGET=1716518912
PROCESSES=2000
REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'

---------------------------------------------------------
Create spfile from pfile

CREATE SPFILE='+MYFLASH' FROM PFILE ='D:\TEMP\INITDUPDB.ORA';


---------------------------------------------------------
Shutdown instance and add database and cluster instances.

srvctl add database -d DUPDB -o D:\app\orabin\product\11.2.0\dbhome_1

srvctl add instance -d DUPDB -i DUPDB1 -n OR-11
srvctl add instance -d DUPDB -i DUPDB1 -n OR-12

Add spfile created in above step from pfile in database configuration

srvctl modify database -d DUPDB -p +MYDATA/DUPDB/PARAMETERFILE/spfile.283.897931683

Start cluster database.

srvctl start database -d DUPDB

Update Remote_Listener parameter to SCAN name in spfile so you can be able to connect through scan.

alter system set remote_listener='myscan' sid='*'







No comments:

Post a Comment