Monday, May 20, 2013

How to Convert Single-Instance Database to RAC Database using Rconfig Utility


Database  : racdb
Instance    : Single Instance
Objective : Converting from Single Instance to RAC Instance using 'rconfig'

Check the Instance:
-------------------------
[oracle@rac1 bin]$ ps -ef | grep pmon
oracle    3759     1  0 17:08 ?        00:00:00 asm_pmon_+ASM1
oracle    8407     1  0 17:36 ?        00:00:00 ora_pmon_racdb

Take backup of Original File:----------------------------------
[oracle@rac1 bin]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/assistants/rconfig/sampleXMLs/

[oracle@rac1 sampleXMLs]$ ls
ConvertToRAC_AdminManaged.xml  ConvertToRAC_PolicyManaged.xml

[oracle@rac1 sampleXMLs]$ cp ConvertToRAC_AdminManaged.xml ConvertToRAC_AdminManaged.xml.bak

[oracle@rac1 sampleXMLs]$ vi ConvertToRAC_AdminManaged.xml

Original File :-----------------
[oracle@rac1 bin]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/assistants/rconfig/sampleXMLs/ConvertToRAC_AdminManaged.xml.bak
<?xml version="1.0" encoding="UTF-8"?>
<n:RConfig xmlns:n="http://www.oracle.com/rconfig"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.oracle.com/rconfig rconfig.xsd">
    <n:ConvertToRAC>  
<!-- Verify does a precheck to ensure all pre-requisites are met, before the conversion is attempted. Allowable values are: YES|NO|ONLY -->
    <n:Convert verify="YES">
<!--Specify current OracleHome of non-rac database for SourceDBHome -->
          <n:SourceDBHome>/oracle/product/11.2.0/db_1</n:SourceDBHome>
<!--Specify OracleHome where the rac database should be configured. It can be same as SourceDBHome -->
          <n:TargetDBHome>/oracle/product/11.2.0/db_1</n:TargetDBHome>
<!--Specify SID of non-rac database and credential. User with sysdba role is required to perform conversion -->
              <n:SourceDBInfo SID="sales">
            <n:Credentials>
              <n:User>sys</n:User>
              <n:Password>oracle</n:Password>
              <n:Role>sysdba</n:Role>
            </n:Credentials>
          </n:SourceDBInfo>
<!--Specify the list of nodes that should have rac instances running for the Admin Managed Cluster Database. LocalNode should be the first node in this nodelist. -->
          <n:NodeList>       
            <n:Node name="node1"/>
            <n:Node name="node2"/>
          </n:NodeList>
<!--Specify RacOneNode along with servicename to convert database to RACOne Node -->
              <!--n:RacOneNode  servicename="salesrac1service"/-->
<!--Instance Prefix tag is optional starting with 11.2. If left empty, it is derived from db_unique_name.-->
          <n:InstancePrefix>sales</n:InstancePrefix>
<!-- Listener details are no longer needed starting 11.2. Database is registered with default listener and SCAN listener running from Oracle Grid Infrastructure home. -->
<!--Specify the type of storage to be used by rac database. Allowable values are CFS|ASM. The non-rac database should have same storage type. ASM credentials are no needed for conversion. -->
          <n:SharedStorage type="ASM">
<!--Specify Database Area Location to be configured for rac database.If this field is left empty, current storage will be used for rac database. For CFS, this field will have directory path. -->
            <n:TargetDatabaseArea>+ASMDG</n:TargetDatabaseArea>
<!--Specify Fast Recovery Area to be configured for rac database. If this field is left empty, current recovery area of non-rac database will be configured for rac database. If current database is not using recovery Area, the resulting rac database will not have a recovery area. -->
            <n:TargetFlashRecoveryArea>+ASMDG</n:TargetFlashRecoveryArea>
          </n:SharedStorage>
        </n:Convert>
    </n:ConvertToRAC>
</n:RConfig>
[oracle@rac1 bin]$

Changes made for 'racdb':------------------------------
[oracle@rac1 bin]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/assistants/rconfig/sampleXMLs/ConvertToRAC_AdminManaged.xml
<?xml version="1.0" encoding="UTF-8"?>
<n:RConfig xmlns:n="http://www.oracle.com/rconfig"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.oracle.com/rconfig rconfig.xsd">
    <n:ConvertToRAC>  
<!-- Verify does a precheck to ensure all pre-requisites are met, before the conversion is attempted. Allowable values are: YES|NO|ONLY -->
    <n:Convert verify="YES">
