We need a Script which can execute multiple sql scripts in sqlplus

Hello,

We need a script which can execute multiple sql scripts in sequential order. The script should go and execute the script1.sql first and wait for this to complete and then execute the second sql script. we created a bat file for this task, but unfortunately the .bat file is not waiting for the task to complete. It is executing all the task simultaneously. I have given the bat file below. Can anyone help on this ?

"@echo off
echo This program loads Data from SQL1 and SQL2 to ORACLE3
echo.
set WRKDIR=D:\Script\Test
rem
echo Test Running SQLPLUS
set ORACLE_SID=ORACLE3
start /wait /b D:\oracle\product\11.2.0\client_1\BIN\sqlplus userid/password@SID @%WRKDIR%\Script1.sql
rem
rem Clear ORA Tables
rem start /wait /b D:\oracle\product\11.2.0\client_1\BIN\sqlplus userid/password@SID @%WRKDIR%\Script2.sql > Script2.txt
rem
echo Cleaning up Oracle staging data
rem start /wait /b D:\oracle\product\11.2.0\client_1\BIN\sqlplus userid/password@SID @%WRKDIR%\Script3.sql
rem
echo Data load has completed. 
exit "

  • Moved by Bill_Stewart Monday, October 27, 2014 10:08 PM Unanswerable drive-by question
August 21st, 2014 11:31am

START /wait - waits for the program to finish.

Most of your lines are commented out.  Remove the REM statements.

I would create a single SQL script that calls the other three.  Do not use a batch file in  this case.

Free Windows Admin Tool Kit Click here and download it now
August 21st, 2014 11:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics