Thinking Out Loud

November 13, 2009

RMAN duplicate database 10gR2

Filed under: oracle — mdinh @ 4:53 am

Yet another RMAN duplicate database post.

Duplicating a Database on a Remote Host with a Different Directory Structure

The requirement is to duplicate test database (10.2.0.4) for 11gR2 upgrade

If you want to read the manual, it’s here (open in new window)

Existing database: TEST10g

Clone database: DEV01

Configure listener for DEV01, add TEST10g to tnsnames, create password file and (server) parameter file

The following parameters were modified for DEV01:

*.background_dump_dest='/opt/u01/app/oracle/admin/dev01/bdump'
*.control_files='/oracle/oradata/dev01/control01.ctl','/oracle/oradata/dev01/control02.ctl'
*.core_dump_dest='/opt/u01/app/oracle/admin/dev01/cdump'
*.db_name='dev01'
*.instance_name='dev01'
*.log_archive_dest_1='LOCATION=/oracle/oradata/dev01/arch'
*.user_dump_dest='/opt/u01/app/oracle/admin/dev01/udump'
*.db_file_name_convert=(
'/u03/oradata/test10g','/oracle/oradata/dev01',
'/u07/oradata/10gtest','/oracle/oradata/dev01',
'/u08/oradata/test10g','/oracle/oradata/dev01',
'/u04/oradata/test10g','/oracle/oradata/dev01'
)
*.log_file_name_convert=(
'/u04/oradata/test10g','/oracle/oradata/dev01'
,'/u07/oradata/test10g','/oracle/oradata/dev01'
)

Shell script to be execute at clone database server (DEV01):

#!/bin/sh -x
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
NLS_LANG="AMERICAN_AMERICA.UTF8"
ORACLE_SID=dev01
export NLS_DATE_FORMAT NLS_LANG ORACLE_SID

BKDIR=/home/mdinh/rman_backups
OUTF=/home/mdinh/rman_backups/rmandupdb.log
RMAN=$ORACLE_HOME/bin/rman
$RMAN msglog $OUTF > /dev/null << END
  connect target sys/password@test10g
  connect auxiliary /;
  startup clone force nomount;
  backup as compressed backupset
    database format '$BKDIR/%d_%T_%U'
    plus archivelog format '$BKDIR/%d_%T_%U';
  duplicate target database to dev01;
  exit
END
exit

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: