Automate restart Grid control

Hi all,

I'm trying to write a batch program to automate restart of grid control.

oraclehomes\db10g\bin\lsnrctl status >> %filename%
oraclehomes\oms10g\bin\emctl status oms >> %filename%
(This is just for testing.)

However, i cannot seem to let both of the line to execute as the batch stopped when line 1 finish executing (without executing line 2).

Any help is appreciated. Thanks.

Within the batch script, try preceding each of the two commands with "call " which will cause them to execute in their own batch shell, preventing the first job from exiting the whole batch job. (Not tested with your commands).

To read the help text about "call". From a "cmd" prompt:

call /?

Thanks man, it works.:b:

Is there anyway i can catch the status of my shutdown process?
e.g. lsnrctl stop will return the status telling it shutdown successfully?

The "No longer listening on" messages will be in the Oracle listener log. Provided that you start a new log each time you start the Oracle listener, you can extract the messages with a MSDOS "find" command.

Not tried with your commands but you could try testing ERRORLEVEL immediately after executing the command, though I think that each command with the test for ERRORLEVEL would have to be in its own batch file executed from a call statement. We don't want to test the result of "call" itself.
ERRORLEVEL is explained in the help text for "if".

if /?

You'll have to check Oracle documentation for the ERRORLEVEL values from Oracle commmands.