I have a batch file that executes a .sql file to backup a database. I put my batch file into startup folder to backup database when computer turns on. But Oracle server is not started when this batch file trying to run. So I can’t backup database.
So I want to check whether Oracle server is started or not using batch file. If Oracle server is started, then batch file runs the command to execute a .sql file to backup database. Else it should wait till Oracle server start. When Oracle server started, batch file should run the command to execute a .sql file to backup database.
How could I do this?
Assuming that your Oracle service is local, you can use
sc startIf the service is started, this command will return right away. Otherwise, it will wait for the service start-up to complete before returning.
If a service name contains spaces, enclose the name in double quotation marks
".