<!--Specify current OracleHome of non-rac database for SourceDBHome -->
          <n:SourceDBHome>/u01/app/oracle/product/11.2.0/dbhome_1</n:SourceDBHome><!--Specify OracleHome where the rac database should be configured. It can be same as SourceDBHome -->
          <n:TargetDBHome>/u01/app/oracle/product/11.2.0/dbhome_1</n:TargetDBHome>
<!--Specify SID of non-rac database and credential. User with sysdba role is required to perform conversion -->
              <n:SourceDBInfo SID="racdb">
            <n:Credentials>
              <n:User>sys</n:User>
              <n:Password>oracle</n:Password>
              <n:Role>sysdba</n:Role>
            </n:Credentials>
          </n:SourceDBInfo>
<!--Specify the list of nodes that should have rac instances running for the Admin Managed Cluster Database. LocalNode should be the first node in this nodelist. -->
          <n:NodeList>       
            <n:Node name="rac1.mlg.oracle.com"/>
            <n:Node name="rac2.mlg.oracle.com"/>

          </n:NodeList>
<!--Specify RacOneNode along with servicename to convert database to RACOne Node -->
              <!--n:RacOneNode  servicename="salesrac1service"/-->
<!--Instance Prefix tag is optional starting with 11.2. If left empty, it is derived from db_unique_name.-->
          <n:InstancePrefix>racdb</n:InstancePrefix>
<!-- Listener details are no longer needed starting 11.2. Database is registered with default listener and SCAN listener running from Oracle Grid Infrastructure home. -->
<!--Specify the type of storage to be used by rac database. Allowable values are CFS|ASM. The non-rac database should have same storage type. ASM credentials are no needed for conversion. -->
          <n:SharedStorage type="ASM">
<!--Specify Database Area Location to be configured for rac database.If this field is left empty, current storage will be used for rac database. For CFS, this field will have directory path. -->
            <n:TargetDatabaseArea>+FRA</n:TargetDatabaseArea>
<!--Specify Fast Recovery Area to be configured for rac database. If this field is left empty, current recovery area of non-rac database will be configured for rac database. If current database is not using recovery Area, the resulting rac database will not have a recovery area. -->
            <n:TargetFlashRecoveryArea>+FRA</n:TargetFlashRecoveryArea>
          </n:SharedStorage>
        </n:Convert>
    </n:ConvertToRAC>
</n:RConfig>
[oracle@rac1 bin]$

Note : Changes given in bold format

Run rconfig with convert verify="ONLY" on the first node to perform a test conversion to ensure that conversion can be completed successfully.


[oracle@rac1 bin]$ ./rconfig /u01/app/oracle/product/11.2.0/dbhome_1/assistants/rconfig/sampleXMLs/ConvertToRAC_AdminManaged.xml
<?xml version="1.0" ?>
<RConfig version="1.1" >
<ConvertToRAC>
    <Convert>
      <Response>
        <Result code="0" >
          Operation Succeeded
        </Result>
      </Response>
      <ReturnValue type="object">
There is no return value for this step     </ReturnValue>
    </Convert>
  </ConvertToRAC></RConfig>


Run rconfig with convert verify="YES" on the first node to convert the database.


[oracle@rac1 bin]$ ./rconfig /u01/app/oracle/product/11.2.0/dbhome_1/assistants/rconfig/sampleXMLs/ConvertToRAC_AdminManaged.xml
Converting Database "racdb" to Cluster Database. Target Oracle Home: /u01/app/oracle/product/11.2.0/dbhome_1. Database Role: PRIMARY.
Setting Data Files and Control Files
Adding Database Instances
Adding Redo Logs
Enabling threads for all Database Instances
Setting TEMP tablespace
Adding UNDO tablespaces
Adding Trace files
Setting Fast Recovery Area
Updating Oratab
Creating Password file(s)
Configuring Listeners
Configuring related CRS resources
Starting Cluster Database
<?xml version="1.0" ?>
<RConfig version="1.1" >
<ConvertToRAC>
    <Convert>
      <Response>
        <Result code="0" >
          Operation Succeeded
        </Result>
      </Response>
      <ReturnValue type="object">
<Oracle_Home>
         /u01/app/oracle/product/11.2.0/dbhome_1
       </Oracle_Home>
       <Database type="ADMIN_MANAGED"  >
         <InstanceList>
           <Instance SID="racdb1" Node="rac1"  >
           </Instance>
           <Instance SID="racdb2" Node="rac2"  >
           </Instance>
         </InstanceList>
       </Database>     </ReturnValue>
    </Convert>
  </ConvertToRAC></RConfig>

Check if the Single-Instance database converted to RAC:
------------------------------------------------------------------

