Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Is Database Up?

Re: Is Database Up?

From: Radoulov, Dimitre <dradoulov_at__gmail.com>
Date: Tue, 29 Aug 2006 14:15:40 +0200
Message-ID: <44f43028$0$75029$14726298@news.sunsite.dk>

"rob" <rob_at_dsdelft.nl> wrote in message news:57237$44f4237d$82a1e120$27943_at_news1.tudelft.nl...
> Radoulov, Dimitre wrote:
>>>I want to write a Unix shell script that will check to see if a
>>>database, on a remote machine, is up. Is this possible without writing
>>>some long telnet routine or something?
>>>
>>>I was hoping for some simple command that I can grep for some string to
>>>tell me the status of the remote database........
>>
>>
>> No need to grep:
>>
>> printf "%s\n%s\n" "whenever sqlerror exit failure" "select null from
>> dual;"|sqlplus -L user/pass_at_service_name >/dev/null 2>&1||echo "Database
>> NOT accessible\!"
>>
>>
>> Regards
>> Dimitre
>
> Dimitre,
>
> One small remark : this exposes un/pw in ps -ef. It may not be an issue
> for dedicated database servers but the fix is so easy why not use it?
>
> session1#printf "%s\n%s\n" "whenever sqlerror exit failure" "select null
> from dual;"|sqlplus -L user/pass_at_service_name >/dev/null 2>&1||echo
> "Database NOT accessible\!"
>
> session2#ps -ef|grep sqlplus
> oracle 4724 29668 1 13:01:31 pts/2 0:01 sqlplus -L
> user/pass_at_service_name
>
> Instead use:
> session1#printf "%s\n%s\n" "connect user/pass_at_service_name" "whenever
> sqlerror exit failure" "select null from dual;"|sqlplus /nolog
> >/dev/null 2>&1||echo "Database NOT accessible\!"
>
> session2#ps -ef|grep sqlplus
> oracle 4815 29668 1 13:02:32 pts/2 0:01 sqlplus /nolog

Agreed.
Abriviated version:

printf 'user/pass_at_service_name\n whenever sqlerror exit failure\n select null from dual;\n'|sqlplus >/dev/null 2>&1||printf 'Database NOT accessible!\n'

Regards
Dimitre Received on Tue Aug 29 2006 - 07:15:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US