STEP 1. Prepare the parameter file
Sample Parameter file may look like this
/home/oracle$cat TESTDB.ora
audit_file_dest='/u01/app/oracle/admin/TESTDB/adump'
audit_trail='DB'compatible='11.2.0.0.0'
control_files= '+DG_GRP1/TESTDB/controlfile/control01.ctl','+DG_GRP2/TESTDB/controlfile/control01.ctl'
db_file_name_convert= '+ DATA/PROD/','+DG_GRP1/TESTDB'
log_file_name_convert= '+FRA/PROD/','+ DG_GRP2/TESTDB'
db_block_size=8192
db_create_file_dest='+DG_GRP1'
db_recovery_file_dest='+DG_GRP2'
db_domain=''
db_name='TESTDB'
db_recovery_file_dest_size=4000G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDB)'
fast_start_mttr_target=0
filesystemio_options='asynch'
log_archive_format='%t_%s_%r.dbf'
log_buffer=268427264 # log buffer update
log_checkpoint_timeout=1800
memory_target=40G
open_cursors=300
optimizer_index_cost_adj=100
optimizer_mode='ALL_ROWS'
plsql_warnings='DISABLE:ALL' # PL/SQL warnings at init.ora
processes=5000
query_rewrite_enabled='TRUE'
query_rewrite_integrity='enforced'
remote_login_passwordfile='EXCLUSIVE'
result_cache_max_size=367008K
session_cached_cursors=50
sessions=7560
skip_unusable_indexes=TRUE
undo_tablespace='UNDOTBS1'
processes=5000
STEP 2. Create the necessary directory
mkdir –p /u01/app/oracle/admin/TESTDB/adump
STEP 3. Modify the tnsnames.ora and listener.ora files
Insert the following entry in the tnsnames.ora file located in the $ORACLE_HOME/network/admin directory
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TESTDB)
)
)
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
)
Insert the following entry in the listener.ora file located in the $ORACLE_HOME/network/admin directory
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=TESTDB)
(GLOBAL_DBNAME=TESTDB)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1 )
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
STEP 4. Startup the auxiliary instance in nomount stage and test connectivity
export ORACLE_SID=TESTDB
sqlplus / as sysdba
SQL> startup nomount pfile=’/home/oracle/ TESTDB.ora’
ORACLE instance started.
Total System Global Area 252776600 bytes
Fixed Size 450712 bytes
Variable Size 218103808 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
SQL>
$tnsping TESTDB
TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Production on 27-OCT-2014 16:19:02
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=TESTDB))(ADDRESS=(PROTOCOL=TCP)(HOST=10.9.8.15)(PORT=1521)))
OK (0 msec)
$tnsing PROD
TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Production on 27-OCT-2014 16:19:02
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=PROD))(ADDRESS=(PROTOCOL=TCP)(HOST=10.9.8.15)(PORT=1521)))
OK (0 msec)
$rman target SYS/oracle@PROD auxiliary SYS/oracle@TESTDB
Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 16 08:42:46 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD (DBID=839852638)
connected to auxiliary database: TESTDB (not mounted)
RMAN>
Insert the following entry in the tnsnames.ora file located in the $ORACLE_HOME/network/admin directory
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TESTDB)
)
)
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
)
)
Insert the following entry in the listener.ora file located in the $ORACLE_HOME/network/admin directory
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.8.15)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=TESTDB)
(GLOBAL_DBNAME=TESTDB)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1 )
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
STEP 4. Startup the auxiliary instance in nomount stage and test connectivity
export ORACLE_SID=TESTDB
sqlplus / as sysdba
SQL> startup nomount pfile=’/home/oracle/ TESTDB.ora’
ORACLE instance started.
Total System Global Area 252776600 bytes
Fixed Size 450712 bytes
Variable Size 218103808 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
SQL>
$tnsping TESTDB
TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Production on 27-OCT-2014 16:19:02
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=TESTDB))(ADDRESS=(PROTOCOL=TCP)(HOST=10.9.8.15)(PORT=1521)))
OK (0 msec)
$tnsing PROD
TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Production on 27-OCT-2014 16:19:02
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=PROD))(ADDRESS=(PROTOCOL=TCP)(HOST=10.9.8.15)(PORT=1521)))
OK (0 msec)
$rman target SYS/oracle@PROD auxiliary SYS/oracle@TESTDB
Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 16 08:42:46 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD (DBID=839852638)
connected to auxiliary database: TESTDB (not mounted)
RMAN>
STEP 5. Prepare the duplication shell and rman scripts
5a. prepare the rman command
$cat /u01/app/oracle/scripts/rman_active_dup_testdb.rcv
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate auxiliary channel t5 type disk;
allocate auxiliary channel t6 type disk;
allocate auxiliary channel t7 type disk;
allocate auxiliary channel t8 type disk;
duplicate target database to TESTDB from active database;
}
5b) Prepare the shell script or executable and put it in $ORACLE_HOME/bin directory
$cat /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/TESTDBACTDUP
#!/bin/ksh
export ORACLE_HOME='/u01/app/oracle/product/11.2.0.3/dbhome_1'
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:/u01/app/oracle/product/11.2.0.3/dbhome_1/bin
export ORACLE_SID=TESTDB
rman target SYS/oracle@PROD auxiliary SYS/oracle@TESTDB log /u02/backup/rman/logs/testdbactive_dup.log CMDFILE='/u01/app/oracle/scripts/rman_active_dup_testdb.rcv'
5a. prepare the rman command
$cat /u01/app/oracle/scripts/rman_active_dup_testdb.rcv
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate auxiliary channel t5 type disk;
allocate auxiliary channel t6 type disk;
allocate auxiliary channel t7 type disk;
allocate auxiliary channel t8 type disk;
duplicate target database to TESTDB from active database;
}
5b) Prepare the shell script or executable and put it in $ORACLE_HOME/bin directory
$cat /u01/app/oracle/product/11.2.0.3/dbhome_1/bin/TESTDBACTDUP
#!/bin/ksh
export ORACLE_HOME='/u01/app/oracle/product/11.2.0.3/dbhome_1'
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:/u01/app/oracle/product/11.2.0.3/dbhome_1/bin
export ORACLE_SID=TESTDB
rman target SYS/oracle@PROD auxiliary SYS/oracle@TESTDB log /u02/backup/rman/logs/testdbactive_dup.log CMDFILE='/u01/app/oracle/scripts/rman_active_dup_testdb.rcv'
STEP 6. Execute the scripts
$ksh -x TESTDBACTDUP
$ksh -x TESTDBACTDUP
STEP 7. Monitor the progress by tailing the logfile
$ tail -1000f /u02/backup/rman/logs/testdbactive_dup.log
No comments:
Post a Comment