Setting Up RAC
Cluster Ready Services (CRS) has been introduced in Oracle 10g Real Application Clusters (RAC) to provide a standard cluster interface on all platforms, enabling improved high-availability operations. CRS should be installed prior to installing 10g RAC in a HOME other than ORACLE_HOME.
There are several combinations with regard to installing RAC in your environment. To name but a few of the most common scenarios: You can do a fresh installation, convert a standby database on Data Guard to RAC, and upgrade existing RAC instances. Oracle recommends the use of DBCA to create new databases, which was covered in Chapter 2, "Installing Oracle Database 10g." Hence, we will focus here on performing a new manual installation of RAC.
Manual Installation of RAC Instance
For a manual installation of a RAC instance, follow these steps:
Start the installation process by making a copy of initSID.ora in your $ORACLE_HOME/dbs directory on UNIX platforms or in $ORACLE_HOME\database on Windows platforms. If you are using an SPFILE, create an initSID.ora file, edit it, and point your SPFILE to it or use alter system set... commands to change the instance-specific parameters. Make sure that your control file is pointing to an existing raw device or cluster file system location. For the entire example, we will call our database as Q0RAC and call our instances Q0RAC1 and Q0RAC2 on nodes 1 and 2.
Make changes to the path, filenames, and sizes as needed to suit your installation. Cluster-wide parameters for the Q0RAC database would be as follows:
db_block_size=8192 db_cache_size=104857600 background_dump_dest=/opt/app/oracle/product/10.0.1/rdbms/log core_dump_dest=/opt/app/oracle/product/10.0.1/rdbms/log user_dump_dest=/opt/app/oracle/product/10.0.1/rdbms/log timed_statistics=TRUE control_files=("/dev/Q0RAC/control_01.ctl", "/dev/Q0RAC/control_02.ctl") db_name=RAC shared_pool_size=104857600 sort_area_size=1638400 undo_management=AUTO cluster_database=true cluster_database_instances=2 remote_listener=LISTENERS_Q0RAC
For the Q0RAC1, instance-specific parameters will be as follows. Add the listener address to your tnsanames.ora file for the local_listener parameter on node 1 and 2:
instance_name=Q0RAC1 instance_number=1 local_listener=LISTENER_Q0RAC1 thread=1 undo_tablespace=UNDOTBS
Connect to the database using SYS (as SYSDBA) and execute the following SQLPlus command:
SQL> startup nomount
Create the database using pre-created raw devices:
create database Q0RAC controlfile reuse maxdatafiles 250 maxinstances 32 maxloghistory 100 maxlogmembers 5 maxlogfiles 128 datafile ‘/dev/q0rac/system_01.dbf’ size 900m segment space management auto reuse autoextend on next 10240k maxsize unlimited undo tablespace "undotbs" datafile ‘/dev/q0rac/undotbs_01.dbf’ size 200m reuse default tablespace user_default datafile ‘/opt/app/oracle/racdb1/user_default_1.dbf’ size 2000m reuse segment space management auto sysaux datafile ‘/opt/app/oracle/racdb1/sysaux_1.dbf’ size 500m reuse segment space management auto character set us7ascii logfile group 1 (‘/dev/q0rac/redo1_01.dbf’) size 100m reuse, group 2 (‘/dev/q0rac/redo1_02.dbf’) size 100m reuse;
Create temporary tablespace:
create temporary tablespace "temp_q0rac" tempfile ‘/dev/q0rac/temp_01.dbf’ size 40m reuse;
Create a second UNDO tablespace as follows:
create undo tablespace "undotbs2" datafile ‘/dev/q0rac/undotbs_02.dbf’ size 200m reuse next 5120k maxsize unlimited;
- Run the catalog.sql, catproc.sql, and catparr.sql scripts in the ORACLE_HOME/rdbms/admin directory to build the necessary views, synonyms, and packages.
Edit initSID.ora and set appropriate values for the second instance on node 2.
instance_name= Q0RAC2 instance_number=2 local_listener=LISTENER_Q0RAC2 thread=2 undo_tablespace=UNDOTBS2
From Q0RAC1 (the first instance), run the following command:
alter database add logfile thread 2 group 3 (‘/dev/Q0RAC/redo2_01.dbf’) size 100M, group 4 (‘/dev/Q0RAC/redo2_02.dbf’) size 100M; alter database enable public thread 2;
- Check whether your cluster configuration is up and running. Use the ps -ef | grep crs command or run crs_stat from the $ORA_CRS_HOME/bin directory. The crs_stat command will provide status information for resources on cluster nodes throughout the cluster.
- Start the second instance, Q0RAC2. Now your RAC environment is ready for use.
Installation of RAC Instance Using Data Guard
You can also install a RAC instance using Data Guard, but it will be more complicated than the manual installation. The steps are too elaborate to be discussed within the limited scope of this chapter. Refer to Oracle Data Guard Concepts and Administration 10g and MetaLink Note #273015.1 for more details.