![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running scripts through cronjob. | jitu.jk | Shell Programming and Scripting | 3 | 06-23-2008 06:33 PM |
| Running scripts in parallel | nivas | Shell Programming and Scripting | 6 | 02-21-2008 05:44 AM |
| Running scripts from home | mastachef | UNIX for Dummies Questions & Answers | 2 | 12-07-2007 06:51 PM |
| scripts running under different users | csnewbie | UNIX for Dummies Questions & Answers | 1 | 02-14-2007 04:52 PM |
| Running scripts parallely | santho | UNIX for Dummies Questions & Answers | 4 | 07-23-2006 12:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Running Sql scripts accross db2
Hi,
I would be really thankful, if anyone could help me out with this,since i am very new to this shell scripting. I have 6 sql scripts that i am trying to run in unix across db2. i want the scripts to be executed as follows, script_1 should be executed first. Then script_2,script_3,script_4,script_5 should be executed simultaneously. Once, after all these are done with execution, i need to execute script_6 Thanks in advance, Ridley. |
|
||||
|
below is the code which will execute the sql command/existing .sql files in oracle. before doing this you have to provide the ORAUSER, ORAPWD and SPOOLFILE. This should be in the path where you having all the 6 .sql sciprt files. Try and let me know.
Code:
ORAUSER="oracle_username"
ORAPWD="oracle_password"
SPOOLFILE="spool filename"
sqlplus -s $ORAUSER/$ORAPWD >/dev/null <<!
set show off
set term off
set termout off
set trimspool on
set verify off
set feedback off
set pagesize 0
set long 2048
set longchunksize 2048
set linesize 2048
set trimspool on
set trim on
SPOOL $SPOOLFILE
@script1.sql
@script2.sql
@script3.sql
@script4.sql
@script5.sql
@script6.sql
SPOOL OFF;
!
|
|
||||
|
Assuming your sql scripts are @ delimited
You might want to provide full path for db2 command, #!/bin/ksh db2 -td@ -vf script_1 db2 -td@ -vf script_2 & db2 -td@ -vf script_3 & db2 -td@ -vf script_4 & db2 -td@ -vf script_5 & wait db2 -td@ -vf script_6 Is this what you are looking for ? |
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|