Duplicate Database from Active Database — Just Works!
My friend Øyvind Isene suggested that I store a DUPLICATE RMAN script that works in a safe place in this tweet.
@yvelik Me too, then I store the script in a safe place :-) Duplicate jobs reminds me how important it is to practice restore. — Øyvind Isene (@OyvindIsene) July 1, 2013I couldn't find a safer place for the script than the Pythian blog :). Here goes the DUPLICATE DATABASE ... from an ACTIVE DATABASE script that works for me beautifully. I like the fact that we don't need to worry about any time-consuming tasks anymore. For example, you don't need the init.ora parameter on the destination side. Oracle creates it all for us. If you want to change any parameters (e.g. reduce memory footprint), you just specify it within the DUPLICATE command (e.g. set sga_target=4G).
Details
Version = 11.2.0.3 on both sides Source db = prod Destination db = test On the source (prod): -- tns aliases to be created to point to prod and test databases On the destination (test): -- the same version of Oracle SW installed -- directory structure created -- copy $ORACLE_HOME/dbs/orapwprod (from prod) to $ORACLE_HOME/dbs/orapwtest -- configure static listener configuration (allow you to connect as sysdba from prod) -- start an empty test instance "export ORACLE_HOME=....; export ORACLE_SID=....; sqlplus => statup nomount;" Notes: - No SPFILE is needed. It will be taken case of while running DUPLICATE. - Prod db files are located under /u01/oradata/prod. - Test db files to be located under /u02/oradata/test. - It doesn't matter from where you execute the command (prod or test).Script
[code] cat run_active_duplicate_prod_test_01.sh . prod.env echo $ORACLE_HOME $ORACLE_SID $TNS_ADMIN export NLS_DATE_FORMAT="YYYY/MM/DD HH24:MI:SS" rman TARGET sys/password@prod AUXILIARY sys/password@test DUPLICATE DATABASE TO test FROM ACTIVE DATABASE SPFILE parameter_value_convert 'prod','test' set db_file_name_convert='u01/oradata/prod','u02/oradata/test' set log_file_name_convert='u01/oradata/prod','u02/oradata/test' set control_files='/u02/oradata/test/cntrl01.dbf'; EOF [/code]Kick off
[code] nohup ./run_active_duplicate_prod_test_01.sh 2>&1 \ 1>./run_active_duplicate_prod_test_01.`date +%Y%m%d_%H%M%S`.log & ls -lptr ./run_active_duplicate_prod_test_01.`date +%Y%m%d_%H%M%S`.log [/code]Verification
tail -f ./run_active_duplicate_prod_test_01.*.log ... contents of Memory Script: { Alter clone database open resetlogs; } executing Memory Script
database opened Finished Duplicate Db at 2013/07/01 05:42:30 RMAN Recovery Manager complete.
Share this
Previous story
← How to Install Oracle 12c RAC: A Step-by-Step Guide
Next story
SQL for Pattern Matching in Oracle 12c →
You May Also Like
These Related Stories
Oracle Database 12c Patching: DBMS_QOPATCH, OPATCH_XML_INV, and datapatch
Oracle Database 12c Patching: DBMS_QOPATCH, OPATCH_XML_INV, and datapatch
Jan 20, 2015
12
min read
Oracle Database 12c: Network Recovery in RMAN
Oracle Database 12c: Network Recovery in RMAN
Aug 14, 2013
12
min read
Oracle 18c Non-CDB databases in the Oracle Database Cloud Service (ODBCS)
Oracle 18c Non-CDB databases in the Oracle Database Cloud Service (ODBCS)
Apr 6, 2018
7
min read
No Comments Yet
Let us know what you think