Parallel processing of SQL through Shell

Hi Friends,

 I am trying to write  a shell   which will invoke 3 CTAS \(ORACLE create table XXX as select * from YYYY\).  The approximate  time for one CTAS is around 25 mins. So i want to run the CTAS script parallely.

My pseudocode is as below.

Main script

   nohup sh CTAS1.sh & (oracle creds)
   nohup sh CTAS1.sh & (oracle creds)
   nohup sh CTAS1.sh & (oracle creds)

Upon successful completion of the CTAS Scripts return to the main script.
Again connect to oracle do some Oracle stuffs based on the 3 CTAS.

EXIT From ORACLE
EXIT From SHELL.

My concern is how can i know when the nohup scripts getting completed and it will return to the main script?

Any help in this regard is highly appreciated. :o

Hello,

the wait statement can be used for this. Call it after starting your background jobs without an argument to make your script wait until all of them are finished.

1 Like

Hi Thanks for providing an option i will give a try and update.

Thanks:)

Hi CERO,

Your provided solution worked like a charm. Thanks a lot. :slight_smile: