Hi,
I need to excute two .sql scripts sequentially within file.sh
sqlplus user/pass@db1 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy1.sql
THEN
sqlplus user/pass@db2 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy3.sql
Thanks,
Soph
Hi,
I need to excute two .sql scripts sequentially within file.sh
sqlplus user/pass@db1 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy1.sql
THEN
sqlplus user/pass@db2 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy3.sql
Thanks,
Soph
What happens when you just put them both in the shell script, as shown below? That makes the first one run, and then when it finishes, the second one starts running. Is there an error when you do that?
sqlplus user/pass@db1 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy1.sql
sqlplus user/pass@db2 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy3.sql
Do you want to run them at the same time? In that case, put the first one in the background, and the second one will start running immediately (in the foreground):
sqlplus user/pass@db1 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy1.sql &
sqlplus user/pass@db2 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy3.sql
I've tried the first recommended option and not working - it runs the first "iadeploy1.sql" then tries the second "iadeploy3.sql" but it hangs with no error exception..
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
63
Try with the && control operator in the file.sh
sqlplus user/pass@db1 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy1.sql &&
sqlplus user/pass@db2 @/opt/Infor/Outbound_Marketing/7.2.2/custom/iadeploy3.sql
Is they work correctly and give the outputs from commandline when run individually ?
Write a generic wrapper to run all the sql commands.(put the "sqplus" command in the wrapper which accepts dbname, sql file etc as parameters)
and call the wrapper twice in this file.sh script of yours with iadeploy1.sql and iadeploy3.sql as parameters. Run them in the background, by capturing the exit code.
If you have more than 2 sql scripts to run, I would recommend loop them using an array of sql filenames.