Sei sulla pagina 1di 4

g:\prints\cloning\rac clone.

txt
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rac Cloning step by step
=========================:

Source:
4 nodes Oracle 11.2.0.2 on Linux 64bit
nodeA1
nodeB1
nodeC1
nodeD1

database PROD

Target:
4 nodes Oracle 11.2.0.2 on Linux 64bit
nodeA2
nodeB2
nodeC2
nodeD2

database TEST

1. On the source side, backup the full database using RMAN. Sample here is shown
using control file to disk.

run {
backup format �/u1/df_%t_%s_%p� database
include current controlfile
plus archivelog;
release channel d1;
}

2. Copy all the backupset files to one of the target nodes to the same location of
backup

$scp /rmanbackup/oradata/PROD/df* nodeA2: /rmanbackup/oradata/PROD/


Create a pfile from the source database and move it to the target system
SQL> create pfile=�/tmp/initTEST.ora� from spfile ;
Move initTEST.ora to the target system $ORACLE_HOME/dbs

3. Edit initTEST.ora and change

*.cluster_database=false

And any references of PROD to TEST


Add convert name if names or paths are different
*.db_file_name_convert = (�/u02/oradata/PROD�,�/u02/oradata/TEST�)
*.log_file_name_convert= (�/u02/oradata/PROD�,�/u02/oradata/TEST�)
Create a password file using orapwd on the target node
orapwd file=orapwTEST password=xxxxxxxx

4. On the target node create a TNSNAME alias pointing to the source database

PROD =

(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(node = maverick)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = PROD)

5. Startup the TEST instance in nomount mode

6. Start the rman duplicate

rman target sys/xxxxxxx@PROD auxiliary / catalog rman/rman@rmancpr


RMAN> run {
allocate channel D1 device type disk;
allocate auxiliary channel D2 device type disk;
DUPLICATE TARGET DATABASE TO TEST;
}
If successfully you should see the following extract at the end

input datafile copy RECID=6 STAMP=772991657 file


name=/u03/oradata/dupdb/undotbs04.dbf
Alter clone database open resetlogs;
executing Memory Script
database opened
Finished Duplicate Db at 19-JAN-2012 15:54:40
released channel: D1
released channel: D2

7. Add a new temporary file into the temporary table space

alter tablespace temp add tempfile �/u02/oradata/dupdb/temp01.dbf� size 2048m reuse


;

8. Make the database RAC aware

-Each node of the cluster has its own oracle home n u01 and shared filesystem u02
and u03 and therefore needed to make the following changes enable RAC
-Shutdown database on nodeA2 and move the spfile from $ORACLE_HOME/dbs to
/u03/oradata/TEST
-This is shared storage which all the 4 nodes can access
-srvctl modify database -d TEST -o /u01/app/oracle/product/11.2.0/db_1 -p
/u03/oradata/dupdb/spfileTEST.ora

srvctl add instance -d TEST -i TEST1 �n nodeA2


srvctl add instance -d TEST -i TEST2 �n nodeB2
srvctl add instance -d TEST -i TEST3 �n nodeC2
srvctl add instance -d TEST -i TEST4 �n nodeD2

move the password file from nodeA2 $ORACLE_HOME/dbs to /u03/oradata/TEST


create links from each node to the password file in /u03/oradata/TEST

nodeA2 : $ORACLE_HOME/dbs ln �s /u03/oradata/TEST/orapwTEST orapwdupdb1


nodeB2 : $ORACLE_HOME/dbs ln �s /u03/oradata/TEST/orapwTEST orapwdupdb2
nodeC2 : $ORACLE_HOME/dbs ln �s /u03/oradata/TEST/orapwTEST orapwdupdb3
nodeD2 : $ORACLE_HOME/dbs ln �s /u03/oradata/TEST/orapwTEST orapwdupdb4

on each node create the following init.ora

nodeA2 initTEST1.ora containing SPFILE=�/u03/oradata/dupdb/spfiledupdb.ora�


nodeB2 initTEST1.ora containing SPFILE=�/u03/oradata/dupdb/spfiledupdb.ora�
nodeC2 initTEST1.ora containing SPFILE=�/u03/oradata/dupdb/spfiledupdb.ora�
nodeD2 initTEST1.ora containing SPFILE=�/u03/oradata/dupdb/spfiledupdb.ora�

add the following entries on each node /etc/oratab

nodeA2
TEST1:/u01/app/oracle/product/11.2.0/db_1:N
nodeB2
TEST2:/u01/app/oracle/product/11.2.0/db_1:N
nodeC2
TEST3:/u01/app/oracle/product/11.2.0/db_1:N
nodeD2
TEST4:/u01/app/oracle/product/11.2.0/db_1:N

On nodeA2 where the database was created

Mount the database


Export ORACLE_SID=TEST1
SQL> connect / as sysdba
SQL> startup mount
SQL> alter system set cluster_database=TRUE scope=spfile sid=�*�
SQL> shutdown immediate

Start up instances or databases using srvctl

srvctl start instance �d TEST �I TEST1


Srvctl start instance �d TEST �I TEST2
Srvctl start instance �d TEST �I TEST3
Srvctl start instance �d TEST �I TEST4

9 Add the database to OEM

You might get the following issues in OEM


Service PRODXDB and PROD and any services that existed in PROD is down alert in
GRID Control
Refer to the following article for a resolution and how to avoid the problem

http://managingoracle.blogspot.com/2011/01/service-xdb-is-down-alert-in-grid.html

To resolve the problem if the services are not relevant delete them

SQL> exec dbms_service.delete_service(�PRODXDB�) ;


SQL> exec dbms_service.delete_service(�PROD�) ;

useful web links

http://oraexplorer.com/2007/11/rman-duplicate/

http://www.colestock.com/blogs/2007/09/how-to-duplicate-rac-database-using.html

http://www.oracleracexpert.com/2009/12/duplicate-rac-database-using-rman.html

http://surachartopun.com/2009/11/duplicate-without-connection-to-target.html

Potrebbero piacerti anche