Home » Infrastructure » Unix » How to determine if Database is down etc
How to determine if Database is down etc [message #367092] Wed, 15 November 2000 10:56 Go to next message
Sivan
Messages: 4
Registered: November 2000
Junior Member
I am writing a shell script in which I do a lot of Database processing. I connect thru sqlplus and then either run the sql or execute the procedure. I want to find out if the sqlplus failed because of some oracle problem (like database down etc.) How do I find out that case and I want that in that case it should retry the same command and after 5 tries it should page the Administrator about the problem.
Re: How to determine if Database is down etc [message #367098 is a reply to message #367092] Thu, 16 November 2000 14:07 Go to previous messageGo to next message
Sivan
Messages: 4
Registered: November 2000
Junior Member
Thanks for the same. Actually I am calling sqlplus in my shell scripts

DUMMYDATE=`sqlplus -s ${ORACLE_USER} <<end
set pagesize 0 feedback off ver off heading off echo off
select to_char(to_date('$DATE','YYYYMMDD'),'DD-MON-YYYY') from dual;
exit;
end`

and I want to know that the sqlplus is not failing because of any database related problems and if it fails I want to page myself. How to ensure this?
Re: How to determine if Database is down etc [message #367104 is a reply to message #367092] Tue, 28 November 2000 12:21 Go to previous message
Sanjay
Messages: 236
Registered: July 2000
Senior Member
I was just writting a script this morning and this is what I did. This is for Oracle 8/8i (never tried this on Oracle7 so cannot say). I am using Korn shell.

RSP=$( ps -ef | grep ora_ | grep $ORACLE_SID | wc -l )
if [[ $RSP -lt 6 ]]
then
# instance must be hosed
echo " ERROR: Database instance $ORACLE_SID is either down or does not exist."
exit 1
fi
Previous Topic: Database creation on Unix box.
Next Topic: RMAN on NT target db and catalog on UNIX
Goto Forum:
  


Current Time: Fri Mar 29 09:46:05 CDT 2024