Wednesday, December 9, 2015

Convert Single Instance to RAC using RCONFIG

In this post, i will focus on how to covert single instance database to RAC instance.

Environment :

Stand alone database is sitting on ractest1 host and it is using file system.  The goal is to covert the stand alone database to RAC instance.

Stand alone DB :

DB name :  texasdb
host          : ractest1

SQL>  select instance_name,host_name from v$instance;

INSTANCE_NAME                  HOST_NAME
------------------------------ ------------------------------
texasdb                        RACTEST1.localdomain

SQL>  select file_name from dba_data_files;



After  RAC migration, it will be as below.

DB name : texasdb
Instances  names : txdb1, txdb2, txdb3.
Hostnames : ractest1, ractest2, ractest3.

Let us start the migration.

Step 1

Login to ractest1 node.  Go to $ORACLE_HOME/assistants/rconfig/sampleXMLs and
update the below parameter on ConvertToRAC_AdminManaged.xml file.

Before we make the changes, backup the XML file.

The following parameter needs to be changed.,

Parameter Values
convert_verify YES
Source DB home /ora/app/oracle/product/
Target DB home /ora/app/oracle/product/
Source DB name, SYS password texasdb, password
RAC node list ractest1, ractest2, ractest3
RAC instance prefix txdb
Shared Storage type ASM
Target DB area TEST
Target DB recovery TEST

Step 2 Go to $ORACLE_HOME/assistants/rconfig/sampleXMLs location and execute the below script. This is real conversion step.  Please tail the logs(single instance alert log, RAC instance alert log, rconfig logs) and watch out while migrating to RAC instance.

$ORACLE_HOME/bin/rconfig ConvertToRAC_AdminManaged.xml

Step 3 This command provides more info about RAC instance.

 srvctl config database -d texasdb
[root@RACTEST1 ~]# srvctl config database -d texasdb
Database unique name: texasdb
Database name: texasdb
Oracle home: /ora/app/oracle/product/
Oracle user: oracle
Spfile: +TEST/spfiletexasdb.ora
Password file: +TEST/orapwtexasdb
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: TEST
Mount point paths:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: txdb1,txdb2,txdb3
Configured nodes: ractest1,ractest2,ractest3
Database is administrator managed
[root@RACTEST1 ~]#

Step 4  Check if the database has converted successfully.

[root@RACTEST1 ~]# srvctl status database -d texasdb

Instance txdb1 is running on node ractest1
Instance txdb2 is running on node ractest2
Instance txdb3 is running on node ractest3
[root@RACTEST1 ~]#

Step 5  Modify the tnsentry in local node and copy to other node.  The existing tnsentry will have local host name.  It needs to be updated with SCAN name and copied to across other nodes.

Here is the modified entry for my environment.

    (ADDRESS = (PROTOCOL = TCP)(HOST = RACTEST-scan.localdomain)(PORT = 1522))
      (SERVICE_NAME = texasdb)

Step 6  Check all the data files were migrated to ASM disk.

SQL> select instance_name,host_name from v$instance;

INSTANCE_NAME                  HOST_NAME
------------------------------ ------------------------------
txdb1                          RACTEST1.localdomain

SQL> select file_name from dba_data_files;


6 rows selected.


Now QA session!

What is the best scenario for using RCONFIG?

RCONFIG invokes RMAN internally to back up  the database to proceed with converting non-ASM to ASM.  This is time consuming task if the DB is in Terabyte size  and it will cause longer outage.
Hence this is good option only for small database and customer allows significant amount downtime.

How do we improve the conversion time with RCONFIG?

We can increase RMAN backup channel to reduce the backup time. Again it depends on how many number of CPU you have in your node. Here is the command to adjust the parallelism.  The  channel can be adjusted according to your server capacity.


What does RCONFIG do during the conversion?

  1. Migrate the database to ASM storage if we specified in XML file
  2. Create Database Instances on all nodes in the cluster 
  3. Configure Listener and NetService entries
  4. Configure and register CRS resources 
  5. Start the instances on all nodes in the cluster.
What are the Pre-requisite for RCONFIG utility?
  1. Cluster should  installed and all the cluster process is up and running on all the nodes.
  2. The oracle RAC RDBMS is installed on all nodes.
  3. ASM disk must be mounted across all nodes if we want to migrate from file system to ASM.
  4. The source and target should be in same home and same OS version.
  5. Make sure, ASM disk has enough storage to migrate all the data files
How do we test RCONFIG before we do real conversion?

We have convert verify parameter in XML file and it has below options. Please choose ONLY.

