Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Is database up

Re: Is database up

From: Neil Cudd <neil_at_cudd.demon.co.uk>
Date: Wed, 20 Oct 1999 15:53:15 +0100
Message-ID: <940431348.17408.0.nnrp-07.c2de6f3d@news.demon.co.uk>


I had a similar script which would check for the existence of the instance processes (PMON, SMON etc) but this does not account for situations such as the archive log area filling up : this leads to a database hang (essentially unavailable) but the processes are still 'running'.

I would (and will) stay with doing a low level (ie not internal) connect and checking the output.

Neil.

Frederic DEBRUS wrote in message <01bf1b07$dc4cb980$3e35a99e_at_gal159a>...
>You can try to use the following :
>
>#!/bin/ksh
>#
># DEBRUS Frederic
># DBSTATUS.SH <Instance>
>#
>. /etc/profile
>. /opt/local/bin/oraprofile
>NAMESERVER=oranamesrvr1
>
>SendMsg()
>{
>echo $*
>}
>
>IsOracleProcessRunning()
>{
>ps -ef | egrep $INSTANCE | egrep $PROCESS > /dev/null 2>&1
>}
>
>IsNamesRunning()
>{
>ps -ef | egrep '/bin/names' | egrep -v 'grep' > /dev/null 2>&1
>}
>
>IsListenerRunning()
>{
>ps -ef | egrep '/bin/tnslsnr' | egrep -v 'grep' > /dev/null 2>&1
>}
>
>IsNamesResolving()
>{
>namesctl query $1 | grep normal > /dev/null
>}
>
>IsListenerUp()
>{
>lsnrctl status $1 > /dev/null
>}
>
># Main
>
>#
># check if names server is running
>#
>IsNamesRunning || SendMsg "Names Server - $NAMESERVER - DOWN"
>
>#
># check if listener is running
>#
>IsListenerRunning || SendMsg "Listener - DOWN"
>
>#
># check if all Oracle process are running
>#
>for INSTANCE in $*
>do
> DOWN=0
> for PROCESS in pmon dbwr lgwr smon
> do
> IsOracleProcessRunning || DOWN=1
> done
> [ $DOWN = 1 ] && SendMsg "Oracle Server - $INSTANCE - DOWN"
> #
> # check if names resolve address
> #
> IsNamesResolving $INSTANCE ||
> SendMsg "Names Server - $NAMESERVER - Oracle Instance - $INSTANCE -
>UNRESOLVED"
> #
> # check if listener is up
> #
> IsListenerUp $INSTANCE || SendMsg "Listener - $INSTANCE - DOWN"
>done
>
>
>Hope this help...
>
>Jim Gregory <JG200024_at_NCR.com> wrote in article
><380dbe7e_at_rpc1285.daytonoh.ncr.com>...
>> I'm trying to write a unix script to be run under cron that needs to
>> determine if a database instance is up on a remote box. This will run
>under
>> the oracle user with no root privs and rsh, rlogin, etc. is not
>available.
>>
>> So far the only way I've determined how to do this is to try and log into
>> the remote database via "sqlplus user/pass_at_servicename, and then pipe
>the
>> output to grep looking for oracle error ORA 01034 "Oracle not available".
>>
>> Any one have a better, cleaner solution?
>>
>> Thanks in Advance
>>
>> --
>> Jim Gregory
>> Principal Consultant for Keane, Inc.
>> Currently assigned to NCR
>> "Opinions are my own and do not reflect
>> those of Keane or my clients"
>>
>>
>>
Received on Wed Oct 20 1999 - 09:53:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US