Jan 1, 2015

Duplicate Database Using TARGETLESS RMAN Connection

Source DB: orasbt1
Target DB: orasbp1
Catalog DB: RMANDB
DB Version: 11.2.0.1 for all 3 databases

ASM DiskGroups: (optional)
DATA: For datafile and online redo logs
REDO: For archivelog location
OBACK: For RMAN Backup location

1. Set environment Variable for Target DB

[oracle@warhawk scripts]$ . go_orasbp1

Note: I use a go profile. This profile contains following information:

#######################################
export ORACLE_SID=orasbp1
export DB_UNIQUE_NAME=orasbp1
. /home/oracle/11201.env ## Environment Variables
echo
echo "ORACLE_SID is set to ${ORACLE_SID}"
echo "ORACLE_HOME is set to ${ORACLE_HOME}"
echo
cd ~/scripts
#
# List of functions
#
sys()
{
sqlplus / as sysdba
}
dba()
{
sqlplus sourav/biswas
}
#######################################

Following are the contents of /home/oracle/11201.env file:

################################################
export ORACLE_HOSTNAME=warhawk.oraconnect.com
export ORACLE_BASE=/oradba/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11201
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
##################################################################

2. Create a password file

[oracle@warhawk scripts]$ cd $ORACLE_HOME/dbs
[oracle@warhawk dbs]$ orapwd file=orapworasbp1 password=Welcome1 entries=10

3. Create a PFILE on $ORACLE_HOME

[oracle@warhawk dbs]$ cat > test.ora
db_name=orasbp1
audit_file_dest='/oradba/app/oracle/admin/orasbp1/adump'
Press Ctl+c

If you are using regular file system to store all your datafiles, please copy over Source DB PFILE and rename it accordingly

Please create all the directories, as per Source DB PFILE [Note: In this illustration, all my database files(database files, redo log files, control files, archivelog files and even RMAN backupsets)  are stored in ASM DiskGroups, hence I didn't create any directory, other than audit_file_dest]

4. Startup database in nomount mode

[oracle@warhawk dbs]$ sqlplus / as sysdba

SQL> startup nomount pfile='$ORACLE_HOME/dbs/test.ora'
SQL> exit

5. Finally, execute below RMAN run block

[oracle@warhawk scripts]$ rman auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Jan 2 00:40:47 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to auxiliary database: ORASBP1 (not mounted)

RMAN> run
{
allocate auxiliary channel aux1 device type disk;
allocate auxiliary channel aux2 device type disk;
allocate auxiliary channel aux3 device type disk;
DUPLICATE DATABASE TO orasbp1
SPFILE
set control_files='+data','+data','+data'
set db_file_name_convert='orasbt1','orasbp1'
set log_file_name_convert='orasbt1','orasbp1'
BACKUP LOCATION '+oback';
}

No comments:

Post a Comment