Cloning RAC Database (RAC-RAC)

  • Install Oracle Clusterware on target server
  • Install Oracle Database Software on target server
  • Copy the Cold backup to target server shared location.
    (If you are using hotbackup then also copy the archive log files. We require archivelog files from both instances for e.g : 1st Instance = log_652206883_34730_1.arc 2nd Instance =log_652206883_35888_2.arc to recover the database)
  • Generate pfile from spfile on Production and transfer the file to target $ORACLE_HOME/dbs
  • Edit the pfile to replace the entries of PROD to TEST/UAT/DEV. Also remove the below entries from the pfile (initERPUAT.ora)

*.compatible='10.2.0'
*.control_files='/uatdata/oracle/db/apps_st/data/cntrl01.dbf','/uatdata/oracle/db/apps_st/data/cntrl02.dbf','/uatdata/oracle/db/apps_st/data/cntrl03.dbf'
*.db_name='ERPUAT'
ERPUAT.instance_name='ERPUAT1'
ERPUAT.local_listener='ERPUAT1_LOCAL'
*.log_archive_dest_1='location=/uatarch/arch'
*.log_archive_format='log_%r_%s_%t.arc'
ERPUAT.remote_listener='ERPUAT_REMOTE'
ERPUAT.service_names='ERPUAT'
*.db_file_name_convert=(/oraproddata/oracle/db/apps_st/DATA,/uatdata/oracle/db/apps_st/DATA)
*.log_file_name_convert=(/oraproddata/oracle/db/apps_st/DATA,/uatdata/oracle/db/apps_st/DATA)
*._no_recovery_through_resetlogs=TRUE
  • Export the ORACLE_SID=ERPUAT and start the database in nomount state
  • Create the control file or rename the datafiles (change the location of datafiles) if you want to keep the db name same

Note : If using hotbackup, once the control file is created recover the database using the below command.Provide necessary archivelog files.
To check which archivelog files to supply. Execute the below command on Source Database

SELECT SEQUENCE# , name FROM v$archived_log WHERE 5965684806935 BETWEEN FIRST_CHANGE# AND NEXT_CHANGE#;

Change 5965684806935 with your SCN
Recover database using backup controlfile until cancel and open the database with resetlogs

ALTER DATABASE OPEN resetlogs;
DATABASE altered.

Create Temporary Tablespace

CREATE TEMPORARY tablespace TMP tempfile '/uatdata/oracle/db/apps_st/data/tmp01.dbf' SIZE 2048M;
Tablespace created.
ALTER DATABASE DEFAULT TEMPORARY tablespace TMP;
DATABASE altered.

Shutdown the database and export ORACLE_SID=ERPUAT1
Edit the pfile to add the entries (initERPUAT1.ora)

*.cluster_database_instances=2
*.cluster_database=TRUE
*.compatible='10.2.0'
*.control_files='/uatdata/oracle/db/apps_st/data/cntrl01.dbf','/uatdata/oracle/db/apps_st/data/cntrl02.dbf' ,'/uatdata/oracle/db/apps_st/data/cntrl03.dbf'
*.db_name='ERPUAT'
ERPUAT1.instance_name='ERPUAT1'
ERPUAT2.instance_name='ERPUAT2'
ERPUAT1.instance_number=1
ERPUAT2.instance_number=2
ERPUAT1.local_listener='ERPUAT1_LOCAL'
ERPUAT2.local_listener='ERPUAT2_LOCAL'
*.log_archive_dest_1='location=/uatarch/arch'
*.log_archive_format='log_%r_%s_%t.arc'
ERPUAT1.remote_listener='ERPUAT_REMOTE'
ERPUAT2.remote_listener='ERPUAT_REMOTE'
ERPUAT1.service_names='ERPUAT'
ERPUAT2.service_names='ERPUAT'
ERPUAT1.thread=1
ERPUAT2.thread=2
*.undo_management='AUTO'# Required 11i setting
ERPUAT1.undo_tablespace='UNDOTBS1'# Required 11i setting
ERPUAT2.undo_tablespace='UNDOTBS2'# Required 11i setting
*.workarea_size_policy='AUTO'# Required 11i setting

Start the 1st Node and create redologs for 2nd Node.

startup
ALTER DATABASE ADD logfile thread 2 GROUP 6  ('/uatdata/oracle/db/apps_st/data/redolog06a.dbf',  '/uatdata/oracle/db/apps_st/data/redolog06b.dbf') SIZE 100M;
DATABASE altered.
ALTER DATABASE ADD logfile thread 2 GROUP 7  ('/uatdata/oracle/db/apps_st/data/redolog07a.dbf', '/uatdata/oracle/db/apps_st/data/redolog07b.dbf') SIZE 100M;
DATABASE altered.
ALTER DATABASE ADD logfile thread 2 GROUP 8  ('/uatdata/oracle/db/apps_st/data/redolog08a.dbf',
3 '/uatdata/oracle/db/apps_st/data/redolog08b.dbf') SIZE 100M;
DATABASE altered.
ALTER DATABASE enable thread 2;
DATABASE altered.

