Tuesday, September 14, 2010

CLONE ORACLE RAC 10g

Follow these easy steps to clone your existing RAC environment on the same machine hosted on ASM.

In this exercise we duplicate the Two node RAC-instance into a single instance Database and then put that single instace into a two node RAC database

1) Created passwdfile for the AUX_DB instace. This file is at $ORACLE_HOME/dbs
    
2)Updated the parameter file.

Following Two parameter must be included
*.db_file_name_convert='+DATADG/source/','+DATADG/clone/'
*.log_file_name_convert='+DATADG/source/','+DATADG/clone/'
Remove RAC specific paramaters from the parameter file.

3) place the AUXILARY  instance in no-mount mode

Using RMAN restore the backup
$ rman target sys/xxxx@clone;
RMAN> connect AUXILIARY SYS/xxxx
connected to auxiliary database (not started)
RMAN> connect catalog username/password@service_catalogDB
connected to recovery catalog database

RMAN> run {                                                                                                  
2> ALLOCATE CHANNEL disk1 DEVICE TYPE DISK;  
3> ALLOCATE CHANNEL disk2 DEVICE TYPE DISK;  
4> ALLOCATE CHANNEL disk3 DEVICE TYPE DISK;  
5> ALLOCATE CHANNEL disk4 DEVICE TYPE DISK; 
6> ALLOCATE AUXILIARY CHANNEL <ANY_NAME>  DEVICE TYPE DISK;           
7> DUPLICATE TARGET DATABASE TO <CLONE_DB_NAME>                                                                    
8>   LOGFILE                                                                                              
9>   GROUP 1 ('+DATADG/clone/redo01.log') SIZE 512M,                                                     
10>   GROUP 2 ('+DATADG/clone/redo02.log') SIZE 512M,                                                     
11>   GROUP 3 ('+DATADG/clone/redo03.log') SIZE 512M,                                                     
12>   GROUP 4 ('+DATADG/clone/redo04.log') SIZE 512M;                                                     
13> RELEASE CHANNEL disk1;
14> RELEASE CHANNEL disk2;
15> RELEASE CHANNEL disk3;
16> RELEASE CHANNEL disk4;                                                                                  
17> release channel <NAME_GIVEN_IN_LINE_6>;                                                                                
18> }         


4) during Clone you may get the error
RMAN-06136: ORACLE error from auxiliary database: ORA-38856: cannot mark instance UNNAMED_INSTANCE_2 (redo thread 2) as enabled
its solution is to add the following hidden parameter in the parameter file
_no_recovery_through_resetlogs=TRUE
shutdown the instance, and open with RESETLOGS option.

5) Before moving the single instance i had to move it into TWO node RAC instance, so first i moved the controlfile onto ASM ,
so for that open the database in NO-MOUNt mode and using RMAN moved it onto ASM

RMAN> restore controlfile to '+DATADG/clone/controlfile/controlfile.ctl' from '$ORACLE_HOME/dbs/control01.ctl';

6) Now changed the single instance parameter file init.ora with initCLONE1.ora on NODE1 node and initCLONE2.ora on node-2.
 (You can use your existing RAC parameter files as sample)

7) open the database on both the instances.

8) Add it into cluster with following command.

$ srvctl add database -d DB_NAME -o $ORACLE_HOME [Execute From only 1 instance, $ORACLE_HOME should be replaced with Actual Value]
$ srvctl add instance -d DB_NAME -i CLONE1 -n node1 [Execute From only 1 instance]
$ srvctl add instance -d DB_NAME -i CLONE2 -n node2 [Execute From only 1 instance]
===================== NOTE =================
As this clone was created with RAC DATABASE, So while moving it onto the two instance cluster database, i didnt need to add a UNDO tablespace,
but i had to create the redologs.
while starting the instance at node-2 i got the following error
ORA-01618: redo thread 2 is not enabled - cannot mount
so for that i followed the following steps
thread                               integer     1
SQL> select thread#, enabled from v$thread;
   THREAD# ENABLED
---------- --------
         1 PUBLIC
         2 DISABLED

SQL> alter database enable public thread 2;


Users might face multiple issues while performing this process, for example LOG GROUP THREAD 2 will have to be created from instance 1 before starting instance 2. You may post your errors here for me to investigate and give suggestions.

1 comment:

  1. Hi Sulman, Thanks for the post..
    I get the below error. Please help



    SQL> startup
    ORACLE instance started.

    Total System Global Area 1.0021E+10 bytes
    Fixed Size 2236968 bytes
    Variable Size 1610616280 bytes
    Database Buffers 8388608000 bytes
    Redo Buffers 19918848 bytes
    ORA-01618: redo thread 2 is not enabled - cannot mount

    ----------------------------------------------------------
    SQL> select * from v$log;
    select * from v$log
    *
    ERROR at line 1:
    ORA-01507: database not mounted

    ----------------------------------------------------------

    SQL> alter database add logfile thread 2 '/dev/rredo22_lv' size 50m;
    alter database add logfile thread 2 '/dev/rredo22_lv' size 50m
    *
    ERROR at line 1:
    ORA-01507: database not mounted


    ----------------------------------------------------------


    SQL> alter database enable thread 2;
    alter database enable thread 2
    *
    ERROR at line 1:
    ORA-01507: database not mounted


    ----------------------------------------------------------



    SQL> select thread#, enabled from v$thread;
    select thread#, enabled from v$thread
    *
    ERROR at line 1:
    ORA-01507: database not mounted

    ReplyDelete