Monday, May 19, 2014

Convert 12cR1 non-RAC database to RAC database using rconfig

I have recently configured Active/Passive Failover cluster using Grid Infrastructure 12cR1 and wrote document on that subject. Now I plan to use this environment and convert "test12" database from Single-Instance to RAC database.

There are several ways to convert non-RAC database to RAC database:
- using Database Configuration Assistant (DBCA)
- Oracle Enterprise Manager
- rconfig command line utility
- manually

In this post I will describe how to perform conversion using rconfig utility.


Before you convert single-instance database to RAC ensure that your environment meets prerequisites like:
- Oracle Clusterware is up and running
- shared storage (ASM,CFS)
- user equivalence
- Oracle 12cR1 software installed

I will skip preparation part in this post. You can find steps on how to prepare nodes for Oracle RAC in the first part of the document http://tinyurl.com/p5f52zs.


Rconfig uses customized xml template to convert single-instance database to RAC.

1. As orcl12 user (db owner) navigate to directory "$ORACLE_HOME/assistants/rconfig/sampleXMLs" where you can find two templates ConvertToRAC_AdminManaged.xml and ConvertToRAC_PolicyManaged.xml.

For this example I will edit ConvertToRAC_AdminManaged.xml and add custom entries.

$ cd $ORACLE_HOME/assistants/rconfig/sampleXMLs
$ cp ConvertToRAC_AdminManaged.xml ConvToRac.xml
$ vi ConvToRac.xml

My xml template: ConvToRac.xml

1. Convert verify - when YES rconfig performs checks to ensure that all prerequisites are met for conversion to Oracle RAC.
2. SourceDBHome - Oracle Home of single-instance database.
3. TargetDBHome - Oracle Home where rac database should be configured.
4. SourceDBInfo SID - SID of single-instance database.
5. User, Password, Role - credentials for user with sysdba role are required.
6. Node name - specify nodes for RAC instances.
7. InstancePrefix - enter instance prefix tag or leave this parameter empty.
8. SharedStorage type - type of shared storage.
9. TargetDatabaseArea - database area location for RAC database.
10. TargetFlashRecoveryArea - fast recovery area location for RAC database.


Backup database in case you decide to perform conversion on production database.

Run rconfig to perform conversion based on template:

$ rconfig ConvToRac.xml

<?xml version="1.0" ?>
<RConfig version="1.1" >
<ConvertToRAC>
    <Convert>
      <Response>
        <Result code="1" >
          Got Exception
        </Result>
       <ErrorDetails>
             Cannot determine if cdb or not
Operation Failed. Refer logs at
 /u01/app/orcl12/cfgtoollogs/rconfig/rconfig_05_19_14_13_09_25.log 
for more details.

       </ErrorDetails>
      </Response>
    </Convert>
  </ConvertToRAC></RConfig>


Operation failed with error - "Cannot determine if cdb or not" because my single-instance database was down.


Startup database and run rconfig again:
(you can track progress in $ORACLE_BASE/cfgtoollogs/rconfig/rconfig*.log)

$ rconfig ConvToRac.xml

Converting Database "test12" to Cluster Database. Target Oracle Home: /u01/app/orcl12/product/12.1.0/dbhome_1. Database Role: PRIMARY.
Setting Data Files and Control Files
Adding Trace files
Adding Database Instances
Adding Redo Logs
Enabling threads for all Database Instances
Setting TEMP tablespace
Adding UNDO tablespaces
Setting Fast Recovery Area
Updating Oratab
Creating Password file(s)
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/orcl12/product/12.1.0/dbhome_1
       </Oracle_Home>
       <Database type="ADMIN_MANAGED"  >
         <InstanceList>
           <Instance SID="test121" Node="cluster1"  >
           </Instance>
           <Instance SID="test122" Node="cluster2"  >
           </Instance>
         </InstanceList>
       </Database>     </ReturnValue>
    </Convert>
  </ConvertToRAC></RConfig>


Operation succeeded!

Status:
$ srvctl status database -d test12
Instance test121 is running on node cluster1
Instance test122 is running on node cluster2

$ srvctl config database -d test12
Database unique name: test12
Database name: test12
Oracle home: /u01/app/orcl12/product/12.1.0/dbhome_1
Oracle user: orcl12
Spfile: +DATA/spfiletest12.ora
Password file: +DATA/orapwtest12
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: test12
Database instances: test121,test122
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
Database is administrator managed

$ sqlplus system@test12

SQL*Plus: Release 12.1.0.1.0 Production on Mon May 19 13:31:34 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter password:
Last Successful login time: Mon May 19 2014 13:30:41 +02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP
and Advanced Analytics options

SQL> select instance_number, instance_name from v$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
              1 test121


NOTE
If conversion fails then use following steps to recover and reattempt conversion:
- review conversion log and fix problems that caused conversion to fail
- delete database using DBCA
- restore source database
- reattempt the conversion




REFERENCE:
http://docs.oracle.com/cd/E18673_01/doc/install.112/e17214/cvrt2rac.htm#BABGGEGJ

0 Comments:

Post a Comment