Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> 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!
< snip>
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Apr 26 2005 - 10:05:22 CDT
![]() |
![]() |