How to execute a save command in background from a batch file

  • Thread starter Thread starter Jo-Anne
  • Start date Start date
J

Jo-Anne

Guest
I have created a .bat file to perform a cold backup of our oracle data. The
script:
a. shuts down the instance
b. runs the save command
c. starts the instance.
I would like to run the save command in background and then loop through a
specified wait period. If the save command completes within the wait period
then the start instance step is run and the job completes successfully. If
the save command does not complete within the wait period then the start
instance step is run and the job completes with error.

I have tried the following 2 commands:
1. CMD /c %BACKUP_DIR%\networker_save.cmd "servername" "pool" "file
directory*" "%SAVELOG_FILE%" >> %SAVECMD_FILE%
2. call "CMD /c %BACKUP_DIR%\networker_save.cmd "servername" "pool" "file
directory*" "%SAVELOG_FILE%" >> %SAVECMD_FILE%"

Both work but not in background. The script does not continue until the
save command has completed.

In Unix, commands can be run in background using & after the command. Is
there something similar that can be used in a .bat file?

Thanks!

PS. I'm not sure if I have put this in the correct discussion group.
Please correct me if I'm wrong.
 
Batch files don't support running applications in the background, so far as
I'm aware. One possibility is to switch to PowerShell v2 which lets you do
this. Another is using the Subsystem for UNIX Applications and your familiar
Korn Shell. (SUA on 64-bit requires Server 2003 R2 or later, or Vista/Win7
Enterprise/Ultimate.)

--
Charlie.
http:/msmvps.com/blogs/xperts64


"Jo-Anne" wrote in message
news:766AD5E4-A8CB-4BF2-B339-79FDC8228A94@microsoft.com...
>I have created a .bat file to perform a cold backup of our oracle data.
>The
> script:
> a. shuts down the instance
> b. runs the save command
> c. starts the instance.
> I would like to run the save command in background and then loop through a
> specified wait period. If the save command completes within the wait
> period
> then the start instance step is run and the job completes successfully.
> If
> the save command does not complete within the wait period then the start
> instance step is run and the job completes with error.
>
> I have tried the following 2 commands:
> 1. CMD /c %BACKUP_DIR%networker_save.cmd "servername" "pool" "file
> directory*" "%SAVELOG_FILE%" >> %SAVECMD_FILE%
> 2. call "CMD /c %BACKUP_DIR%networker_save.cmd "servername" "pool" "file
> directory*" "%SAVELOG_FILE%" >> %SAVECMD_FILE%"
>
> Both work but not in background. The script does not continue until the
> save command has completed.
>
> In Unix, commands can be run in background using & after the command. Is
> there something similar that can be used in a .bat file?
>
> Thanks!
>
> PS. I'm not sure if I have put this in the correct discussion group.
> Please correct me if I'm wrong.
 
Back
Top