Create spfile from pfile. Shutdown the database and place the spfile in a shared location

CREATE spfile FROM pfile;
File created.
shut immediate
DATABASE closed.
DATABASE dismounted.
ORACLE instance shut down.

Edit pfile on both the nodes to point it to the shared location

[orauat@erpuatdbs01 dbs]$ cat initERPUAT1.ora
spfile=/uatdata/oracle/db/apps_st/data1/spfileERPUAT.ora
[orauat@erpuatdbs02 dbs]$ cat initERPUAT2.ora
spfile=/uatdata/oracle/db/apps_st/data1/spfileERPUAT.ora

Start the instance on both the nodes.

USE srvctl TO SET the environements
srvctl ADD DATABASE -d ERPUAT -o /orauatbin/oracle/db/tech_st/10.2.0 -m mbcgroup.LOCAL -p spfile=/uatdata/oracle/db/apps_st/data1/spfileERPUAT.ora -y AUTOMATIC
srvctl ADD instance -d ERPUAT -i ERPUAT1 -n ERPUATDBS01
srvctl ADD instance -d ERPUAT -i ERPUAT2 -n ERPUATDBS02
srvctl setenv DATABASE -d ERPUAT -t 'TNS_ADMIN=/orauatbin/oracle/db/tech_st/10.2.0/network/admin/ERPUAT1_erpuatdbs01'
srvctl setenv instance -d ERPUAT -i ERPUAT1 -t 'TNS_ADMIN=/orauatbin/oracle/db/tech_st/10.2.0/network/admin/ERPUAT1_erpuatdbs01'
srvctl setenv instance -d ERPUAT -i ERPUAT2 -t 'TNS_ADMIN=/orauatbin/oracle/db/tech_st/10.2.0/network/admin/ERPUAT2_erpuatdbs02'
srvctl setenv nodeapps -n ERPUATDBS01 -t 'TNS_ADMIN=/orauatbin/oracle/db/tech_st/10.2.0/network/admin/ERPUAT1_erpuatdbs01'
srvctl setenv nodeapps -n ERPUATDBS02 -t 'TNS_ADMIN=/orauatbin/oracle/db/tech_st/10.2.0/network/admin/ERPUAT2_erpuatdbs02'

 Check the status of the instance using ./crs_stat -t

[root@erpuatdbs01 ~]# cd /orauatbin/10gcrs/10.2.0/crs/bin/
[root@erpuatdbs01 bin]# ./crs_stat -t
Name Type Target State Host
---------------------------------------------------------------------
ora....T1.inst application FFLINE OFFLINE
ora....T2.inst application OFFLINE OFFLINE
ora.ERPUAT.db application OFFLINE OFFLINE
ora....01.lsnr application ONLINE ONLINE erpuatdbs01
ora....s01.gsd application ONLINE ONLINE erpuatdbs01
ora....s01.ons application ONLINE ONLINE erpuatdbs01
ora....s01.vip application ONLINE ONLINE erpuatdbs01
ora....02.lsnr application ONLINE ONLINE erpuatdbs02
ora....s02.gsd application ONLINE ONLINE erpuatdbs02
ora....s02.ons application ONLINE ONLINE erpuatdbs02
ora....s02.vip application ONLINE ONLINE erpuatdbs02
[root@erpuatdbs01 bin]#

As db user execute the following commands and shut the database on both instances

Shutdown immedaite
srvctl START DATABASE -d ERPUA
srvctl stop datbase -d ERPUAT
srvctl START DATABASE -d ERPUAT

As a root user or cluster user check the status of the database using ./crs_stat -t

Name Type Target State Host
-----------------------------------------------------------
ora....T1.inst application ONLINE ONLINE erpuatdbs01
ora....T2.inst application ONLINE ONLINE erpuatdbs02
ora.ERPUAT.db application ONLINE ONLINE erpuatdbs01
ora....01.lsnr application ONLINE ONLINE erpuatdbs01
ora....s01.gsd application ONLINE ONLINE erpuatdbs01
ora....s01.ons application ONLINE ONLINE erpuatdbs01
ora....s01.vip application ONLINE ONLINE erpuatdbs01
ora....02.lsnr application ONLINE ONLINE erpuatdbs02
ora....s02.gsd application ONLINE ONLINE erpuatdbs02
ora....s02.ons application ONLINE ONLINE erpuatdbs02
ora....s02.vip application ONLINE ONLINE erpuatdbs02
Tagged with →  
Share →
0 comments
Skip to toolbar