This chapter contains instructions for configuring Red Hat Enterprise Linux to make database services highly available.
Note | |
---|---|
The following descriptions present example database configuration instructions. Be aware that differences may exist in newer versions of each database product. Consequently, this information may not be directly applicable. |
A database service can serve highly-available data to a database application. The application can then provide network access to database client systems, such as Web servers. If the service fails over, the application accesses the shared database data through the new cluster system. A network-accessible database service is usually assigned an IP address, which is failed over along with the service to maintain transparent access for clients.
This section provides an example of setting up a cluster service for an Oracle database. Although the variables used in the service scripts depend on the specific Oracle configuration, the example may aid in setting up a service for individual environments. Refer to Section 5.2 Tuning Oracle Service for information about improving service performance.
In the example that follows:
The service includes one IP address for the Oracle clients to use.
The service has two mounted file systems, one for the Oracle software (/u01/) and the other for the Oracle database (/u02/), which are set up before the service is added.
An Oracle administration account with the name oracle is created on the cluster systems that run the service before the service are actually added.
The administration directory is on a shared disk that is used in conjunction with the Oracle service (for example, /u01/app/oracle/admin/db1).
Create a consistent user/group configuration that can properly access Oracle service for each cluster system. For example:
mkdir /users groupadd -g 900 dba groupadd -g 901 oinstall useradd -u 901 -g 901 -d /users/oracle -m oracle usermod -G 900 oracle |
The Oracle service example uses three scripts that must be placed in /users/oracle and owned by the Oracle administration account. The oracle script is used to start and stop the Oracle service. Specify this script when you add the service. This script calls the other Oracle example scripts. The startdb and stopdb scripts start and stop the database. Note that there are many ways for an application to interact with an Oracle database.
The following is an example of the oracle script, which is used to start, stop, and check the status of the Oracle service.
#!/bin/sh # # Cluster service script to start, stop, and check status of oracle # cd /users/oracle case $1 in start) su - oracle -c ./startdb ;; stop) su - oracle -c ./stopdb ;; status) status oracle ;; esac |
The following is an example of the startdb script, which is used to start the Oracle Database Server instance:
#!/bin/sh # # # Script to start the Oracle Database Server instance. # ######################################################################## # # ORACLE_RELEASE # # Specifies the Oracle product release. # ######################################################################## ORACLE_RELEASE=9.2.0 ######################################################################## # # ORACLE_SID # # Specifies the Oracle system identifier or "sid", which is the name of # the Oracle Server instance. # ######################################################################## export ORACLE_SID=TEST ######################################################################## # # ORACLE_BASE # # Specifies the directory at the top of the Oracle software product and # administrative file structure. # ######################################################################## export ORACLE_BASE=/u01/app/oracle ######################################################################## # # ORACLE_HOME # # Specifies the directory containing the software for a given release. # The Oracle recommended value is $ORACLE_BASE/product/<release> # ######################################################################## export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE} ######################################################################## # # LD_LIBRARY_PATH # # Required when using Oracle products that use shared libraries. # ######################################################################## export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH ######################################################################## # # PATH # # Verify that the users search path includes $ORACLE_HOME/bin # ######################################################################## export PATH=$PATH:${ORACLE_HOME}/bin ######################################################################## # # This does the actual work. # # Start the Oracle Server instance based on the initSID.ora # initialization parameters file specified. # ######################################################################## /u01/app/oracle/product/9.2.0/bin/sqlplus << EOF sys as sysdba spool /home/oracle/startdb.log startup pfile = /u01/app/oracle/product/9.2.0/admin/test/scripts/init.ora open; spool off quit; EOF exit |
The following is an example of the stopdb script, which is used to stop the Oracle Database Server instance:
#!/bin/sh # # # Script to STOP the Oracle Database Server instance. # ###################################################################### # # ORACLE_RELEASE # # Specifies the Oracle product release. # ###################################################################### ORACLE_RELEASE=9.2.0 ###################################################################### # # ORACLE_SID # # Specifies the Oracle system identifier or "sid", which is the name # of the Oracle Server instance. # ###################################################################### export ORACLE_SID=TEST ###################################################################### # # ORACLE_BASE # # Specifies the directory at the top of the Oracle software product # and administrative file structure. # ###################################################################### export ORACLE_BASE=/u01/app/oracle ###################################################################### # # ORACLE_HOME # # Specifies the directory containing the software for a given release. # The Oracle recommended value is $ORACLE_BASE/product/<release> # ###################################################################### export ORACLE_HOME=/u01/app/oracle/product/${ORACLE_RELEASE} ###################################################################### # # LD_LIBRARY_PATH # # Required when using Oracle products that use shared libraries. # ###################################################################### export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:$LD_LIBRARY_PATH ###################################################################### # # PATH # # Verify that the users search path includes $ORACLE_HOME/bin # ###################################################################### export PATH=$PATH:${ORACLE_HOME}/bin ###################################################################### # # This does the actual work. # # STOP the Oracle Server instance in a tidy fashion. # ###################################################################### /u01/app/oracle/product/9.2.0/bin/sqlplus << EOF sys as sysdba spool /home/oracle/stopdb.log shutdown abort; spool off quit; EOF exit |
To add an Oracle service using the Cluster Configuration Tool, perform the following:
Start the Cluster Configuration Tool by choosing Main Menu => System Settings => Server Settings => Cluster or by typing redhat-config-cluster at a shell prompt. The Cluster Status Tool appears by default.
Start the Cluster Configuration Tool by selecting Cluster => Configure from the Cluster Status Tool menus.
Click the Services tab.
Add the Oracle service.
Click New. The Service dialog appears.
Enter a Service Name for the Oracle service.
Select a Failover Domain or leave it as None.
Type a quantity (seconds) to check the health of the Oracle service through the status function of the init script.
Enter a User Script, such as /home/oracle/oracle.
Click OK
Add an IP address for the Oracle service.
Select the Oracle service and click Add Child.
Select Add Service IP Address and click OK. The Service IP Address dialog appears.
Enter an IP Address.
Enter a Netmask, or leave it None.
Enter a Broadcast Address, or leave it None.
Click OK.
Add a device for the Oracle service and administrative files.
Select the Oracle service and click Add Child.
Select Add Device and click OK. The Device dialog appears.
Enter the Device Special File (for example, /dev/sdb5).
In the Mount Point field, enter /u01.
Select the file system type in FS Type or leave it blank.
Enter any mount point Options, including rw (read-write).
Check or uncheck Force Unmount.
Click OK.
Add a device for the Oracle database files.
Select the Oracle service and click Add Child.
Select Add Device and click OK. The Device dialog appears.
Enter the Device Special File (for example, /dev/sdb6).
In the Mount Point field, enter /u02.
Select the file system type in FS Type or leave it blank.
Enter any mount point Options, including rw (read-write).
Check or uncheck Force Unmount.
Click OK.
Choose File => Save to save the Oracle service.