w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Unix shell script run SQL scripts in parallel

The first command should run synchronously...

If you start the two last commands as background processes (add & at the end of the command), they will run in parallel.

Do you want the script to wait for the two last processes to be complete before leaving?

Something like this should work:

  sqlplus user1/pw @/home/scripts/tst1.sql
  sqlplus user1/pw @/home/scripts/tst2.sql &
  pid2=$!
  sqlplus user1/pw @/home/scripts/tst3.sql &
  pid3=$!
  # pseudo-code:
  # while (`ps -p"$pid2,$pid3" | wc -l` != "1");
  sqlplus user1/pw @/home/scripts/tst4.sql




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.