The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-23-2008
jnimz jnimz is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
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.
  #2 (permalink)  
Old 10-23-2008
palsevlohit_123 palsevlohit_123 is offline
Registered User
  
 

Join Date: Aug 2008
Location: India-Chennai
Posts: 120
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;
!
  #3 (permalink)  
Old 10-23-2008
jnimz jnimz is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
sry.., but i need to run this across db2
  #4 (permalink)  
Old 10-23-2008
avis1981 avis1981 is offline
Registered User
  
 

Join Date: Oct 2008
Location: NC
Posts: 21
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 ?
  #5 (permalink)  
Old 10-23-2008
avis1981 avis1981 is offline
Registered User
  
 

Join Date: Oct 2008
Location: NC
Posts: 21
or you can just use
read sql script into a string variable sqltext,
db2 -x +w <sqltext>
Closed Thread

Bookmarks

Tags
awk, awk trim, trim, trim awk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0