Chapter 2. Configuring IRIS FailSafe for Oracle

This chapter provides information about configuring the IRIS FailSafe Oracle database option for use on an IRIS FailSafe system. The major sections in this chapter are as follows:

Required Software

The required software for Oracle failover is as follows:

  • Oracle database software

    See the guide Oracle7 for MIPS ABI Systems Installation and Configuration Guide.

  • Base IRIS FailSafe software

    See the section “Installing the IRIS FailSafe Software” in Chapter 2 of the IRIS FailSafe Administrator's Guide for a complete list of required base software.

  • IRIS FailSafe Oracle software

    The software subsystem is ha_ orcl.sw.base.

Planning Oracle Configuration

The subsections below discuss choosing the location of key Oracle files and Oracle databases and the need for customizing certain Oracle files. They also describe an example configuration of Oracle files and the configuration parameters for this configuration.

Choosing an Oracle Configuration

In configuring Oracle on an IRIS FailSafe cluster, you need to consider the locations of these components:

  • Oracle software ($ORACLE_HOME)

  • The Oracle parameter file in its default location ($ORACLE_HOME/dbs/init${ORACLE_SID}.ora for Oracle 7.2) or a location you specify

  • IRIS FailSafe versions of the Oracle startup and shutdown scripts

  • Oracle databases (including all data, log, and control files)

All of the items above are specified for each Oracle instance. Therefore, you have the flexibility to use different copies of each component, for example Oracle software, for each database instance (the Oracle software used by one instance must be identical on both nodes). In addition, the Oracle parameter file, startup script, and shutdown script for a database instance need not be identical on each node. For example, if the two nodes have different amounts of memory, you may want different Oracle parameter files on each node, so that the size of the System Global Area is different on each node. The two parameter files must have identical pathnames, but the contents can be different.

To plan an IRIS FailSafe configuration for Oracle, you must answer these questions:

  • What is the primary node of each database instance?

  • Do all database instances use the same Oracle software or not?

  • Is the Oracle parameter file identical on each node for each database instance or different?

  • Are the Oracle startup and shutdown scripts identical in location and content for each database instance or different?

  • For each database instance, is the content of its Oracle startup script identical on each node?

  • For each database instance, is the content of its Oracle shutdown script identical on each node?

After answering all of the questions above, follow these guidelines for each database instance to decide whether to use shared or non-shared disks for each of the Oracle components for that instance:

  • Oracle databases must be on one or more XFS filesystems or XLV logical volumes that are on shared disks.

  • If the Oracle parameter file is identical on each node, it can be on a shared disk or replicated on non-shared disks.

  • If the Oracle parameter file is different on each node, it must be on non-shared disks on each node.

  • If the Oracle startup and shutdown scripts are identical on each node, they can be on a shared disk or replicated on non-shared disks.

  • If the Oracle startup and shutdown scripts are different on each node, they must be on a non-shared disk on each node.

  • Oracle software can be on a shared disk or replicated on non-shared disks (it must be identical on each disk).

  • If the Oracle parameter file is different on each node, it must be on non-shared disks and linked to the directory in the Oracle software where Oracle expects to find it.

Once you have decided whether to store the Oracle startup and shutdown scripts on shared or non-shared disks, you can choose the pathnames of the files. Some possibilities are as follows:

  • The scripts can be installed in a directory in the Oracle software, for example, /usr/oracle/scripts/dbstart. This is a good choice when using Oracle software installed on a shared disk.

  • The scripts can be installed in the directory /var/ha, for example, /var/ha/actions/oracle_dbstart.

Example Oracle Configuration

For a simple Oracle configuration with one database instance called Oracle1 whose primary node is xfs-ha2, an example configuration is as follows:

Oracle software  


On a shared disk with $ORACLE_HOME set to /usr/people/oracle

Oracle parameter file  


Identical on both nodes and stored in $ORACLE_HOME/dbs/initfs.ora, which is on the same shared disk as the Oracle software

Oracle startup script  


Identical on both nodes and stored in $ORACLE_HOME/scripts/dbstart, which is on the same shared disk as the Oracle software

Oracle shutdown script  


Identical on both nodes and stored in $ORACLE_HOME/scripts/dbshut, which is on the same shared disk as the Oracle software

Oracle database files (data, log, and control files)  


On a filesystem that is on a shared disk and mounted at /xfs-ha2fs on xfs-ha2

Configuration Parameters for Oracle

Table 2-1 lists the label and configuration parameters for the Oracle database in the configuration described in the previous section, “Example Oracle Configuration.”

Table 2-1. Oracle Configuration Parameters

Label or Parameter

Example Value

Comments

database label

Oracle1

Choose any unique name.

release-dir

/usr/people/oracle

This value is the value of $ORACLE_HOME.

instance-id

fs

This value is the value of $ORACLE_SID. It is used to create the pathname of the Oracle parameter file unless a different parameter file is specified in the Oracle startup script.

startup-script

/usr/people/oracle/ scripts/dbstart

The value is the location of the Oracle startup script for this instance.

shutdown-script

/usr/people/oracle/ scripts/dbshut

The value is the location of the Oracle shutdown script for this instance.

master-db-fs

ofs2fs

The value is the label for one (any one) of the filesystems that is used by the database. (See the section “Oracle Blocks” in Chapter 3 for more information.) The server-node of the filesystem's volume must be the primary node of the database.


Customizing the Oracle Startup and Shutdown Scripts

Example 2-1 is a copy of the sample Oracle startup script provided in /var/ha/samples/startup_oracle.sample. Most comments have been removed and line numbers have been added.

Example 2-1. Sample Oracle Startup Script


 1   #! /sbin/sh
 2 
 3   PATH=$ORACLE_HOME/bin:$PATH
 4   # By default ${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora will be used
 5   # used as the parameter file
 6   svrmgrl <<EOF
 7   connect internal
 8   startup
 9   EOF
10   if test $? -eq 0 ; then
11       logger “Database \”${ORACLE_SID}\” started”
12       exit 0;
13   else
14       logger “Database \”${ORACLE_SID}\” not started”
15       exit 1;
16   fi

As written, the script assumes that $ORACLE_HOME is set to the value of the parameter release-dir and $ORACLE_SID is set to the value of instance-id. These environment variables are set by the script /var/ha/resources/oracle, which calls this startup script.

As mentioned in the comments on lines 4 and 5, the file ${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora is used as the Oracle parameter file by default. To use a different file, change line 7 so that it is

connect internal pfile=parameterfile 

parameterfile is the full pathname of the parameter file.

Lines 6 through 9 start an Oracle instance.

Line 10 checks the exit status of the svrmgrl command to determine whether the database has been successfully started. In either case, a message is written to /var/adm/SYSLOG to report the result. The script exits with a status of 0 for a successful start or 1 for an unsuccessful start.

Example 2-2 is a copy of the sample Oracle shutdown script provided in /var/ha/samples/shutdown_oracle.sample. Again, comments have been removed and line numbers have been added.

Example 2-2. Sample Oracle Shutdown Script


 1   #! /sbin/sh
 2
 3   PATH=$ORACLE_HOME/bin:$PATH
 4   svrmgrl <<EOF
 5   connect internal
 6   shutdown normal
 7   EOF
 8   if test $? -eq 0 ; then
 9       logger “Database \”${ORACLE_SID}\” shut down.”
10       exit 0;
11   else
12       logger “Database \”${ORACLE_SID}\” not shut down.”
13       exit 1;
14   fi

LInes 3 through 7 shut down an Oracle instance.

Line 10 checks the exit status of the svrmgrl command to determine whether the database has been successfully shutdown. In either case, a message is written to /var/adm/SYSLOG to report the result. The script exits with a status of 0 for a successful shutdown or 1 for an unsuccessful shutdown.

When customizing the Oracle startup and shutdown scripts, remember these points:

  • The script cannot be interactive. It must be able to run as a background process.

  • The script will be called once for each oracle block in the configuration file that gives the pathname of this script as the value of startup-script or shutdown-script.

  • The script is automatically run with the environment variable ORACLE_HOME set to the value of the configuration parameter release-dir and the environment variable ORACLE_SID set to the value of the configuration parameter instance-id.

  • If you've changed the location of the Oracle parameters file, be sure that the startup script has the correct pathname.

Adding Oracle Information to the Configuration File

The procedure for creating a configuration file that includes Oracle configuration information is described below. The procedure assumes that a configuration file that doesn't include Oracle has been created, installed, and tested as described in the IRIS FailSafe Administrator's Guide . Using the procedure, you add information to a copy of the configuration file. Installing the configuration file as /var/ha/ha.conf on both nodes is described in the section “Installing Startup and Shutdown Scripts and the Configuration File” in this chapter.

  1. Copy the file /var/ha/ha.conf to any directory on one of the nodes in the cluster.

  2. Add all of the volumes that will be used for Oracle to the copy of ha.conf if they are not already specified in ha.conf. Be sure to specify the devname-owner, devname-group, and devname-mode parameters for volumes used as raw devices for Oracle database data. See the sections “Logical Volume Configuration” in Chapter 2 and “Volume Blocks” in Chapter 4 of the IRIS FailSafe Administrator's Guide for more information.

  3. Add all of the filesystems that will be used for Oracle to the copy of ha.conf if they are not already specified in ha.conf. See the section “Filesystem Blocks” in Chapter 4 of the IRIS FailSafe Administrator's Guide for more information.

  4. Append a copy of /var/ha/templates/ha.conf.oracle to the end of the copy of the configuration file.

  5. Complete the block called “application-class oracle.” See the section “Oracle Application-Class Block” in Chapter 3 and the comments in the file for information.

  6. Replicate the “oracle” block so that there is one oracle block for each database instance.

  7. Using the configuration parameter choices you made in the section “Planning Oracle Configuration,” and the information in the section “Oracle Blocks” in Chapter 3, prepare each of the oracle blocks.

  8. Using information in the section “Oracle Blocks” in Chapter 3, prepare the “action oracle” and “action-timer oracle” blocks.

  9. Check the configuration file with the ha_cfgverify command:

    # /usr/etc/ha_cfgverify copy_filename 
    

    See the section “Verifying the Configuration File” in Chapter 4 of the IRIS FailSafe Administrator's Guide for information about the checking the configuration file with ha_cfgverify.

Installing Startup and Shutdown Scripts and the Configuration File

To install Oracle startup and shutdown scripts, follow these guidelines:

  • If they are to be installed on a shared disk, install them from the disk's primary node.

  • If they are to be installed on non-shared disks, install them on each node.

  • Install the scripts in the locations specified by startup-script and shutdown-script for the Oracle database instances that use them.

  • If you are using different scripts on each node, verify that the correct script is installed on each node.

  • The mode of each script should be 755.

To install the new version of the configuration file /var/ha/ha.conf on each node, you must follow the procedure described in the section “Procedure C” in Chapter 7 of the IRIS FailSafe Administrator's Guide.

Testing Oracle Failover

Follow this procedure to test Oracle configuration and failover:

  1. Comment out all of the Oracle related blocks in /var/ha/ha.conf on one node. Do not comment out the blocks for the filesystems and volumes used for Oracle.

  2. Copy the copy of ha.conf from step 1 to the other node.

  3. Test the failover of the volumes and filesystems that are used by Oracle and are on shared disks using the procedures in “Testing Volumes” and “Testing Filesystems” in Chapter 5 of the IRIS FailSafe Administrator's Guide.

  4. Bring up both nodes in the cluster so that they are running IRIS FailSafe and are in normal state.

  5. Bring up each Oracle database on its primary node using these commands (or the equivalent for your shell):

    # setenv ORACLE_HOME release-dir 
    # setenv ORACLE_SID instance-id 
    # su unix-user -c startup-script 
    

    release-dir, instance-id, unix-user, and startup-script are the values of the parameters in ha.conf with these names for the database you are starting up. (You can identify the primary node of an Oracle database by looking at its master-db-vol or master-db-fs. The volume block for master-db-vol or the volume on which master-db-fs resides lists the server-node for the volume. This is the primary node for the database.)

  6. Check that you can successfully access each of the databases using an SQL query of your choosing.

  7. Shut down each Oracle database using these commands (or the equivalent for your shell) on its primary node:

    # setenv ORACLE_HOME release-dir 
    # setenv ORACLE_SID instance-id 
    # su unix-user -c shutdown-script 
    

    release-dir, instance-id, unix-user, and shutdown-script are the values of the parameters in ha.conf with these names for the database you are shutting down.

  8. Enter this command on each node to shut down IRIS FailSafe:

    # /etc/init.d/failsafe stop 
    

  9. Uncomment all of the Oracle blocks in /var/ha/ha.conf on one node.

  10. Copy the copy of ha.conf from step 9 to the other node.

  11. Enter this command on each node to start up IRIS FailSafe:

    # /etc/init.d/failsafe start 
    

  12. Check that each of the databases started up and check that you can access the databases using an SQL query of your choosing on each database.

  13. For the first database listed in ha.conf (the first oracle block), stop or kill the Oracle processes for this database. The Oracle processes are called ora_pmon_instance-id, ora_smon_instance-id, ora_dbwr_instance-id, and ora_lgwr_instance-id, where instance-id is the value of the instance-id parameter for the database.

  14. Check that IRIS FailSafe fails over the database that you killed and all other highly available services on that node to the other node. For example, to check for Oracle processes, enter this command:

    # ps -ef | grep ora 
        root  9720 11334  0 14:58:43 pts/0   0:00 grep ora 
      oracle 14936     1  0 15:26:45 ?       0:19 ora_pmon_fs 
      oracle 14939     1  0 15:26:51 ?       0:03 ora_smon_fs 
      oracle 14937     1  0 15:26:47 ?       0:31 ora_dbwr_fs 
      oracle 14938     1  0 15:26:49 ?       0:23 ora_lgwr_fs 
    

    The example output shows the four processes for the database whose instance-id parameter is fs.

  15. Confirm that the node on which you stopped the database is in standby state:

    # /usr/etc/ha_admin -i 
    

  16. On the node that is now in standby state, enter this command to reintegrate it into the cluster:

    # /usr/etc/ha_admin -rf 
    

  17. Check that the highly available services that failed over in step 14 are stopped on the backup node and restarted on their original node.

  18. For each of the remaining Oracle databases listed in ha.conf, repeat steps 13 through 17 to verify that they fail over properly when stopped or killed.