Batch script to test if Oracle instance is up on windows 2003
635106Nov 3 2008 — edited Nov 3 2008I create the batch job from command line to test the oracle 10g, if the instance is up return oracle_sid is ready, this is running on windows 2003, test.bat
=======================================
@echo off
set ORACLE_SID=TESTDB
echo sqlplus DBAUSER/PASSWORD@%ORACLE_SID% > 1.sql
echo set echo off feed off pages 0 >> 1.sql
echo whenever sqlerror exit sql.sqlcode >> 1.sql
echo select * from global_name; >> 1.sql
echo exit; >> 1.sql
sqlplus -s /nolog @1.sql >NUL:
IF {%ERRORLEVEL%} == {0} (
echo %ORACLE_SID% is ready
)else(
echo %ORACLE_SID% is not ready.
)
echo End of script
=======================================
But it seems always display both lines oracle_sid is ready and not ready, do you know how to fix it?