HA Monitor Kit for Oracle Description and User's Guide

[Contents][Index][Back][Next]

3.3 Environment definition example

This section describes an example of environmental definition for a system that uses HA Monitor Kit. This example uses the system configuration shown in the following figure in which an Oracle instance and an Oracle listener are monitored by a single server.

Figure 3-11 System configuration in which an Oracle instance and an Oracle listener are monitored by a single server

[Figure]

#1: The following directory paths are used in the environment definition example:

#2: This is the interval at which the server monitoring command performs monitoring.

An environment definition example for this system configuration follows:

/etc/hosts file
192.168.100.1  server1    # alias IP address

Oracle local naming parameter file (definition file: tnsnames.ora):
ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = SHARED)
      (SERVICE_NAME = orcl1)
    )
  )

Oracle instance control definition file (definition file: /opt/hitachi/HAmon/etc/HAmonOra_etc/instance/orcl1.env):
ORACLE_SID=orcl1
ORACLE_BASE=/home/oracle
ORACLE_HOME=/home/oracle/product/10.2.0/db_1
ORACLE_USER=oracle
PATROL=120
ABORT_LIMIT=180

Oracle listener control definition file (definition file: /opt/hitachi/HAmon/etc/HAmonOra_etc/listener/LISTENER.env):
LISTENER_NAME=LISTENER
ORACLE_BASE=/home/oracle
ORACLE_HOME=/home/oracle/product/10.2.0/db_1
ORACLE_USER=oracle
PATROL=120
ABORT_LIMIT=180

LAN status setting file
server-alias-name.up (definition file: /opt/hitachi/HAmon/etc/orasrv.up):
#!/bin/sh
set -x
 
INTERFACE=eth0:1                    # LAN interface name
IPADDR=192.168.100.1                # alias IP address
NETMASK=255.255.255.0               # netmask address
BROADCAST=192.168.100.255           # broadcast address
RETRYCNT=2                          # retry count
 
# Retry for the alias IP address adding.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is added to the LAN interface.
    /sbin/ifconfig $INTERFACE inet $IPADDR netmask $NETMASK broadcast $BROADCAST
 
    # The information on old routing cache is deleted.
    /bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
    # The ARP caches are updated.
    IFNAME=`echo $INTERFACE | /bin/sed -e 's/:[0-9]*$//'`
    /sbin/arping -U -c 2 -I $IFNAME $IPADDR
 
    # Was the alias IP address registered to the system ?
    RCD=`/sbin/ifconfig -a | /bin/grep ":$IPADDR "`
    if [ "$RCD" = "" ]
    then
        # When it is not registered, "1" is returned as the termination code.
        exitcode=1
 
        loopcnt=`/usr/bin/expr $loopcnt + 1`
    else
        # When it is registered, "0" is returned as the termination code.
        exitcode=0
 
        break
    fi
done
 
exit $exitcode
server-alias-name.down (definition file: /opt/hitachi/HAmon/etc/orasrv.down):
#!/bin/sh
set -x
 
INTERFACE=eth0:1                    # LAN interface name
RETRYCNT=1                          # retry count
 
# Retry for the alias IP address delete.
exitcode=1
loopcnt=0
while [ $loopcnt -lt $RETRYCNT ]
do
    # The alias IP address is deleted from the LAN interface.
    /sbin/ifconfig $INTERFACE down
 
    # Was the alias IP address deleted from the system ?
    RCD=`/sbin/ifconfig -a | /bin/grep "$INTERFACE "`
    if [ "$RCD" = "" ]
    then
        # When it is deleted, "0" is returned as the termination code.
        exitcode=0
        break
    else
        # When it is not deleted, "1" is returned as the termination code.
        exitcode=1
        loopcnt=`/usr/bin/expr $loopcnt + 1`
        sleep 1
    fi
done
 
# The information on old routing cache is deleted.
/bin/echo 0 > /proc/sys/net/ipv4/route/flush
 
exit $exitcode

Server environment definition (definition file: /opt/hitachi/HAmon/etc/servers):
 
/*  Server environment definition  */
server  name         /opt/hitachi/HAmon/etc/orasrv/actcommand_orasrv,
   alias           orasrv,
   acttype         monitor,
   initial         online#,
   termcommand     /opt/hitachi/HAmon/etc/orasrv/termcommand_orasrv,
   patrolcommand   /opt/hitachi/HAmon/etc/orasrv/patrol_orasrv.sh,
   disk            /dev/vg01,
   fs_name         /dev/vg01/lvol1,
   fs_mount_dir    /ora_mnt,
   lan_updown      use,
   waitserv_exec   yes,
   servexec_retry  0,
   start_timeout   180;
#: For a secondary system, change this value to standby.

Server start command:
#! /bin/sh
####################################################################
LOGNAME=orasrv
LOGSIZE=1048576
####################################################################
act_proc(){
        RT_CD=0
        # Listener
        haoralsnrbgn LISTENER
 
        # Instance
        haorainsbgn orcl1
 
        return ${RT_CD}
}
####################################################################
 : (omitted)

Server termination command:
#! /bin/sh
####################################################################
LOGNAME=orasrv
LOGSIZE=1048576
####################################################################
term_proc(){
        RT_CD=0
        case "$1" in
        "-e" )                           # normal end
                # Instance
                haorainsend orcl1
                if [ "$?" != "0" ]
                then
                        RT_CD=1
                fi
 
                # Listener
                haoralsnrend LISTENER
                if [ "$?" != "0" ]
                then
                        RT_CD=2
                fi
                ;;
        "-w" )                        # monswap
                # Instance
                haorainsend orcl1
                if [ "$?" != "0" ]
                then
                        RT_CD=1
                fi
 
                # Listener
                haoralsnrend LISTENER
                if [ "$?" != "0" ]
                then
                        RT_CD=2
                fi
                ;;
        "-c" )                        # down
                # Instance
                haorainsend orcl1
 
                # Listener
                haoralsnrend LISTENER
                ;;
        esac
        return ${RT_CD}
}
####################################################################
 : (omitted)

Server monitoring command:
#! /bin/sh
####################################################################
LOGNAME=orasrv
LOGSIZE=1048576
PATROL_INTERVAL=5
####################################################################
patrol_proc(){
        # Instance
        haorainsptl orcl1
        if [ "$?" != "0" ]
        then
                return 1
        fi
 
        # Listener
        haoralsnrptl LISTENER
        if [ "$?" != "0" ]
        then
                return 2
        fi
 
        return 0
}
####################################################################
 : (omitted)

Server monitoring command runtime shell:
#! /bin/sh
####################################################################
ORACLE_USER=oracle
PATROL_SHELL=/opt/hitachi/HAmon/etc/patrolcommand_orasrv
####################################################################
 : (omitted)