Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Monday, April 16, 2012

RMAN Duplicate Database from RAC ASM to RAC ASM (11gR2)

Duplicating RAC database is very simple, first duplicate RAC Database to a single instance using RMAN and convert the single instance into a RAC cluster.
Testing Environment:
- Two nodes RAC 11gR2 (11.2.0.3) on Windows 2008R2
- Source RAC Database: TESTRAC (testrac1,testrac2)
- Target RAC Database: DUPDB (dupdb1,dupdb2) on the same hosts where TESTRAC is running
- ASM instances with three diskgroups (DGDUP for dupdb)
- Backup took already (on Netbackup) for Source Database, We CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE; for our environment



Procedure:
1-  Create an initialization parameter for auxiliary instance by copying the target database initialization parameter file. Comment all the RAC related parameters in the dupdb parameter file. We will re-enable them once the duplicate is completed because straight RAC to RAC duplicate is not possible.
initdupdb .ora
DB_NAME=dupdb
CONTROL_FILES='+DGDUP'
DB_FILE_NAME_CONVERT='+DBDATA','+DGDUP'
LOG_FILE_NAME_CONVERT='+DBFLASH','+DGDUP'
db_create_file_dest='+DGDUP'
db_recovery_file_dest='+DGDUP'
db_recovery_file_dest_size=4558159872

2- Get the sequence number (Source DB) , you need to look at the following:
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
25      35.75M     SBT_TAPE    00:02:41     09-APR-12
        BP Key: 25   Status: AVAILABLE  Compressed: NO  Tag: TESTRAC_TAPEBKP_ARCH
        Handle: tparch-s%%s-p%%p   Media: JFY154

  List of Archived Logs in backup set 25
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    16      1537121    09-APR-12 1581921    09-APR-12
  2    12      1537125    09-APR-12 1581917    09-APR-12

RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
37      Full    1.21G      SBT_TAPE    00:03:31     10-APR-12
        BP Key: 37   Status: AVAILABLE  Compressed: NO  Tag: TESTRAC_TAPEBKP
        Handle: tpbk_u%%u_s%%s_p%%p_t%%t   Media: JFY154
  List of Datafiles in backup set 37
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/system.282.780048973
  2       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/sysaux.283.780048975
  3       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/undotbs1.284.780048975
  4       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/users.285.780048975
  5       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/example.290.780049091
  6       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/undotbs2.291.780049215
  7       Full 1970559    10-APR-12 +DBDATA/testrac/datafile/test1.296.780227205

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
38      463.50M    SBT_TAPE    00:00:54     10-APR-12
        BP Key: 38   Status: AVAILABLE  Compressed: NO  Tag: TESTRAC_TAPEBKP_ARCH
        Handle: tparch-s%%s-p%%p   Media: JFY154

  List of Archived Logs in backup set 38
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    17      1581921    09-APR-12 1658976    09-APR-12
  1    18      1658976    09-APR-12 1690205    09-APR-12
  1    19      1690205    09-APR-12 1721547    09-APR-12
  1    20      1721547    09-APR-12 1740626    09-APR-12
  1    21      1740626    09-APR-12 1756763    09-APR-12
  1    22      1756763    09-APR-12 1778418    10-APR-12
  1    23      1778418    10-APR-12 1809402    10-APR-12
  1    24      1809402    10-APR-12 1841839    10-APR-12
  1    25      1841839    10-APR-12 1873029    10-APR-12
  1    26      1873029    10-APR-12 1934637    10-APR-12
  1    27      1934637    10-APR-12 1938699    10-APR-12
  1    28      1938699    10-APR-12 1962902    10-APR-12
  1    29      1962902    10-APR-12 1972866    10-APR-12
  2    13      1581917    09-APR-12 1653382    09-APR-12
  2    14      1880058    10-APR-12 1938703    10-APR-12
  2    15      1938703    10-APR-12 1962905    10-APR-12
  2    16      1962905    10-APR-12 1972862    10-APR-12

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
39      Full    18.00M     SBT_TAPE    00:00:30     10-APR-12
        BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20120410T140713
        Handle: c-157707636-20120410-04   Media: JFY154
  SPFILE Included: Modification time: 10-APR-12
  SPFILE db_unique_name: TESTRAC
  Control File Included: Ckp SCN: 1973232      Ckp time: 10-APR-12

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
40      Full    18.00M     SBT_TAPE    00:02:30     10-APR-12
        BP Key: 40   Status: AVAILABLE  Compressed: NO  Tag: TAG20120410T142437
        Handle: 18n834t5_1_1   Media: JFY154
  Control File Included: Ckp SCN: 1977429      Ckp time: 10-APR-12

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41      Full    18.00M     SBT_TAPE    00:00:32     10-APR-12
        BP Key: 41   Status: AVAILABLE  Compressed: NO  Tag: TAG20120410T142713
        Handle: c-157707636-20120410-05   Media: JFY154
  SPFILE Included: Modification time: 10-APR-12
  SPFILE db_unique_name: TESTRAC
  Control File Included: Ckp SCN: 1978187      Ckp time: 10-APR-12

