how to clone databases using RMAN


$ export ORACLE_SID=OCM_PROD
$ rman target /
rman> run
{allocate channel ch1 device type disk format ‘/backup/OCM_PROD/%_U’;
backup database plus archivelog;
}
On successful completion the backupsets created can be used for cloning OCM_PROD to OCM_TEST. Cloning of OCM_TEST database from OCM_PROD using RMAN
$ cd $ORACLE_HOME/dbs
orapwd password=oracle entries=20 file=orapwOCM_TEST
create initOCM_TEST.ora file with the following contents

._b_tree_bitmap_plans=FALSE
*._index_join_enabled=FALSE
*_kgl_large_heap_warning_threshold=8388608
*._optim_peek_user_binds=FALSE
*.audit_file_dest='/u00/app/oracle/admin/OCM_TEST/adump'
*.background_dump_dest='/u00/app/oracle/admin/OCM_TEST/bdump'
*.blank_trimming=TRUE
*.compatible='10.2.0.1.0'
*.control_files='/u07/oradata/OCM_TEST/ctl1/OCM_TEST1.ctl','/u07/oradata/OCM_TEST/ctl2/OCM_TEST2.ctl'
*.core_dump_dest='/u00/app/oracle/admin/OCM_TEST/cdump'
*.db_block_size=8192
*.db_cache_size=1G
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='OCM_TEST'
*.instance_name='OCM_TEST'
*.java_pool_size=128m
*.job_queue_processes=10
*.log_archive_dest='/u09/oradata/OCM_TEST/archdir'
*.log_archive_format='%s_%t_%r.arc'
*.nls_length_semantics='CHAR'
*.open_cursors=300
*.optimizer_secure_view_merging=FALSE
*.pga_aggregate_target=250m
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=250m
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u00/app/oracle/admin/OCM_TEST/udump'
*.db_file_name_convert=(’/u01/oradata/OCM_PROD/’,’ /u07/oradata/OCM_TEST/’,’ /u02/oradata/OCM_PROD/’,’ /u07/oradata/OCM_TEST/’,’ /u03/oradata/OCM_PROD/’,
’ /u07/oradata/OCM_TEST/’,’ /u04/oradata/OCM_PROD/’,’ /u07/oradata/OCM_TEST/’)
*.log_file_name_convert=(‘/u05/oradata/OCM_PROD/logs/’,’ /u08/oradata/OCM_TEST/logs/’)

Note that the parameters "db_file_name_convert" and "log_file_name_convert" are used to specify the new location of the files for the OCM_TEST database.
Starting up the instance OCM_TEST for the cloning purpose
$ export ORACLE_SID=OCM_TEST
SQL> connect / as sysdba
SQL>startup nomount;
SQL> exit;
$ export ORACLE_SID=OCM_PROD
$ rman target / auxiliary sys/oracle@OCM_TEST
rman> run
{allocate auxiliary channel aux1 device type disk format ‘/backup/OCM_PROD/%_U’;
duplicate target database to "OCM_TEST"
logfile group 1 (‘/u08/oradata/OCM_TEST/logs/redo_OCM_TEST_11.log’) size 100m,
group 2 (‘/u08/oradata/OCM_TEST/logs/redo_OCM_TEST_21.log’) size 100m,
group 3 (‘/u08/oradata/OCM_TEST/logs/redo_OCM_TEST_31.log’) size 100m;
}
Reference link: http://hungrydba.com/rman_clone.html


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: