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:
The required software for Oracle failover is as follows:
Oracle database software
See the Oracle817 for MIPS ABI Systems Installation and Configuration Guide.
Base IRIS FailSafe software
See “Installing the IRIS FailSafe Software” in Chapter 2 of the IRIS FailSafe 2.0 Administrator's Guide for a complete list of required base software.
IRIS FailSafe Oracle software, as follows:
The IRIS FailSafe 2.0 Oracle Administrator's Guide subsystem is failsafe2_oracle.books.book_AG.
The IRIS FailSafe 2.0 Oracle release notes subsystem is failsafe2_oracle.man.relnotes.
The base software subsystem is failsafe2_oracle.sw.base.
The following subsections 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.
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) 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 preceding items 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:
Do all database instances use the same Oracle software?
Is the Oracle parameter file identical on each node for each database instance?
Are the Oracle startup and shutdown scripts identical in location and content for each database instance?
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 preceding questions, 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 file systems 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 not identical 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 not identical 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 not identical 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/cluster/ha, for example, /var/cluster/ha/resource_types/Oracle_DB.
An example configuration for a simple Oracle configuration with one database instance called Oracle1 is as follows:
Oracle software |
| |
Oracle parameter file |
| |
Oracle startup script |
| |
Oracle shutdown script |
|
Table 2-1 lists the label and configuration parameters for the Oracle database resource in the configuration described in the previous section, “Example Oracle Resource Configuration.”
Table 2-1. Oracle Resource Configuration Parameters
Label or Parameter | Example Value | Comments |
---|---|---|
resource-name | oracle | 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. |
release-dir | /usr/people/oracle | This value is the value of $ORACLE_HOME. |
startup-script | /usr/people/oracle/scripts/d bstart | The value is the location of the Oracle startup script for this instance (copy from /usr/cluster/ha/resource_types/Oracle_DB). |
shutdown-script | /usr/people/oracle/scripts/d bstop | The value is the location of the Oracle shutdown script for this instance (copy from /usr/cluster/ha/resource_types/Oracle_DB). |
master-db-fs | ofs2fs | The value is the label for one (any one) of the file systems that is used by the database. The server-node of the file system's volume must be the primary node of the database. |
oracle-user | oracle | The UNIX user of Oracle. |
The Oracle_DB resource also contains a resource dependency on the filesystem and IP_address resources. These resources must be specified when defining the resource group (see Chapter 2, “Creating an Oracle Resource Group”).
Example 2-1 is a copy of the sample Oracle startup script provided in /var/cluster/ha/resource_types/Oracle_DB /startup_oracle.sample. Most comments have been removed and line numbers have been added.
Example 2-1. Sample Oracle Startup Script
1 #! /sbin/ksh 2 3 PATH=$ORACLE_HOME/bin:$PATH 4 # By default ${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora will be 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 resource-name. These environment variables are set by the script /var/cluster/ha/resource_types/Oracle_DB /, 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 8 to the following:
startup pfile=parameterfile |
where 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. 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/cluster/ha/resource_types/Oracle_DB /shutdown_oracle.sample. Again, comments have been removed and line numbers have been added.
Example 2-2. Sample Oracle Shutdown Script
1 #! /sbin/ksh 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 4 through 7 shut down an Oracle instance.
Line 8 checks the exit status of the svrmgrl command to determine whether the database has been successfully shut down. 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 resource-name.
If you have changed the location of the Oracle parameter file, be sure that the startup script has the correct pathname.
This section describes procedures that show you how to create an Oracle resource type, resource, resource group, and configuration database that includes Oracle configuration information. These procedures assume that a CDB that does not include Oracle has already been created, installed, and tested as described in the IRIS FailSafe 2.0 Administrator's Guide .
To create an Oracle_DB resource type, this subsection assumes that you are already familiar with the concepts of resource types. The Oracle_DB resource type defines the following resource attributes. See Table 2-1 for the definitions of these resource attributes.
resource-name
release-dir
startup-script
shutdown-script
master-db-fs
oracle-user
The Oracle_DB resource type is created at cluster creation time. If this automatic resource creation fails, the administrator must create the resource type before an Oracle resource is created. The Oracle_DB resource type must be installed if you want to add an NFS resource to a cluster that was created before the NFS software was installed.
Example 2-3. Oracle Installation Process
Inst> l * View: distribution Status: N=new, U=upgrade, S=same, D=downgrade Stream: maint Selection: i=install, r=remove, k=keep Subsystem Types [bdrpc]: b=reBoot needed, d=Default, r=Required, p=patch, c=Client only i U failsafe2_oracle.books.book_AG [d] 0 FailSafe ORACLE Plugin 2.0 Administrator's Guide i U failsafe2_oracle.man.relnotes 0 FailSafe ORACLE Plugin 2.0 release notes i U failsafe2_oracle.sw.base [d] 4+ FailSafe ORACLE Plugin 2.0 base software Disk space summary (Kbytes): / /nfs_cm1 /apps Current free space 2277016 4422412 5656968 - Selections net change 4+ 0 0 - Temporary inst overhead 1296+ 0 0 = Minimum free during install 2275716 4422412 5656968 Final projected free space 2277012 4422412 5656968 Inst> g Pre-installation check .. 8% Checking space requirements .. 16% Installing/removing files .. 16% Upgrading selected failsafe2_oracle.books subsystems Installing/removing files .. 65% Upgrading selected failsafe2_oracle.man subsystems Installing/removing files .. 72% Upgrading selected failsafe2_oracle.sw subsystems Installing/removing files .. 94% Running exit-commands .. 99% Checking dependencies .. 100% Done. Installations and removals were successful. You may continue with installations or quit now. Inst> quit |
You can use one of the following methods to create the Oracle_DB resource type:
Run cluster manager (cmgr) and manually create the resource type. For more information, see the IRIS FailSafe 2.0 Administrator's Guide.
Run cluster manager (cmgr) and install the resource type, as follows:
cmgr> show resource_types installed NFS template Netscape_web statd Oracle_DB MAC_address IP_address INFORMIX_DB filesystem volume cmgr> install resource_type Oracle_DB in cluster eagan cmgr> |
Use the template scripts supplied with IRIS FailSafe 2.0 located in /var/cluster/cmgr-template/cmgr-create-resource_type.
Execute /var/cluster/ha/resource_type/ Oracle_DB/create_resource_type and include the path of the CDB argument and the cluster name.
Use the Load Resource Type GUI task to load the resource type.
After you have defined the resource type, the administrator must define the Oracle_DB resources based on the resource type. Each resource requires a unique resource name (for example, the Oracle_DB resource type is the Oracle instance name). Then, the administrator must supply the resource parameters. To create the resource, either use the cluster manager (cmgr), the cmgr template scripts, or the GUI.
Example 2-4. Creating the Oracle_DB Resource
cmgr> create resource oracle8 of resource_type Oracle_DB in cluster eagan Enter commands, when finished enter either “done” or “cancel” Type specific attributes to create with set command: Type Specific Attributes - 1: shutdown-script Type Specific Attributes - 2: db-master-fs Type Specific Attributes - 3: release-dir Type Specific Attributes - 4: oracle-user Type Specific Attributes - 5: startup-script Resource type dependencies to add: Resource Dependency Type - 1: IP_address Resource Dependency Type - 2: filesystem resource oracle8 ? set release-dir to /disk1/oracle resource oracle8 ? set startup-script to /disk1/oracle/dbstart resource oracle8 ? set shutdown-script to /disk1/oracle/dbstop resource oracle8 ? set db-master-fs to /disk1 resource oracle8 ? set oracle-user to oracle resource oracle8 ? done Successfully created resource oracle8 cmgr> modify resource oracle8 of resource_type Oracle_DB in cluster eagan Enter commands, when finished enter either “done” or “cancel” Type specific attributes to modify with set command: Type Specific Attribute - 1: shutdown-script Type Specific Attribute - 2: db-master-fs Type Specific Attribute - 3: release-dir Type Specific Attribute - 4: oracle-user Type Specific Attribute - 5: startup-script No resource type dependencies to add resource oracle8 ? add dependency /disk1 of type filesystem resource oracle8 ? add dependency 128.162.101.20 of type IP_address resource oracle8 ? done Successfully modified resource oracle8 cmgr> |
To create a resource group, you must first become familiar with the terms and concepts of FailSafe. A resource group can be created either by the GUI or the cluster manager (cmgr).
To define an effective resource group, you must include all of the resources that the Oracle_DB resource is dependent on, such as file systems, volumes, and IP addresses. The following example shows the creation of a typical resource group:
cmgr> create resource_group oracle in cluster eagan |
Enter commands, when finished enter either “done” or “cancel” resource_group oracle ? set failover_policy to ordered-in-order resource_group oracle ? add resource oracle8 of resource_type Oracle_DB resource_group oracle ? add resource 128.162.101.20 of resource_type IP_address resource_group oracle ? done Successfully created resource group oracle |
cmgr> show resource_group oracle in cluster eagan |
Resource Group: oracle Cluster: eagan Failover Policy: ordered-in-order Resources: oracle8 (type: Oracle_DB) 128.162.101.20 (type: IP_Addresses) |
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 the 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 the script should be 755.
To ensure that the Oracle_DB resource has been correctly configured, you can test individual actions by executing the scripts. Each script, located at /var/cluster/ha/resource_types/Oracle_DB, requires two arguments, an input file and an output file. The contents of these files are the resource names. The scripts will display either a 0 if they are successfully executed or a positive integer that indicates the error type. For more information on error codes, see the IRIS FailSafe 2.0 Programmer's Guide.
In the following example, you can test the start script by starting the Oracle resource with the resource name oracle8.
$ cd /var/cluster/ha/resource_types/Oracle_DB $ echo “oracle8” > /tmp/ipfile $ ./start /tmp/ipfile /tmp/opfile |
This should start the oracle8 instance, named by the Oracle resource oracle8.
To view the individual script actions, you must edit the script, and add “set -x” to the action function.
In the following example, to see what the start_oracle() function does, edit the start script and add “set -x” in the start function.
# # Start the resource on the local machine. # Return HA_SUCCESS if the resource has been successfully started on # the local machine and HA_CMD_FAILED otherwise. The resource name is # the oracle instance id. # start_oracle() { set -x # for all oracle resource configured ... |
You are now ready to run the script. In this example, /dev/null is the name of the output file.
# ./start /tmp/ipfile /dev/null + get_oracle_info oracle8 + [ 0 -ne 0 ] + ha_get_field shutdown-script /disk1/oracle/dbstop db-master-fs /disk1 release-dir /disk1/oracle oracle-user oracle startup-script /disk1/oracle/dbstart release-dir + [ 0 -ne 0 ] + export ORACLE_HOME=/disk1/oracle + export ORACLE_SID=oracle8 + oracle_probe oracle8 + [ 1 -eq 1 ] + ha_get_field shutdown-script /disk1/oracle/dbstop db-master-fs /disk1 release-dir /disk1/oracle oracle-user oracle startup-script /disk1/oracle/dbstart startup-script + [ 0 -ne 0 ] + STARTUP_SCRIPT=/disk1/oracle/dbstart + ha_get_field shutdown-script /disk1/oracle/dbstop db-master-fs /disk1 release-dir /disk1/oracle oracle-user oracle startup-script /disk1/oracle/dbstart oracle-user + [ 0 -ne 0 ] + UNIX_USER=oracle + [ -x /disk1/oracle/dbstart ] + ha_write_status_for_resource oracle8 4 |
You can use the following procedure to test the start script.
To test the start script, you must shut down the Oracle database on the node (if it is already running), as in the following example:
# export ORACLE_HOME release-dir # export ORACLE_SID resource-name # su oracle-user -c shutdown-script |
The release-dir, resource-name, oracle-user, and shutdown-script configuration parameters are from the Oracle_DB resource definition. This procedure should stop the Oracle instance.
To start the Oracle instance, enter the following command:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/start /tmp/ipfile /dev/null |
You can then check to see if the database is running and if you can access the database. You can check for the Oracle database processes by executing the following command:
# ps -ef | grep oracle |
You can use the following procedure to test the stop script.
To test the stop script, you must start the Oracle database on the node (if it is not already running), as in the following example:
# export ORACLE_HOME release-dir # export ORACLE_SID resource-name # su oracle-user -c startup-script |
The release-dir, resource-name, oracle-user, and startup-script configuration parameters are from the Oracle_DB resource definition. This procedure should start the Oracle instance.
To stop the Oracle instance, enter the following command:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/stop /tmp/ipfile /dev/null |
Check to ensure that the database has shut down.
You can use the following procedure to test the monitor script.
To test the monitor script, enter the following command:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/monitor /tmp/ipfile /dev/null |
As with all scripts, the output is logged to the /var/cluster/ha/log/script_hostname files. To check that the script has worked, use the tail command and execute the script as in the following example:
tail /var/cluster/ha/log/script_heb1 |
The following example shows the testing of the monitor script.
# echo “oracle8” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/monitor /tmp/ipfile /dev/null ; echo $? + oracle_probe oracle8 + HA_CMD=/usr/cluster/bin/ha_exec2 -s 0 -t ora_pmon_oracle8 + ha_execute_cmd Checking for oracle process (ora_pmon_oracle8) + [ 101 -eq 0 ] + ha_log Failed to find process ora_pmon_oracle8 + return 1 + [ 1 -eq 0 ] + ha_write_status_for_resource oracle8 2 0 # tail /var/cluster/ha/log/script_cm1 Wed Oct 7 16:37:01.078 <ha_cilog script 22618:0> /var/cluster/ha/resource_types/Oracle_DB/monitor[24196]: /var/cluster/ha/resource_types/Oracle_DB/monitor called with /tmp/ipfile and /dev/null Wed Oct 7 16:37:01.103 <ha_cilog script 23725:0> /var/cluster/ha/resource_types/Oracle_DB/monitor[24196]: Checking for oracle process (ora_pmon_oracle8) Wed Oct 7 16:37:01.147 <ha_cilog script 23077:0> /var/cluster/ha/resource_types/Oracle_DB/monitor[24196]: Wed Oct 7 16:37:01.169 <ha_cilog script 23280:0> /var/cluster/ha/resource_types/Oracle_DB/monitor[24196]: /usr/cluster/bin/ha_exec2 -s 0 -t ora_pmon_oracle8 exited with status 101 Wed Oct 7 16:37:01.195 <ha_cilog script 23956:0> /var/cluster/ha/resource_types/Oracle_DB/monitor[24196]: Failed to find process ora_pmon_oracle8 |
You can use the following procedure to test the restart script.
To test the restart script, enter the following command:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/restart /tmp/ipfile /dev/null |
You can use the following procedure to test the exclusive and probe scripts.
To test the exclusive and probe scripts, enter one of the following sets of commands:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/exclusive /tmp/ipfile /dev/null |
For the probe script, enter the following command:
# echo “resource-name” > /tmp/ipfile # /var/cluster/ha/resource_types/Oracle_DB/probe /tmp/ipfile /dev/null |
As with all scripts, the output is logged to the /var/cluster/ha/log/script_hostname files. To check that the script has worked, use the tail command and execute the script as in the following example:
tail /var/cluster/ha/log/script_heb1 |
The following example shows the testing of the probe script:
/var/cluster/ha/resource_types/Oracle_DB/probe /tmp/ipfile /dev/null echo $? 0 tail /var/cluster/ha/log/script_cm1 Wed Oct 7 16:44:58.701 <ha_cilog script 20709:0> /var/cluster/ha/resource_types/Oracle_DB/probe[24983]: /var/cluster/ha/resource_types/Oracle_DB/probe called with /tmp/ipfile and /dev/null |
You can test the failover policy by using either cmgr or the GUI to move the resource group to another node in the cluster. To ensure that the resource group correctly failed over, use cmgr or the GUI to display the resource group states. The following example uses cmgr to test the failover policy:
cmgr> admin offline resource_group oracle in cluster eagan Resource group is changing state -- please wait cmgr> admin move resource_group oracle in cluster eagan to node cm2 Resource group is changing state -- please wait cmgr> admin online resource_group oracle in cluster eagan Resource group is changing state -- please wait |