Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Checking if remote database is up -
I love that script. Neat and concise. You automatically get a listener check
and last week it caught max sessions exceeded because of some wayward code.
Mike
----- Original Message -----
From: "Kirtikumar Deshpande" <kedeshpande_at_yahoo.com>
To: <oracle-l_at_freelists.org>
Sent: Tuesday, April 26, 2005 10:00 AM
Subject: RE: Checking if remote database is up
> I have used following script for the past several years.. And has worked
well in our
> environment. The script attempts to connect to the remote database using a
non-existent
> user/pw, and deals with generated ORA errors...
>
> #!/usr/bin/ksh
> #
> # dbcheck : Script to check if database is up and accessible
> #
> # Author : Kirti Deshpande
> #
> #
>
> echo "Enter Name of the Database SID to check if it is accessible"
> read DB
>
> sqlplus -s << EOF > /tmp/$$.1
> whenever sqlerror exit
> aaa/aaa@$DB
> exit;
> EOF
> egrep 'ORA-121|ORA-01034' /tmp/$$.1 > /dev/null
> if [[ $? = 0 ]]
> then
> echo "-----> '$DB' is _NOT_ accessible\n"
> else
> grep 'ORA-01017' /tmp/$$.1 > /dev/null
> if [[ $? = 0 ]]
> then
> echo "-----> '$DB' is UP and Accessible\n"
> else
> echo "-----> '$DB' is _NOT_ accessible\n"
> fi
> fi
> #-- End of file
>
> Cheers!
>
> - Kirti
>
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Apr 26 2005 - 10:31:01 CDT
![]() |
![]() |