Skip to content

Insight and analysis of technology and business strategy

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. I 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.

Top Categories

  • There are no suggestions because the search field is empty.

Tell us how we can help!

dba-cloud-services
Upcoming-Events-banner