Installing RAC for a Database with Datafiles

Not that long ago, I needed to upgrade Oracle Clusterware and RDBMS from 11.1.0.7 to 11.2.0.2. I have tons of experience with the Oracle RDBMS software, but I suspect that I am like most DBA’s in that my Clusterware experience is not at the same level as my RDBMS experience. So while I had no fears about upgrading the RDBMS software, I approached the Clusterware upgrade with some degree of nervousness. Admittedly, this uneasiness was born out of a lower degree of experience with the product. So before attempting in production, I tested, tested, and tested as much as I could.
The upgrade of Clusterware went smoothly thanks to lots of planning and testing.

After the upgrade, I was reflecting on what went right and what went wrong, and what I could do differently in the future. It occurred to me that I could have totally screwed up the Clusterware upgrade, blown away the Clusterware software, and still been able to install Clusterware from scratch and been able to get my RAC database up and running. This post will show the steps I took in a test environment to do this task. So if you find yourself with a totally screwed up Clusterware upgrade or install, there is no fear because so long as you still have your database files, you will be able to get things up and running. If your Clusterware upgrade failed, you will have to fix the root cause of the failure before proceeding. So if you had a bad cluster interconnect configuration or invalid storage for your voting disks, you will need to address those issues and then you can follow these steps.

I have a valid database with all of my datafiles in shared storage accessible by all nodes in the cluster. My test has two nodes for the cluster. It is also assumed that the database was shut down cleanly. This paper assumes the database name is ORCL.

Note: If your database you are adding to RAC was already part of RAC, you can skip steps 9-11 below. Steps 9-11 are required if you are also converting the database from a single-instance database to an Oracle RAC database while adding it to Clusterware.

Steps
1. Take a cold backup of your database datafiles. In case something happens, you can always restore from the backup by simply copying the files from the media.
2. Make sure the nodes are cleaned up from the Clusterware installation/upgrade. Refer to Metalink Note 239998.1 for detailed instructions if needed.
3. Install Oracle Clusterware correctly. You should have fixed the problems that caused this step to fail in the first place.
a. Verify the cluster is up and running.
i. $CRS_HOME/bin/crsctl status server
1. All nodes in the cluster should be ONLINE.
4. Install Oracle RDBMS on the cluster.
a. The OUI should detect the Clusterware and offer to perform a RAC installation.
5. Fire up the DBCA to create a shell database. We’ll use the DBCA to set up everything in CRS for us.
a. Choose the options to create a RAC database.
b. Use the same name as your existing database.
c. Create the shell database on all nodes in the cluster.
d. Use a common location for the database files, but do not overwrite your existing datafiles.
6. Shutdown the shell database
a. srvctl stop database –d orcl
7. Set up your SPFILE
a. If you have your old database’s SPFILE:
i. Place the file on shared disk.
ii. Update $ORACLE_HOME/dbs/initorcl.ora to point to the correct SPFILE location. Do this on all nodes
b. If you do not have a SPFILE, create a PFILE from scratch and then use the CREATE SPFILE FROM PFILE command to create a SPFILE.
i. Make sure the CONTROL_FILES parameter points to the correct location, not the shell database’s control files.
c. (Optional) If you have a password file, copy it to shared storage and then update the softlink in $ORACLE_HOME/dbs (on all nodes) to point to the password file. If you do not have a password file, you can create one later if desired.
8. Update CRS with SPFILE location (as root)
a. cd $CRS_HOME/bin
b. ./srvctl config database –d orcl
This has been an anti- impotent medicinal drug which has been manufactured by Alkem in India. viagra österreich In few cases men do not follow the instructions levitra ordering made by your healthcare providers. Yes, pill viagra many men are not able to get erections while making love to their females in the bed. In depth scientific studies happen to viagra generico cialis be made to help your erectile dysfunction. i. The output should tell you the SPFILE is in the location of the shell database
c. ./srvctl modify database –d orcl –p /correct_path/spfileorcl.ora
i. Do step 8b to verify change has taken place.
ii. Verify the change on the other node as well. You should only need to run this modify command once for all nodes.
9. Modify the SPFILE’s contents.
a. sqlplus /nolog
b. connect / as sysdba
c. create pfile=’/home/oracle/pfile.txt’ from spfile=’/path_to_spfile/spfileorcl.ora’;
d. Open the pfile in a text editor and make the following changes:
i. Add:
1. *.cluster_database=true
2. *.cluster_database_instances=2
3. orcl1.instance_number=1
4. orcl2.instance_number=2
5. orcl1.thread=1
6. orcl2.thread=2
ii. Change the *.undo_tablespace parameter to orcl1.undo_tablespace
e. Use the pfile to change the spfile
i. create spfile=’/path_to_spfile/spfileorcl.ora’ from pfile=’/home/oracle/pfile.txt’;
10. Create a new UNDO tablespace for the other instance.
a. export ORACLE_SID=orcl1
b. sqlplus / as sysdba
c. startup
d. create undo tablespace undotbs2 datafile ‘/path/undotbs02.dbf’ size 30m;
e. alter system set undo_tablespace=undotbs2 scope=spfile sid=’orcl2′;
11. Create redo logs for the new thread
a. alter database add logfile thread 2 group 10 ‘/path/redo10.log’ size 50m;
b. alter database add logfile thread 2 group 11 ‘/path/redo11.log’ size 50m;
c. alter database add logfile thread 2 group 12 ‘/path/redo12.log’ size 50m;
d. alter database enable public thread 2;
12. srvctl start database –d orcl

At this point, you have now installed Clusterware from scratch and added an existing database to it. Now that I have a proven method of taking any set of database files and adding them to any clusterware installation, I have lowered my nervousness levels when performing Clusterware upgrades on production systems. Even if I make a total mess of things, I can blow away Clusterware, reinstall it, and then add the database to Clusterware and have my RAC database up and running in no time.