Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Batch script to test if Oracle instance is up on windows 2003

635106Nov 3 2008 — edited Nov 3 2008
I 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2008
Added on Nov 3 2008
1 comment
2,742 views