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 (See ORA-121.ora-code.com)|ORA-01034 (See ORA-01034.ora-code.com)' /tmp/$$.1 > /dev/null if [[ $? = 0 ]] then echo "-- --> '$DB' is _NOT_ accessible\n" else grep 'ORA-01017 (See ORA-01017.ora-code.com)' /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
--- Gene Sais <Gsais@(protected)> wrote: > I prefer to do the check outside the db from a ksh script. It's not going to help when > the db doing the check is down :). > >>> "Mercadante, Thomas F (LABOR)" <thomas.mercadante@(protected)> 04 /26/05 9:24 > AM >>> > This is an even easier approach if all his queries go through stored procs > as you mentioned. >
< 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