Home » RDBMS Server » Server Administration » to check if database is up and running from command prompt
to check if database is up and running from command prompt [message #128970] Thu, 21 July 2005 07:16
subusona
Messages: 70
Registered: March 2005
Location: delhi
Member
Kindly help, the script given at this site is not working.

the script goes like this at http://www.orafaq.com/scripts/win/isdbup.txt

rem  -- Create SQL Script ---
echo connect sys/orcl as sysdba;         > %0.tmp
echo set echo off feed off pages 0      >> %0.tmp
echo whenever sqlerror exit sql.sqlcode >> %0.tmp
echo select * from global_name;         >> %0.tmp
echo exit;                              >> %0.tmp

rem -- Test connect to database ---
sqlplus -s /nolog @%0.tmp >NUL:

if {%ERRORLEVEL%} == {0} (
   echo Database %ORACLE_SID% is available
) else (
   echo Database %ORACLE_SID% is NOT available
)

rem -- Cleanup -- 
del %0.tmp


Here {%ERRORLEVEL%} == {0} is always 0. I checked with other database that was down, still it is giving
{%ERRORLEVEL%} = 0

Then how should I capture the error? Errorlevel is not helping me.

Thanks in advance

subu

Previous Topic: can't create dictionary managed tablespace
Next Topic: PK or no PK
Goto Forum:
  


Current Time: Sat Jan 25 06:43:48 CST 2025