[oracle@rac1 bin]$ ps -ef | grep racdb1
oracle   21425     1  0 18:14 ?        00:00:00 ora_pmon_racdb1
oracle   21427     1  0 18:14 ?        00:00:00 ora_psp0_racdb1
oracle   21429     1  1 18:14 ?        00:00:02 ora_vktm_racdb1
oracle   21433     1  0 18:14 ?        00:00:00 ora_gen0_racdb1
oracle   21435     1  0 18:14 ?        00:00:00 ora_diag_racdb1
oracle   21437     1  0 18:14 ?        00:00:00 ora_dbrm_racdb1
oracle   21439     1  0 18:14 ?        00:00:00 ora_ping_racdb1
oracle   21441     1  0 18:14 ?        00:00:00 ora_acms_racdb1
oracle   21443     1  0 18:14 ?        00:00:00 ora_dia0_racdb1
oracle   21445     1  0 18:14 ?        00:00:00 ora_lmon_racdb1
oracle   21447     1  3 18:14 ?        00:00:06 ora_lmd0_racdb1
oracle   21449     1  2 18:14 ?        00:00:03 ora_lms0_racdb1
oracle   21453     1  0 18:14 ?        00:00:00 ora_rms0_racdb1
oracle   21455     1  0 18:14 ?        00:00:00 ora_lmhb_racdb1
oracle   21457     1  0 18:14 ?        00:00:00 ora_mman_racdb1
oracle   21459     1  0 18:14 ?        00:00:00 ora_dbw0_racdb1
oracle   21461     1  0 18:14 ?        00:00:00 ora_lgwr_racdb1
oracle   21463     1  0 18:14 ?        00:00:00 ora_ckpt_racdb1
oracle   21465     1  0 18:14 ?        00:00:00 ora_smon_racdb1
oracle   21467     1  0 18:14 ?        00:00:00 ora_reco_racdb1
oracle   21469     1  0 18:14 ?        00:00:00 ora_rbal_racdb1
oracle   21471     1  0 18:14 ?        00:00:00 ora_asmb_racdb1
oracle   21473     1  0 18:14 ?        00:00:01 ora_mmon_racdb1
oracle   21475     1  0 18:14 ?        00:00:00 oracle+ASM1_asmb_racdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21477     1  0 18:14 ?        00:00:00 ora_mmnl_racdb1
oracle   21479     1  0 18:14 ?        00:00:00 ora_mark_racdb1
oracle   21481     1  0 18:14 ?        00:00:00 ora_d000_racdb1
oracle   21483     1  0 18:14 ?        00:00:00 ora_ocf0_racdb1
oracle   21485     1  0 18:14 ?        00:00:00 ora_s000_racdb1
oracle   21487     1  0 18:14 ?        00:00:00 oracle+ASM1_ocf0_racdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21492     1  3 18:14 ?        00:00:05 ora_lck0_racdb1
oracle   21499     1  0 18:14 ?        00:00:00 ora_rsmn_racdb1
oracle   21501     1  1 18:14 ?        00:00:01 oracleracdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21515     1  0 18:14 ?        00:00:00 ora_o000_racdb1
oracle   21517     1  0 18:14 ?        00:00:00 oracle+ASM1_o000_racdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21552     1  0 18:14 ?        00:00:00 ora_gtx0_racdb1
oracle   21556     1  0 18:14 ?        00:00:00 ora_rcbg_racdb1
oracle   21560     1  0 18:14 ?        00:00:00 ora_qmnc_racdb1
oracle   21583     1  0 18:14 ?        00:00:00 oracleracdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21595     1  3 18:14 ?        00:00:04 oracleracdb1 (LOCAL=NO)
oracle   21601     1  0 18:14 ?        00:00:00 ora_q000_racdb1
oracle   21603     1  0 18:14 ?        00:00:00 ora_q001_racdb1
oracle   21613     1  0 18:14 ?        00:00:00 ora_pz99_racdb1
oracle   21614     1  0 18:14 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   21616     1  0 18:14 ?        00:00:00 oracleracdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle   21697     1  0 18:15 ?        00:00:00 ora_cjq0_racdb1
oracle   21718     1  0 18:15 ?        00:00:00 ora_q002_racdb1
oracle   21817     1  0 18:15 ?        00:00:00 ora_smco_racdb1
oracle   21821     1  0 18:15 ?        00:00:00 ora_w000_racdb1
oracle   21827     1  0 18:15 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   21829     1  0 18:15 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   21831     1  0 18:15 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   21833     1  1 18:15 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   21847     1  0 18:16 ?        00:00:00 oracleracdb1 (LOCAL=NO)
oracle   22026     1  2 18:17 ?        00:00:00 ora_j000_racdb1
oracle   22028     1  0 18:17 ?        00:00:00 ora_j001_racdb1
oracle   22038 13512  0 18:17 pts/0    00:00:00 grep racdb1
[oracle@rac1 bin]$

