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

Discussion in 'Windows 64bit' started by Jo-Anne, Sep 17, 2009.

  1. Jo-Anne

    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.
     
    Jo-Anne, Sep 17, 2009
    #1
    1. Advertisements

  2. 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 Russel - MVP, Sep 18, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.