1

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<quit.txt
@echo %time%
echo Run Drop Contraints Sql
sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#5x.sql<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<quit.txt
 @echo %time%
 echo Modify Type
 sqlplus  "myusername/mypassword" @C:\Factory\participant-inclusion\Auto\step#6.sql<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<quit.txt
@echo %time%
echo And Finally Done!
pause

Many Thanks,

4
  • just curious .. .why do you need to reboot the system after import?
    – Raj
    Commented Aug 22, 2014 at 12:11
  • @Raj Thinking behind that a Reboot result in any cache and temporary files be cleared. The reason being I'm having this server as UAT server with minimum storage. Just saving storage against growing tablespace.
    – hiFI
    Commented Aug 25, 2014 at 4:11
  • 1
    Why not just schedule a disk cleanup and avoid rebooting the whole server? That would eliminate the need to get the timing of all these tasks correct. It would be much easier to manage.
    – andba77
    Commented Sep 15, 2015 at 14:48
  • I'm sure you could write a simple powershell script to wait for the row in the Windows Event Log that says the Oracle service has started Commented Sep 6, 2016 at 9:23

1 Answer 1

-1

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 ?

1
  • 1
    Unfortunatelly the Windows Service responds with OK before the Database is Open.
    – eckes
    Commented Mar 28, 2018 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.