Re: shell scripting help

  • From: d cheng <dc4oracle@xxxxxxxxx>
  • To: Oracle-L@xxxxxxxxxxxxx
  • Date: Wed, 3 Aug 2005 15:10:05 -0700 (PDT)

Thank you all for responding with your suggestions.  The WAIT command worked!
 
I split my original single sql script into three sql scripts to parallelize my 
workload.

stephen booth <stephenbooth.uk@xxxxxxxxx> wrote:
On 03/08/05, d cheng wrote:
> << shell script snippet >> 
> ... 
> sqlplus un/pw @script1.sql & 
> sqlplus un/pw @script2.sql & 
> sqlplus un/pw @script3.sql & 
> ... 
> sqlplus un/pw @final.sql 
> ... 
> exit 
> 

Is there any particular reason you want to be running the initial
scripts in the background? If not then just lose the ampersands and
it should execute them in order, one at a time. This avoids the
problem of final.sql being run before the others have completed.

Alternatively at the start of each script (apart from final.sql) put
in a command to create a lock file (e.g. !touch script2.lock) and at
the end a command to delete those files. Then before the call to
final.sql put in a while loop that checks if those files exist and if
they do sleeps for a period before checking again. When none of those
files are present the loop quits and final.sql will be run. Maybe, to
reduce any load from the while loop, estimate how long you think it
will take the scripts to run and put a sleep command for that time
period before the loop.

Stephen
-- 
It's better to ask a silly question than to make a silly assumption.

                
---------------------------------
 Start your day with Yahoo! - make it your home page 

Other related posts: