Professional Documents
Culture Documents
Purpose: RMAN Duplicate Database From RAC ASM To RAC ASM
Purpose: RMAN Duplicate Database From RAC ASM To RAC ASM
Purpose
This document outlines the procedure to clone an Oracle 10g RAC database using the Oracle RMAN
DUPLICATE DATABASE feature.
Scope
Although the document is specific to illustrating the clone procedure using the example of
SOURCEC3 as the source database and TARGETC3 as the target database, the same procedure can
be used for performing a clone of any of the RAC databases.
A valid RMAN backup of the source database and archive log files exists. This includes the
backup of the controlfile as well.
The same directory structure exists on target server as compared to source server where the
RMAN backupsets are located.
Reference Documents
http://www.oracleracexpert.com/2009/12/duplicate-rac-database-using-
Oracle DBA and RAC DBA
Expert
rman.html
Prepare the source and target databases for the clone process
TARGETC3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.mydomain)(PORT = 2098))
)
(CONNECT_DATA =
(SERVICE_NAME = TARGETC3.mydomain)
)
)
(SID_DESC =
(GLOBAL_DBNAME =TARGETC3.mydomain)
(ORACLE_HOME =/node2/oracle/targetc3 )
(SID_NAME = TARGETC31)
)
Thrd Seq Low SCN Low Time Next SCN Next Time
…
…
1 63640 7367465305170 28-MAR-12 7367465313001 28-MAR-12
1 63641 7367465313001 28-MAR-12 7367465318557 28-MAR-12
1 63642 7367465318557 28-MAR-12 7367465325967 28-MAR-12
1 63643 7367465325967 28-MAR-12 7367465329753 28-MAR-12
…
…
2 62632 7367465305151 28-MAR-12 7367465312995 28-MAR-12
2 62633 7367465312995 28-MAR-12 7367465318549 28-MAR-12
2 62634 7367465318549 28-MAR-12 7367465325955 28-MAR-12
2 62635 7367465325955 28-MAR-12 7367465329755 28-MAR-12
TARGETC31.thread=1
TARGETC32.thread=2
TARGETC31.undo_tablespace='UNDOTBS1'
TARGETC32.undo_tablespace='UNDOTBS2'
*.local_listener='LISTENER_TARGETC3'
Note:
The hidden parameter ‘_no_recovery_through_resetlogs’ has been set in order to avoid 'Internal Bug
4355382 ORA-38856: FAILED TO OPEN DATABASE WITH RESETLOGS WHEN USING RAC
BACKUP.
On target database server, remove all the database files from the appropriate location.
Important: Verify that the directory location from where the files are being deleted is the right one.
$> pwd
/shared_disk/oradata/TARGETC3
$> hostname
node1.mydomain
$> rm *.dbf
$> rm *.ctl
$> rm *.log
On source database server, check that the required RMAN backups
exist and are current
Execute the following RMAN commands to determine the name and location of the backupsets from
the most recent database backup.
RMAN> LIST BACKUP OF DATABASE;
RMAN> LIST BACKUP OF ARCHIVELOG ALL
RMAN> LIST BACKUP OF CONTROLFILE;
Once the backupsets have been identified, confirm at the O/S level that all the
backups are physically present in the appropriate location.
$> ls -l /node1/backup/SOURCEC3/backupsets/
total 1324576
-rw-r----- 1 ornode2 dba 38899712 Mar 27 14:12 SOURCEC3_ArchLog_t778994668_s7054_p1
-rw-r----- 1 ornode2 dba 43043840 Mar 27 14:12 SOURCEC3_ArchLog_t778994668_s7055_p1
-rw-r----- 1 ornode2 dba 2688512 Mar 27 14:12 SOURCEC3_ArchLog_t778994699_s7056_p1
-rw-r----- 1 ornode2 dba 427638784 Mar 27 14:12 SOURCEC3_DataFile_t778994414_s7052_p1
-rw-r----- 1 ornode2 dba 165797888 Mar 27 14:12 SOURCEC3_DataFile_t778994416_s7053_p1
$> ls -l /node1/backup/SOURCEC3/controlfiles
total 90520
-rw-r----- 1 ornode2 dba 46333952 Mar 27 14:14 c-2044054386-20120327-00
Perform the database clone using the RMAN DUPLICATE database
command
On Source database server, run the script which will execute the RMAN
DUPLICATE command.
We create an Unix shell script duplicatedb.sh which will establish the auxiliary database connection
and execute the RMAN commands required to duplicate the database.
These are the contents of the Unix shell script duplicatedb.sh
rman target / auxiliary sys/syspwd@targetc3 <<EOF
run
{
allocate channel c1 type disk;
allocate auxiliary channel c2 type disk format '/node1/backup/SOURCEC3/backupsets/%U';
set until sequence 63644 thread 1;
duplicate target database to targetc3;
}
EOF
syspwd: This is the SYS password in the target database. As mentioned earlier, the SYS
password in both the source as well as target database needs to be the same.
targetc3: This is the tnsnames.ora alias which we had created earlier to connect to the
auxiliary instance.
63634: This is the log sequence number we had derived earlier by examining the backup of
the archive log files.
Identify the number of size of online redo log files belonging to thread 1
Identify the current online redo log files and their size. We need to create another thread of redo log
files with the same size and number as currently exist.
SQL> select group#,thread#,bytes/1048576 from v$log;
GROUP# THREAD# BYTES/1048576
---------- ---------- -------------
1 1 10
2 1 10
3 1 10
Add additional online redo logs to thread 2 and enable the thread as public
SQL> alter database add logfile thread 2 group 4
2 '/shared_disk/oradata/TARGETC3/redo04.log' size 10m;
Database altered.
SQL> alter database add logfile thread 2 group 5
2 '/shared_disk/oradata/TARGETC3/redo05.log' size 10m;
Database altered.
Shutdown the database and restart it with the original parameter file.
We now shutdown the single-instance database and start it up using the original database parameter
file. The database is now RAC enabled.
SQL> shutdown immediate;
Note that now the init.ora parameter file points to the SPFILE which is located on the shared disks
and which contains all the RAC related database parameters.
$> mv initTARGETC31.ora initTARGETC31.ora.nonRAC
$> mv initTARGETC31.ora.orig initTARGETC31.ora
$> cat initTARGETC31.ora
spfile=/sharedvol/admin/TARGETC3/spfileTARGETC3.ora
duplicatedb.log output
allocated channel: c2
channel c2: sid=537 devtype=DISK
database dismounted
Oracle instance shut down
database opened
Finished Duplicate Db at 28-MAR-12
released channel: c1
RMAN>