Convert Single Instance to RAC – Part 1: Duplicate DB using RMAN

This article is for users of Oracle Database version 10g+ who want to convert their Oracle single instance database to RAC. I will provide detailed procedure for converting non-RAC database to RAC and we will use Oracle Automatic storage management (ASM) as shared storage. In general, if the database is small then you can consider installing a new RAC database…

This article is for users of Oracle Database version 10g+ who want to convert their Oracle single instance database to RAC.  I will provide detailed procedure for converting non-RAC database to RAC and we will use Oracle Automatic storage management (ASM) as shared storage.

In general, if the database is small then you can consider installing a new RAC database and export/import your current database. If the database is large then using RMAN for migration would be one of the preferred methods.  If your single instance database is running an older version (than 10g) and you want to migrate to a higher RAC version then the preferred method is to fist upgrade your existing single instance database, test the upgraded database and then migrate to RAC.

Upgrading Single Instance to RAC Oracle Screenshot

In most of the cases, users want to create a new environment for RAC and we are assuming that the below prerequisites are met, and the RAC environment is already installed with ASM as shared storage and ready for database migration.

Prerequisites on all the nodes in the cluster

  • Install and configure Clusterware
  • Install and configure Automatic Storage Management (ASM)
  • Install Oracle Database Software
  • Standalone database and RAC must be on same Database version

Please refer to the Oracle Documentation for operating system specific installation and configuration. Also refer to the Metalink note ASM Technical Best Practices [ID 265633.1] (requires a login) for ASM disk group creation based upon on the operating system and type of storage.

Method to convert single instance to RAC

We have different ways to migrate non-RAC to RAC. Here we are using the DUPLICATE DATABASE feature of RMAN to migrate single instance non-ASM database to RAC Server, which is using ASM as shared storage. Using this manual method you have full control on the duplication process. In case of any issues/errors, you just need to fix the failed setup and you do not need to redo the whole process.

We are using a two phase approach to migrate non-RAC to RAC:

  1. Duplicate single instance Non-ASM database to ASM using RMAN
  2. Manually Convert single-instance to RAC.

Overview of Non-RAC environment

Hostname Database Name Instance Name Database Storage
orasrv DBORA DBORA ext3

Overview of RAC environment

Hostname Database Name Instance Name Database Storage
orarac1 ORADB ORADB1 ASM
orarac2 ORADB ORADB2 ASM

If you prefer you can keep same name for RAC database. I am using a different database name in RAC environment to avoid confusion.

Please replace the xxxxxxx with actual password in below steps

1.1 Estimate used space for Non-RAC database:

Run the below query on Non-RAC to estimate used space and make sure you have enough space on RAC environment.

1.2 Create password file and init.ora file for RAC environment:

Make sure you set the ORACLE_SID and ORACLE_HOME and create password file under $ORACLE_HOME/dbs

Create initORADB.ora file under $ORACLE_HOME/dbs on RAC node1. Please note that we have two ASM diskgroups i.e. +DATA, +FLASH, If you are using different names replace the diskgroup names.

The below initORADB.ora file has minimum settings. Refer to your Non-RAC init.ora file and set the required parameters.

We are not using DB_FILE_NAME_CONVERT, LOG_FILE_NAME_CONVERT parameters as most of the databases have data/redo files in multiple directories.

1.3 Configure Oracle Listener and tnsnames.ora file

Create a static listener for RAC node1 under $ORACLE_HOME/network/admin and reload because auxiliary database will not register itself with the listener:

Add TNS entry in $ORACLE_HOME/network/admin/tnsnames.ora file on Non-RAC Server:

1.4 Start the database in nomount and test the connectivity
Start the auxiliary database in NOMOUNT mode on RAC node1

Test your Sql*Net connections from Non-RAC Server and you must be able to connect to the ORADB database on RAC Node1.

Here we are using RMAN catalog and testing the connection to RMAN Database too.

 
1.5 Take a backup of Non-RAC Database:

Take a backup of your database and archive logs using below script. Here we are backing the database to a NFS file system/ backup/rman/ORADB.

The RMAN multiplexing will help to decrease the backup time. If the database is large, allocate more channels and use set optimal value for filesperset and maxopenfiles. But please note that increasing filesperset, maxopenfiles values increases process memory requirement.

In RMAN, the FILESPERSET parameter determines how many datafiles to put in each backup set and MAXOPENFILES parameter of ALLOCATE CHANNEL defines how many datafiles RMAN can read from simultaneously.

Once the backup is completed you can either mount the backup file system or copy the backup files for duplicate process on RAC environment. If you are copying the files ensure that you create the same directory structure and copy the backup files:

1.6 Duplicate the database to RAC server 

In order to duplicate you must connect to the target database and auxiliary database started in NOMOUNT mode and also RMAN catalog, if you are using it.

As part of duplication process, RMAN restores the target data files to the duplicate database and performs the recovery using all available backups and archive logs.  After recovery is completed RMAN restarts the duplicate database (auxiliary database) and opens with the RESETLOGS option and generates a new DBID for duplicate database.           

(i) Place the data files in one diskgroup :  If you want to place all data files in one diskgroup then make sure you have set db_create_file_dest parameter in init.ora file

Here is the duplicate database script:

Run database duplication script as below:

(ii) Place the data files in different diskgroups:  If you have more than one diskgroup and want to place data files across different disk groups then prepare the duplication script using below command.

Here we are generating the SET NEWNAME command for each datafile in the database using below script:

Here we are generating the SET NEWNAME command for each tempfile in the database using below script:

Replace the diskgroup name that you want to place the data/temp files.

For ex: – we are placing the data files as below.

datafile1, datafile 2, datafile3 – +DATA1
datafile 4, datafile 5, datafile 6 – +DATA2
tempfile                           – +DATA2

Prepare the duplicate database script:

Run database duplication script as below:

We have duplicated single instance Non-ASM database from ‘orasrv’ server into ASM storage on orarac1 server.  In part 2 I explain to to convert the single instance database to RAC.