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