Check Oracle Service is Started from Batch Command Uses: Oracle9i Standard Ed;

I have a schedule which performs a Dump Import and afterwards the System Reboots itself, which is happening without any problem. 

After the System had rebooted, I have another task scheduled to run on System Startup; which has yet another PLSQL scripts to be run.

I witnessed after the Schedule task on System Start-up had ran, an error is thrown as 

TNS: protocol adapter error

The cause was determined as The oracle Services had not Started. 

So if I could check the Oracle Services has started or not prior to the query, I would solve the problem.

Or else I could use SLEEP Command in the batch file, but cant determine the exact time it takes to startup the server. 

I welcome any suggestions on doing this with an alternate way as well.

Below is the Script file I run on System Start-up

@echo off
@echo %time%
echo Disable Triggers
sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#4.sql&lt;quit.txt
@echo %time%
echo Run Drop Contraints Sql
sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#5x.sql&lt;quit.txt

REM File Check
IF EXIST C:\Factory\participant-inclusion\Auto\step#5.sql (
 @echo %time%
 echo Run Drop Contraints
 sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#5.sql&lt;quit.txt
 @echo %time%
 echo Modify Type
 sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#6.sql&lt;quit.txt
) ELSE (
 @echo File Not Found
)

@echo %time%
echo Default Prefix
sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\Prefix-Updation-ALL-JKB.sql&lt;quit.txt
@echo %time%
echo And Finally Done!
pause


Many Thanks,
You can actually start that service, while you are waiting on it to start in another session. Even if both starts occur at the same time, Windows should be able to handle that correctly, and end with the service being up. Or, you sleep. What time ? Put something, and test. Ain't that hard, no ?