Convert verify="YES"
Runs through verification checks to ensure that the
prerequisites for single-instance to RAC db
conversion have been met before it acutually starts
the conversion.

Convert verify="NO"
Bypass the prerequisite verification checks, and
starts conversion straight away

Convert verify="ONLY"
Do not perform the acutal conversion process.
Rather, just run through the prerequisite verification
checks and ends.

What can do if it fails middle of the conversion?

Don't get panic.  This will perform the clean-up operation on converted Instance or will delete the files created by earlier run.

How do we monitor conversion process during the migration?

There are few logs and we can tail the log during the process. We can monitor (tail -f)
single instance alert log, RAC database alert log, rconfig alert log, rman logs. Log info will give better idea and we can see what is going on.

In my environment, i tailed the below logs.
tail -f /ora/app/oracle/diag/rdbms/texasdb/texasdb/trace/alert_texasdb.log
tail -f /ora/app/oracle/diag/rdbms/texasdb/txdb1/trace/alert_txdb1.log
tail -f /ora/app/oracle/cfgtoollogs/rconfig/rconfig_12_07_15_14_34_51.log
tail -f /ora/app/oracle/cfgtoollogs/rconfig/texasdb/sqlLog
tail -f /ora/app/oracle/cfgtoollogs/rconfig/texasdb/rman
tail -f /ora/app/oracle/cfgtoollogs/rconfig/txdb1/sqlLog
tail -f /ora/app/oracle/cfgtoollogs/rconfig/txdb1/rman

How do we convert using RCONFIG if the stand alone DB is in different host?

You would accomplish this task by first restoring single instance database  in one of RAC node and , then you would use RCONFIG  to convert to RAC option.

Where does RMAN store the backup piece?

In my environment, i am able to find the backup piece under +TEST/TEXASDB/BACKUPSET/2015_12_07

I can find the info from /ora/app/oracle/cfgtoollogs/rconfig/rconfig_12_07_15_14_34_51.log

[Thread-203] [ 2015-12-07 14:39:34.817 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=recovering datafile copy file number=00006 name=+TEST/TEXASDB/DATAFILE/users.262.897835005
[Thread-203] [ 2015-12-07 14:39:34.876 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=channel ORA_DISK_1: reading from backup piece +TEST/TEXASDB/BACKUPSET/2015_12_07/nnndn1_rconfig_backup_0.261.897835009
[Thread-203] [ 2015-12-07 14:39:35.879 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=channel ORA_DISK_1: piece handle=+TEST/TEXASDB/BACKUPSET/2015_12_07/nnndn1_rconfig_backup_0.261.897835009 tag=RCONFIG_BACKUP
[Thread-203] [ 2015-12-07 14:39:35.880 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=channel ORA_DISK_1: restored backup piece 1
[Thread-203] [ 2015-12-07 14:39:35.881 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
[Thread-203] [ 2015-12-07 14:39:36.025 EST ] [RMANEngine.readSqlOutput:889]  Log RMAN Output=Finished recover at 07-DEC-15

How do i cleanup my old single instance data files?

I successfully converted single instance to RAC instance and all my data files are migrated to ASM disk. I need to clean up the single instance data files in the file system to free up the space.
You can just go and delete the data files.

[oracle@RACTEST1 texasdb]$ pwd
[oracle@RACTEST1 texasdb]$ ls -ltr
total 1859196
-rw-r-----. 1 oracle asmadmin  62922752 Dec  7 14:35 temp01.dbf
-rw-r-----. 1 oracle asmadmin 817897472 Dec  7 14:37 system01.dbf
-rw-r-----. 1 oracle asmadmin 272637952 Dec  7 14:37 undotbs01.dbf
-rw-r-----. 1 oracle asmadmin 629153792 Dec  7 14:37 sysaux01.dbf
-rw-r-----. 1 oracle asmadmin   5251072 Dec  7 14:37 users01.dbf
-rw-r-----. 1 oracle asmadmin  10043392 Dec  7 14:40 control01.ctl
-rw-r-----. 1 oracle asmadmin  10043392 Dec  7 14:40 control02.ctl
-rw-r-----. 1 oracle asmadmin  52429312 Dec  7 14:41 redo02.log
-rw-r-----. 1 oracle asmadmin  52429312 Dec  7 14:41 redo03.log
-rw-r-----. 1 oracle asmadmin  52429312 Dec  7 14:41 redo01.log
[oracle@RACTEST1 texasdb]$

[oracle@RACTEST1 texasdb]$ rm *

Do we have any useful links to read about RCONFIG?

Hope this topic helps!

Metalink Doc ID 387046.1 is good one!  I also like this you tube video.

No comments: