# Automate restart Grid control

**URL:** <https://community.unix.com/t/automate-restart-grid-control/252800>\
**Category:** Microsoft Windows\
**Created:** [November 4, 2009, 4:50am UTC](https://community.unix.com/t/automate-restart-grid-control/252800 "2009-11-04T04:50:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beginningDBA](https://community.unix.com/letter_avatar/beginningdba/32/5_5575768a8748004e209b776fc1b2916d.png) [@beginningDBA](https://community.unix.com/u/beginningDBA)\
**Post date:** [November 4, 2009, 4:50am UTC](https://community.unix.com/t/automate-restart-grid-control/252800/1 "2009-11-04T04:50:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![methyl](https://community.unix.com/letter_avatar/methyl/32/5_5575768a8748004e209b776fc1b2916d.png) [@methyl](https://community.unix.com/u/methyl)\
**Post date:** [November 4, 2009, 8:22am UTC](https://community.unix.com/t/automate-restart-grid-control/252800/2 "2009-11-04T08:22:55Z")

</div>

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:

```nohighlight
call /?

```

---

<div class="post-metadata">

**Author:** ![beginningDBA](https://community.unix.com/letter_avatar/beginningdba/32/5_5575768a8748004e209b776fc1b2916d.png) [@beginningDBA](https://community.unix.com/u/beginningDBA)\
**Post date:** [November 4, 2009, 8:14pm UTC](https://community.unix.com/t/automate-restart-grid-control/252800/3 "2009-11-04T20:14:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![methyl](https://community.unix.com/letter_avatar/methyl/32/5_5575768a8748004e209b776fc1b2916d.png) [@methyl](https://community.unix.com/u/methyl)\
**Post date:** [November 6, 2009, 8:27am UTC](https://community.unix.com/t/automate-restart-grid-control/252800/4 "2009-11-06T08:27:31Z")

</div>

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".

```nohighlight
if /?

```

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