Quote:
|
Originally Posted by aya_r
I'm writting a shell script and at the begining I login to sqlplus by
sqlplus -l user_name/password@instance
what I would like is to check if the database is down or not , and if the database has started moved to the next step else sleep for a certain time and then check again .
I know how to do the sleep part, but I don't know how to check if the database is not down.
[...]
|
For quick and "dirty" check you can use something like this:
Code:
oracheck ()
{
printf "whenever sqlerror exit failure\nselect null from dual;\n" |
sqlplus -sl user/pass 2>&- 1>&- || return 1
}
Usage:
until oracheck; do sleep n; done
go_to_the_next_step