#!/bin/sh # # $TOOLS/is_dbo # # Returns 0 if the $1 database is down, otherwise returns 1 # # Parameters: # $1 = (Required) ORACLE_SID to be accessed. # # Restrictions: # 1) define, fixcase, mktemp, mailto, and valid_db must exist and be found # in the PATH. # 2) The ORACLE_HOME environment variable must be defined. # 3) The PS_OPTS environment variable must be defined (usually by # $HOME/dbabatch). # 4) The following restrictions are from the define script: # a) $TOOLS/getsyi, $TOOLS/replpath, and $TOOLS/database must exist. # b) If Oracle Applications are being used, $APPL_TOP/$ENVNAME.env must # exist. # # <<<<<<<<<<<<<<<< MODIFICATION HISTORY >>>>>>>>>>>>>>>> # Date Programmer Description # 10/03/97 Brian Lomasky Add documentation. # if [ $# -eq 0 ]; then echo "Usage: is_dbo " exit 2 fi mysid=`fixcase $1` valid_db $mysid if [ $? -ne 0 ]; then exit 2 fi SID=$mysid . define ps $PS_OPTS | grep -v grep | grep ora_pmon_$mysid >/dev/null if [ $? -eq 0 ] # grep was successful in finding a background process then exit 1 else # Sanity check to see if database has crashed if [ -r $ORACLE_HOME/dbs/sgadef$mysid.dbf ] then mytemp=`mktemp` echo "\nWARNING: Even though $mysid is shut down," \ "there is STILL (!) an" > $mytemp echo " sgadef$mysid.dbf file existing in" \ "$ORACLE_HOME/dbs !\007\007\n" >> $mytemp echo " Do a SHUTDOWN ABORT, then a STARTUP" \ "NORMAL\n" >> $mytemp cat $mytemp mailto $mytemp "Error from is_dbo for $mysid" FILE rm $mytemp fi exit 0 fi