oracle双机监控脚本

发表于:2007-05-26来源:作者:点击数: 标签:
ORA_ver=9_0_1 SID_NAME= ORACLE_HOME= LISTENER= LISTENER_NAME= LISTENER_PASS= MONITOR_INTERVAL=30 PACKAGE_NAME= TIME_OUT=30 set -A MONITOR_PROCESSES ora_pmon_$ ora_dbw0_$ ora_ckpt_$ ora_smon_$ ora_lgwr_$ ora_reco_$ HOST=`hostname` DATE=`dat

ORA_ver=9_0_1
SID_NAME=
ORACLE_HOME=
LISTENER=          
LISTENER_NAME=
LISTENER_PASS=
MONITOR_INTERVAL=30
PACKAGE_NAME=
TIME_OUT=30
set -A MONITOR_PROCESSES ora_pmon_$ ora_dbw0_$ ora_ckpt_$  ora_smon_$ ora_lgwr_$ ora_reco_$

HOST=`hostname`
DATE=`date`
PATH=$/bin:/sbin:/usr/bin:/usr/sbin:/etc:/bin
export ORACLE_SID=$
export ORACLE_HOME

###############################################################################
# Function: monitor_processes
#
# Monitor the Oracle processes by making sure that all required processes are
# running.
##############################################################################

function monitor_processes
{
    typeset -i n=0

    for i in $
    do
 MONITOR_PROCESSES_PID[$n]=`ps -fu oracle | awk '/'$$'/ { print }'` #JAGad06432
        print "Monitored process = $, pid = $"
        if [[ $ = "" ]]
        then
            print "nn"
            ps -ef
            print "n *** $ has failed at startup time.  Aborting Oracle. ***"
            set -m
            nohup fault &    # The script calls itself with the fault option.
            set +m
     sleep 999999
        fi
        (( n = n + 1 ))
    done

    sleep $

    while true
    do
        for i in $
        do
            kill -s 0 $ > /dev/null
            if [[ $? != 0 ]]
            then
                print "nn"
                ps -ef
                print "n *** $ has failed.  Aborting Oracle. ***"
                set -m
                nohup fault &    # The script calls itself with the fault option.
                set +m
         sleep 999999
            fi
        done
        sleep $
    done
}

原文转自:http://www.ltesting.net