Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: continuously check whether Db is up
pradeepj_at_delhi.tcs.co.in wrote:
>
> Hi! In my application which I am writing in 'C' and pro*C, I want to
> continuously check whether an instance of oracle database is up or not. This
> I can do by connecting to the database(using EXEC SQL CONNECT)after certain
> fixed interval of time but this seems to me very time consuming method.
>
> is there any other way like what tns ping would be doing internally.
>
> I do not want to use tnsping in my program as it is shell command.
>
> thanks in advance
>
> -pradeep
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Why not just recover from the database "not" being there...
Your C app continues on its merry way until an SQL statement gives a shutdown in progress error (ie you could trap for errors:
ORA-01089: immediate shutdown in progress - operations are permitted
or
ORA-03114: not connected to ORACLE
If you pgm needs to be "recoverable", at this point you enter the
loop until some threshold
try reconnect
if ok then exit loop
wait 30 seconds
end loop
HTH --