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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Checking if remote database is up

RE: Checking if remote database is up

From: Kirtikumar Deshpande <kedeshpande_at_yahoo.com>
Date: Tue, 26 Apr 2005 07:00:59 -0700 (PDT)
Message-ID: <20050426140059.76846.qmail@web50103.mail.yahoo.com>


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!

< snip>



Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Apr 26 2005 - 10:05:22 CDT

Original text of this message

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