Tuesday, June 21, 2016

Oracle: Duplicate RAC 1 Node Database to RAC 1 Node from Active Database

Prepare Environment:

Grid Listener:


$ cd /usr2/app/grid/11.2.0.4/network/admin

$ cat listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = QA)
      (ORACLE_HOME = /usr2/app/oracle/product/11.2.0.3)
      (SID_NAME = QA)
    )
  )

LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent


Oracle init File:


$ cat initQA.ora
*.db_name='QA'

Copy password file from source database.


Add auxiliary database into source database tnsname.ora



Start auxiliary database at nomount mode



Duplicate with RMAN

On destination node,
$ export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"

$ rman target sys/xxxx@csis2:1521/prod auxiliary sys/xxxx@tcsqa

set echo on;
run
{
 allocate channel tgt1 device type disk ;
 allocate channel tgt2 device type disk ;
 allocate auxiliary channel aux1 device type disk ;
 set newname for datafile 147 to '+DATA';
 set newname for datafile 148 to '+DATA';
 duplicate target database to QA from active database
  spfile
   parameter_value_convert 'prod', 'qa', 'PROD', 'QA'
   set control_files='+DATA','+ARC'
   set db_file_name_convert='+DATA/PROD', '+DATA/QA'
   set log_file_name_convert='+DATA','+DATA'
   set cluster_database='false'
   set sga_max_size='3G'
   set sga_target='2G'
   set db_recovery_file_dest='/dbfs/flash_recovery_area/QA'
  logfile
    group 1 ('+DATA') size 500m reuse,
    group 2 ('+DATA') size 500m reuse,
    group 3 ('+DATA') size 500m reuse;
}

No comments:

Post a Comment