Configure database using srvctl and check the status:--------------------------------------------------------------
[oracle@rac1 bin]$ ./srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +FRA/spfileracdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: FRA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[oracle@rac1 bin]$

Note: The database type is 'RAC' now.
[oracle@rac1 bin]$ ./srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2
[oracle@rac1 bin]$

On the second node:
--------------------------
[oracle@rac2 Desktop]$ ps -ef | grep racdb2
oracle    6174     1  0 18:14 ?        00:00:00 ora_pmon_racdb2
oracle    6176     1  0 18:14 ?        00:00:00 ora_psp0_racdb2
oracle    6178     1  1 18:14 ?        00:00:13 ora_vktm_racdb2
oracle    6182     1  0 18:14 ?        00:00:00 ora_gen0_racdb2
oracle    6184     1  0 18:14 ?        00:00:00 ora_diag_racdb2
oracle    6186     1  0 18:14 ?        00:00:00 ora_dbrm_racdb2
oracle    6188     1  0 18:14 ?        00:00:00 ora_ping_racdb2
oracle    6190     1  0 18:14 ?        00:00:00 ora_acms_racdb2
oracle    6192     1  0 18:14 ?        00:00:04 ora_dia0_racdb2
oracle    6194     1  0 18:14 ?        00:00:02 ora_lmon_racdb2
oracle    6196     1  0 18:14 ?        00:00:07 ora_lmd0_racdb2
oracle    6198     1  1 18:14 ?        00:00:10 ora_lms0_racdb2
oracle    6202     1  0 18:14 ?        00:00:00 ora_rms0_racdb2
oracle    6204     1  0 18:14 ?        00:00:00 ora_lmhb_racdb2
oracle    6206     1  0 18:14 ?        00:00:00 ora_mman_racdb2
oracle    6208     1  0 18:14 ?        00:00:00 ora_dbw0_racdb2
oracle    6210     1  0 18:14 ?        00:00:00 ora_lgwr_racdb2
oracle    6212     1  0 18:14 ?        00:00:00 ora_ckpt_racdb2
oracle    6214     1  0 18:14 ?        00:00:00 ora_smon_racdb2
oracle    6216     1  0 18:14 ?        00:00:00 ora_reco_racdb2
oracle    6218     1  0 18:14 ?        00:00:00 ora_rbal_racdb2
oracle    6220     1  0 18:14 ?        00:00:00 ora_asmb_racdb2
oracle    6222     1  0 18:14 ?        00:00:01 ora_mmon_racdb2
oracle    6224     1  0 18:14 ?        00:00:00 oracle+ASM2_asmb_racdb2 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    6226     1  0 18:14 ?        00:00:00 ora_mmnl_racdb2
oracle    6228     1  0 18:14 ?        00:00:00 ora_d000_racdb2
oracle    6230     1  0 18:14 ?        00:00:00 ora_s000_racdb2
oracle    6232     1  0 18:14 ?        00:00:00 ora_mark_racdb2
oracle    6244     1  0 18:14 ?        00:00:04 ora_lck0_racdb2
oracle    6246     1  0 18:14 ?        00:00:00 ora_rsmn_racdb2
oracle    6248     1  0 18:14 ?        00:00:02 oracleracdb2 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    6284     1  0 18:14 ?        00:00:00 ora_gtx0_racdb2
oracle    6286     1  0 18:14 ?        00:00:00 ora_rcbg_racdb2
oracle    6288     1  0 18:14 ?        00:00:00 ora_qmnc_racdb2
oracle    6296     1  0 18:14 ?        00:00:00 oracleracdb2 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    6305     1  0 18:15 ?        00:00:00 ora_smco_racdb2
oracle    6322     1  0 18:15 ?        00:00:01 ora_cjq0_racdb2
oracle    6333     1  0 18:15 ?        00:00:00 ora_q000_racdb2
oracle    6335     1  0 18:15 ?        00:00:00 ora_q001_racdb2
oracle    6373     1  0 18:15 ?        00:00:01 ora_gcr0_racdb2
oracle    6441     1  0 18:19 ?        00:00:00 ora_w001_racdb2
oracle    6515     1  0 18:24 ?        00:00:00 ora_pz99_racdb2
oracle    6625  4680  0 18:30 pts/0    00:00:00 grep racdb2
[oracle@rac2 Desktop]$

Now the Single Instance database is successfully converted to RAC database.