Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need Script to check if database is up or down
try this:
create a dummy Oracle account with basic privs. create a shell script oraUp and a shell script checkOracle
oraUp:
ORACLE_SID=<SID>; export ORACLE_SID
ORACLE_HOME<ORAHOME>; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin; export PATH
checkOracle > oraUp.txt
grep ORA-01034 oraUp.txt > /dev/null
if [[ "$?" -eq 0 ]]
then echo "Database is down." else echo "Database is up."
checkOracle:
sqlplus -s testuser/testpass <<EOF
EOF
In article <8dfo63$t7n$1_at_news.duke.edu>,
"John Jones" <john.jones_at_duke.edu> wrote:
> Need immediate help from Unix System Guru's. I need a script that
checks if
> the database is up or down. I DON'T need a script that checks for the
> existance of background processes.
>
> Here is my problem. I rebuild a reporting database nightly, I copy
over the
> datafiles, do a startup nomount (which starts the background
processes),
> then recreate the control file and start the database. Well if
something
> goes wrong on the control file or starting the database, the database
will
> not open, but the background processes are there. I tried writing a
script
> that uses SQL*Plus to connect, but if the database is not there my
script
> stops and prompts for another database connection, it will prompt
three (3)
> times.
>
> Need help, please respond to john.jones_at_duke.edu if you have a
solution.
>
> --
> John Jones
> Senior Oracle DBA
> Duke University OIT
> john.jones_at_duke.edu
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Apr 17 2000 - 00:00:00 CDT