11gR2 Non-RAC to RAC Migration
In this article, we will be looking at Non-RAC to RAC migration using DBCA. I have RACN1 and RACN2 where I will show you how to migrate a single instance database running on machine DT_VM.
Create Template Using DBCA
Under DBCA, we have an option where you can create a template. A Template is basically like the entire structure of the database. And you can even include the data with the structure.
We are going to create (rather export) a DBCA template on DT_VM machine along with source data.
Let’s take when you are creating the template file. Basically, by default it will have structure of all the tables and all the objects of database and you can optionally choose to also include the content of the table. Like let’s take I have a table which having one lakh rows then I can even have the rows in the template so that when I create database on the destination side using DBCA, I will first get all the object and I will also get the data.
That is why for all the small scale databases mostly DBCA can be used as a Replication method or a Cloning method rather going for RMAN or other tool.
Let us create a template using single instance database.
On DT_VM (non-rac database) =========================== # su - oracle $ echo $ORACLE_SID
Just to make sure that this is not a RAC database, we will check the CLUSTER parameter.
SQL> show parameter cluster;
Now let us start DBCA and follow the below screenshots
On DT_VM (non-rac database) =========================== $ dbca
Select Manage Templates and Click Next
Choose Create a Database Template and select From an existing database (structure as well as data). Click on Next
Select the database which you are going to convert into RAC database and click on Next
Give a name to template, make a note of the Template Datafile location and click Next
Choose Convert the file locations to use OFA structure and click on Finish
Click on OK
Click on No
Goto the Template Datafile location
On DT_VM (non-rac database) =========================== $ cd /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/tmplates $ ls -lrt my_rac*
Now we can see three files are created. In the next step, we need to copy these files to RAC node 1.
Copy Template Files to RAC Node 1
Scp the DBCA template files to RAC node 1
On DT_VM (non-rac database) =========================== $ scp my_rac_migration.* email@example.com:/u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/tmplates
Create RAC Database From Template Files
Start DBCA on RAC node 1
On RACN1 ======== $ dbca
Select Oracle Real Application Clusters database and click on Next
Choose Create a Database and click on Next
Select the Template that you imported from non-RAC database server. In our case, it is my_rac_migration. Click Next
Select Admin-Managed, give Global Database Name, click on Select All and then click on Next
Disable Configure Enterprise manage then select Automatic Maintenance Tasks
You can keep the maintenance tasks enabled and just click on Next
Give password for SYS and SYSTEM account and click Next
Click on Yes
Make sure the storage type is ASM, Database Areas is set to +DATA and then click on Next
Leave default and click on next
Make sure Create Database is selected and click on Finish
Review the database summary and click on OK
Now your cluster database creation will start
Once done, click on Exit
Verify RAC Database
Now that the DB migration is done, we are ready to verify how our RAC database is running
On RACN1 ======== SQL> select instance_name, instance_number from v$instance; INSTANCE_NAME INSTANCE_NUMBER --------------------- --------------- racdb1 1 SQL> select database_name, open_mode from v$database; DATABASE_NAME OPEN_MODE ---------------- ---------- RACDB READ WRITE SQL> show parameter cluster_database; NAME TYPE VALUE ----------------- --------- ----------- cluster_database boolean TRUE
Run same commands from RAC node 2
On RACN2 ======== SQL> select instance_name, instance_number from v$instance; INSTANCE_NAME INSTANCE_NUMBER --------------------- --------------- racdb2 2 SQL> select database_name, open_mode from v$database; DATABASE_NAME OPEN_MODE ---------------- ---------- RACDB READ WRITE SQL> show parameter cluster_database; NAME TYPE VALUE ----------------- --------- ----------- cluster_database boolean TRUE
This is how you convert the Non- RAC to RAC database using DBCA. But I would recommend this method only when your database size small like around below 100 GB. Because above 100 GB will take lot of time to convert.
If your database Sizes above 100 GB, I would suggest to go with RMAN, Export / Import, Restore and Recover method from cold backup or hot backup. These are the other methods which also convert the Non- RAC to RAC database.