- 论坛徽章:
- 0
|
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_${SID_NAME} ora_dbw0_${SID_NAME} ora_ckpt_${SID_NAME} ora_smon_${SID_NAME} ora_lgwr_${SID_NAME} ora_reco_${SID_NAME}
HOST=`hostname`
DATE=`date`
PATH=${ORACLE_HOME}/bin:/sbin:/usr/bin:/usr/sbin:/etc:/bin
export ORACLE_SID=${SID_NAME}
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 ${MONITOR_PROCESSES[@]}
do
MONITOR_PROCESSES_PID[$n]=`ps -fu oracle | awk '/'${i}$'/ { print $2 }'` #JAGad06432
print "Monitored process = ${i}, pid = ${MONITOR_PROCESSES_PID[$n]}"
if [[ ${MONITOR_PROCESSES_PID[$n]} = "" ]]
then
print "nn"
ps -ef
print "n *** ${i} has failed at startup time. Aborting Oracle. ***"
set -m
nohup ${0} fault & # The script calls itself with the fault option.
set +m
sleep 999999
fi
(( n = n + 1 ))
done
sleep ${MONITOR_INTERVAL}
while true
do
for i in ${MONITOR_PROCESSES_PID[@]}
do
kill -s 0 ${i} > /dev/null
if [[ $? != 0 ]]
then
print "nn"
ps -ef
print "n *** ${i} has failed. Aborting Oracle. ***"
set -m
nohup ${0} fault & # The script calls itself with the fault option.
set +m
sleep 999999
fi
done
sleep ${MONITOR_INTERVAL}
done
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/3236/showart_9315.html |
|