We need to determine the most recent archivelog backed up from each thread, and then take the least recent of these.

3-  Create the auxiliary (dupdb) instance by oradim
D:\app\Inam\product\11.2.0.3\dbhome_1\bin\oradim.exe -new -sid dupdb -usrpwd sys -log oradimdupdb1.log
4-  Start the auxiliary (dupdb) instance in nomount state, create  SPFILE from the parameter file
C:\Users\inam>SET ORACLE_SID=dupdb

C:\Users\inam>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 10 10:38:15 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup nomount pfile=D:\app\Inam\product\11.2.0.3\dbhome_1\database\initdupdb.ora
ORACLE instance started.

Total System Global Area  313196544 bytes
Fixed Size                  2254704 bytes
Variable Size             255854736 bytes
Database Buffers           50331648 bytes
Redo Buffers                4755456 bytes
SQL>

SQL> CREATE SPFILE FROM PFILE='D:\app\Inam\product\11.2.0.3\dbhome_1\database\initdupdb.ora'
  2  /
File created.
OR
SQL> create SPFILE='+DGDUP' from PFILE='D:\app\Inam\product\11.2.0.3\dbhome_1\database\initdupdb.ora';

File created.

5- Connect to RMAN (on Source DB), connect to both source and auxiliary databases
C:\Users\inam>set ORACLE_SID=dupdb
C:\Users\inam>rman target sys/sys@testrac1 auxiliary /

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Apr 14 14:29:29 2012

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

connected to target database: TESTRAC (DBID=157707636)
connected to auxiliary database: DUPDB (not mounted)

6- Run the below RMAN script

RMAN> run {
2> set until sequence 18 thread 2;
3> DUPLICATE TARGET DATABASE TO dupdb;
4> }

executing command: SET until clause

Starting Duplicate Db at 14-APR-12
using target database control file instead of recovery catalog
configuration for SBT_TAPE channel 2 is ignored
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=922 device type=DISK
allocated channel: ORA_AUX_SBT_TAPE_1
channel ORA_AUX_SBT_TAPE_1: SID=4 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 7.1 (20110203)

contents of Memory Script:
{
   set until scn  1975584;
   sql clone "alter system set  control_files =
  ''+DBDATA/dupdb/controlfile/current.297.780589837'', ''+DBFLASH/dupdb/controlfile/current.4818.780589837'' comment=
 ''Set by RMAN'' scope=spfile";
   sql clone "alter system set  db_name =
 ''TESTRAC'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DUPDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executing Memory Script

executing command: SET until clause

sql statement: alter system set  control_files =   ''+DBDATA/dupdb/controlfile/current.297.780589837'', ''+DBFLASH/dupdb
/controlfile/current.4818.780589837'' comment= ''Set by RMAN'' scope=spfile

sql statement: alter system set  db_name =  ''TESTRAC'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''DUPDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     313196544 bytes

Fixed Size                     2254704 bytes
Variable Size                255854736 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4755456 bytes

Starting restore at 14-APR-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=659 device type=DISK
allocated channel: ORA_AUX_SBT_TAPE_1
channel ORA_AUX_SBT_TAPE_1: SID=790 device type=SBT_TAPE
channel ORA_AUX_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 7.1 (20110203)

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: restoring control file
channel ORA_AUX_SBT_TAPE_1: reading from backup piece c-157707636-20120410-04
channel ORA_AUX_SBT_TAPE_1: piece handle=c-157707636-20120410-04 tag=TAG20120410T140713
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:02:55
output file name=+DBDATA/dupdb/controlfile/current.297.780589837
output file name=+DBFLASH/dupdb/controlfile/current.4818.780589837
Finished restore at 14-APR-12

database mounted
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.

contents of Memory Script:
{
   set until scn  1975584;
   set newname for datafile  1 to
 "+dgdup";
   set newname for datafile  2 to
 "+dgdup";
   set newname for datafile  3 to
 "+dgdup";
   set newname for datafile  4 to
 "+dgdup";
   set newname for datafile  5 to
 "+dgdup";
   set newname for datafile  6 to
 "+dgdup";
   set newname for datafile  7 to
 "+dgdup";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 14-APR-12
using channel ORA_AUX_DISK_1
using channel ORA_AUX_SBT_TAPE_1

channel ORA_AUX_SBT_TAPE_1: starting datafile backup set restore
channel ORA_AUX_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00001 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00002 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00003 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00004 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00005 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00006 to +dgdup
channel ORA_AUX_SBT_TAPE_1: restoring datafile 00007 to +dgdup
channel ORA_AUX_SBT_TAPE_1: reading from backup piece tpbk_u%%u_s%%s_p%%p_t%%t
channel ORA_AUX_SBT_TAPE_1: piece handle=tpbk_u%%u_s%%s_p%%p_t%%t tag=TESTRAC_TAPEBKP
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:01:48
Finished restore at 14-APR-12

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=21 STAMP=780590187 file name=+DGDUP/dupdb/datafile/system.256.780590111
datafile 2 switched to datafile copy
input datafile copy RECID=22 STAMP=780590187 file name=+DGDUP/dupdb/datafile/sysaux.257.780590111
datafile 3 switched to datafile copy
input datafile copy RECID=23 STAMP=780590187 file name=+DGDUP/dupdb/datafile/undotbs1.259.780590111
datafile 4 switched to datafile copy
input datafile copy RECID=24 STAMP=780590187 file name=+DGDUP/dupdb/datafile/users.262.780590111
datafile 5 switched to datafile copy
input datafile copy RECID=25 STAMP=780590187 file name=+DGDUP/dupdb/datafile/example.258.780590111
datafile 6 switched to datafile copy
input datafile copy RECID=26 STAMP=780590187 file name=+DGDUP/dupdb/datafile/undotbs2.261.780590111
datafile 7 switched to datafile copy
input datafile copy RECID=27 STAMP=780590187 file name=+DGDUP/dupdb/datafile/test1.260.780590111

contents of Memory Script:
{
   set until scn  1975584;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 14-APR-12
using channel ORA_AUX_DISK_1
using channel ORA_AUX_SBT_TAPE_1

starting media recovery

archived log for thread 1 with sequence 30 is already on disk as file +DBFLASH/testrac/archivelog/2012_04_10/thread_1_se
q_30.4656.780243313
archived log for thread 1 with sequence 31 is already on disk as file +DBFLASH/testrac/archivelog/2012_04_10/thread_1_se
q_31.4716.780256137
archived log for thread 2 with sequence 17 is already on disk as file +DBFLASH/testrac/archivelog/2012_04_10/thread_2_se
q_17.4671.780243315
channel ORA_AUX_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_AUX_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=29
channel ORA_AUX_SBT_TAPE_1: restoring archived log
archived log thread=2 sequence=16
channel ORA_AUX_SBT_TAPE_1: reading from backup piece tparch-s%%s-p%%p
channel ORA_AUX_SBT_TAPE_1: piece handle=tparch-s%%s-p%%p tag=TESTRAC_TAPEBKP_ARCH
channel ORA_AUX_SBT_TAPE_1: restored backup piece 1
channel ORA_AUX_SBT_TAPE_1: restore complete, elapsed time: 00:00:55
archived log file name=+DGDUP/dupdb/archivelog/2012_04_14/thread_1_seq_29.263.780590233 thread=1 sequence=29
archived log file name=+DGDUP/dupdb/archivelog/2012_04_14/thread_2_seq_16.264.780590237 thread=2 sequence=16
channel clone_default: deleting archived log(s)
archived log file name=+DGDUP/dupdb/archivelog/2012_04_14/thread_2_seq_16.264.780590237 RECID=49 STAMP=780590237
archived log file name=+DBFLASH/testrac/archivelog/2012_04_10/thread_2_seq_17.4671.780243315 thread=2 sequence=17
channel clone_default: deleting archived log(s)
archived log file name=+DGDUP/dupdb/archivelog/2012_04_14/thread_1_seq_29.263.780590233 RECID=48 STAMP=780590237
archived log file name=+DBFLASH/testrac/archivelog/2012_04_10/thread_1_seq_30.4656.780243313 thread=1 sequence=30
archived log file name=+DBFLASH/testrac/archivelog/2012_04_10/thread_1_seq_31.4716.780256137 thread=1 sequence=31
media recovery complete, elapsed time: 00:00:02
Finished recover at 14-APR-12
Oracle instance started

Total System Global Area     313196544 bytes

Fixed Size                     2254704 bytes
Variable Size                255854736 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4755456 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DUPDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DUPDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     313196544 bytes

Fixed Size                     2254704 bytes
Variable Size                255854736 bytes
Database Buffers              50331648 bytes
Redo Buffers                   4755456 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES    192
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES    32
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '+dgdup', '+dbdata' ) SIZE 50 M  REUSE,
  GROUP   2 ( '+dgdup', '+dbdata' ) SIZE 50 M  REUSE
 DATAFILE
  '+DGDUP/dupdb/datafile/system.256.780590111'
 CHARACTER SET WE8MSWIN1252

sql statement: ALTER DATABASE ADD LOGFILE

  INSTANCE 'i2'
  GROUP   3 ( '+dbdata', '+dgdup' ) SIZE 50 M  REUSE,
  GROUP   4 ( '+dbdata', '+dgdup' ) SIZE 50 M  REUSE

contents of Memory Script:
{
   set newname for tempfile  1 to
 "+dgdup";
   switch clone tempfile all;
   catalog clone datafilecopy  "+DGDUP/dupdb/datafile/sysaux.257.780590111",
 "+DGDUP/dupdb/datafile/undotbs1.259.780590111",
 "+DGDUP/dupdb/datafile/users.262.780590111",
 "+DGDUP/dupdb/datafile/example.258.780590111",
 "+DGDUP/dupdb/datafile/undotbs2.261.780590111",
 "+DGDUP/dupdb/datafile/test1.260.780590111";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to +dgdup in control file

cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/sysaux.257.780590111 RECID=1 STAMP=780590321
cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/undotbs1.259.780590111 RECID=2 STAMP=780590321
cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/users.262.780590111 RECID=3 STAMP=780590321
cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/example.258.780590111 RECID=4 STAMP=780590321
cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/undotbs2.261.780590111 RECID=5 STAMP=780590321
cataloged datafile copy
datafile copy file name=+DGDUP/dupdb/datafile/test1.260.780590111 RECID=6 STAMP=780590321

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=780590321 file name=+DGDUP/dupdb/datafile/sysaux.257.780590111
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=780590321 file name=+DGDUP/dupdb/datafile/undotbs1.259.780590111
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=780590321 file name=+DGDUP/dupdb/datafile/users.262.780590111
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=780590321 file name=+DGDUP/dupdb/datafile/example.258.780590111
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=780590321 file name=+DGDUP/dupdb/datafile/undotbs2.261.780590111
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=780590321 file name=+DGDUP/dupdb/datafile/test1.260.780590111

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 14-APR-12

RMAN>


Note: you can check the last log sequence num like below (on Source DB).
select * from v$archived_log
--order by completion_time desc
order by sequence# desc

7-  Add second thread of online redo logs and enable that thread (dupdb):
SQL> select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1          1 INACTIVE
         2          1          2 CURRENT
 SQL> alter database add logfile thread 2 group 3 ('+DGDUP') size 50m reuse;

Database altered.

SQL> alter database add logfile thread 2 group 4 ('+DGDUP') size 50m reuse;

Database altered.

SQL>  select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1          1 INACTIVE
         2          1          2 CURRENT
         3          2          0 UNUSED
         4          2          0 UNUSED

SQL> alter database enable public thread 2;

Database altered.

SQL>  select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1          1 INACTIVE
         2          1          2 CURRENT
         3          2          3 INACTIVE
         4          2          0 UNUSED
8- Change the pfile (dupdb) and add all RAC related parameters. Please check for the control_files parameter, this was created when duplication done successfully in previous steps.
initdupdb.ora
DB_NAME=dupdb
CONTROL_FILES='+DGDUP/CONTRILFILE/Current.278.780661547'
DB_FILE_NAME_CONVERT='+DBDATA','+DGDUP'
LOG_FILE_NAME_CONVERT='+DBFLASH','+DGDUP'
db_create_file_dest='+DGDUP'
db_recovery_file_dest='+DGDUP'
db_recovery_file_dest_size=4558159872
dupdb1.instance_number=1
dupdb2.instance_number=2
cluster_database=true
cluster_database_instances=2

9- create spfile on the shared storage, because all instances must use the same server parameter file.

SQL> create spfile='+DGDUP' from pfile='D:\app\Inam\product\11.2.0.3\dbhome_1\database\initdupdb.ora';

File created.
10- shutdown the instance (dupdb) and startup both Instances. You will need to register the new DB (dupdb) and its instances (dupdb1,dupdb2) with RAC
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

Just to check the status of the dupdb
D:\app\11.2.0.3\grid\BIN>srvctl config database -d dupdb
PRCD-1120 : The resource for database dupdb could not be found.
PRCR-1001 : Resource ora.dupdb.db does not exist

As it is confirmed by above command that no resource dupdb exists, now add it
D:\app\11.2.0.3\grid\BIN>srvctl add database -d dupdb -o D:\app\Inam\product\11.2.0.3\dbhome_1

just to check DB config after adding database (above step)
D:\app\11.2.0.3\grid\BIN>srvctl config database -d dupdb
Database unique name: DUPDB
Database name:
Oracle home: D:\app\Inam\product\11.2.0.3\dbhome_1
Oracle user: nt authority\system
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: DUPDB
Database instances:
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed

Now add RAC instances
D:\app\11.2.0.3\grid\BIN>srvctl add instance -d dupdb -i dupdb1 -n or1

D:\app\11.2.0.3\grid\BIN>srvctl add instance -d dupdb -i dupdb2 -n or2

Check DB config again after adding instances (above steps)
D:\app\11.2.0.3\grid\BIN>srvctl config database -d dupdb
Database unique name: dupdb
Database name:
Oracle home: D:\app\Inam\product\11.2.0.3\dbhome_1
Oracle user: nt authority\system
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: DUPDB
Database instances: dupdb1,dupdb2
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed

Now start the database and check via sqlplus on both nodes
D:\app\11.2.0.3\grid\BIN>srvctl start database -d dupdb




Notes:
i) Don't forget to put the RAC related parameters in parameter file after the succesful duplication
ii) Prepare the instance parameter files on both nodes eg;initdupdb1.ora,initdupdb2.ora
give the path of the spfile in it  so that both nodes share the same spfile created in Step-9
SPFILE='+DGDUP/DUPDB/PARAMETERFILE/spfile.272.780662847'
iii) srvctl is case sensitive so provide the correct case while registering db/instances to RAC same as you mentioned in your init parameter file.
iv) If for some reasons you face issues with the srvctl command while registering , you should unregister/remove instances/db. Make the correction and try srvctl again, few examples belw.

D:\app\11.2.0.3\grid\BIN>srvctl remove database -d DUPDB
Remove the database ORCL? (y/[n]) y
D:\app\11.2.0.3\grid\BIN>srvctl stop instance -d dupdb -i dupdb2

D:\app\11.2.0.3\grid\BIN>srvctl remove instance -d dupdb -i dupdb2
Remove instance from the database dupdb? (y/[n]) y

v) If you get below error
RMAN-06024: no backup or copy of the control file found to restore
Please check the sequence,  because sequence  forces rman to search for backups older than
set until scn against the sequence eg; 1537121;  But your oldest controlfile backup could be at different SCN eg; 197323.
You need to run duplicate with a higher sequence (eg; 1973232 )to be able to restore the controlfile from your available backups.


Ref: 461479.1

1 comment:

mde said...

very good article
thank you very much
http://sysdba.org