#!/usr/bin/ksh ########################################################################### # # File: getDBStatus # Author: Madhu Bhimavarapu # Created: Fri Oct 12 10:57:25 CDT 2001 # Purpose: This script returns the status of a given databas # 1 = Database is up, 0 = Database is down ########################################################################### # # If sga is defined for this ORACLE_SID then the database is # up and running. If it is not then exit gracefully. # if test -f ${ORACLE_HOME}/dbs/sgadef${ORACLE_SID}.dbf then STATUS='RUNNING' else STATUS='STOPPED' fi ps -ef|grep _${ORACLE_SID}\$|grep ora_>/dev/null if [ $? -eq 1 ] then #echo oracle ${ORACLE_SID} appears to be down and $STATUS echo 0 else uptime=`ps -ef|grep pmon_${ORACLE_SID}\$|grep -v grep|cut -c25-33` orausers=`ps -ef|grep oracle${ORACLE_SID}\ |grep -v 4096|grep -v grep|wc -l` #echo oracle ${ORACLE_SID} appears to be up since $uptime and $STATUS with $orausers sessions active echo 1 fi