Sponsored Content
Top Forums Shell Programming and Scripting Help with executing parallel sessions for same shell script with different but fixed parameters Post 302478442 by R0H0N on Wednesday 8th of December 2010 02:56:51 AM
Old 12-08-2010
If I m not wrong, you are trying to execute same query for 25 column ids on a customer table at a single time.

For that your following qeury will list out column ids in abc.txt file. Correct?

Code:
sqlplus -s $ORA_CONN <<EOF
SET SERVEROUTPUT ON
SET FEED OFF
spool abc.txt
BEGIN
   FOR i IN (SELECT ID FROM customer)
   LOOP
      DBMS_OUTPUT.put_line ( 'value ' || i.ID);
   END LOOP;
END;
/
spool off
EOF

abc.txt will look like
Quote:
1
2
3
4
5
..
..
25
Now to execute same query as follows on all listed column ids, you can write a script like


Code:
#!/bin/ksh

    # First list out Column ids in abc.txt file
sqlplus -s $ORA_CONN <<EOF
SET SERVEROUTPUT ON
SET FEED OFF
spool abc.txt
BEGIN
   FOR i IN (SELECT ID FROM customer)
   LOOP
      DBMS_OUTPUT.put_line ( 'value ' || i.ID);
   END LOOP;
END;
/
spool off
EOF

    # Now for each data in abc.txt, execute second query in background
for myID in `cat abc.txt | xargs`
do
sqlplus -s $ORA_CONN <<EOF!
        SPOOL ${rep_name}report_${rep_part}_${sysdate1}.txt;
        SELECT * FROM customer WHERE col1="$myID"
           AND (  col2='sumthing')
        UNION
        SELECT * FROM customer WHERE col1="$myID"
        AND (condition);
        Spool off;
exit
EOF! &
done


Last edited by R0H0N; 12-08-2010 at 03:59 AM.. Reason: Highlight important points
This User Gave Thanks to For This Post:
R0H0N
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problems executing SQL Plus sessions

If I execute this script: $ORACLE_HOME/bin/sqlplus -s <<EOF > oracle.log $DB_id/$DB_pswd@$DB_server start test.sql EOF the sql script executes with no errors. IF I execute the following script:... (12 Replies)
Discussion started by: mh53j_fe
12 Replies

2. Shell Programming and Scripting

Run a same script in parallel with diffs parameters

i have script say some_script.ksh that takes an argument I need to run some_script.ksh in background parallely at the sametime with different arguments. Once all the background jobs complete, i need to run this script again in parallel with another 5 set of arguments. Would really... (1 Reply)
Discussion started by: hyennah
1 Replies

3. Shell Programming and Scripting

Executing scripts in Parallel

Hi All, I have 3 shell scripts, Script1,Script2 and Script3. Now I want to run Script1 and Script2 in parallel and Script3 should depend on successful completion of both Script1 and Script2. Could you please suggest an approach of acheiving this... Thanks in advance (2 Replies)
Discussion started by: itsme_maverick
2 Replies

4. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

5. Shell Programming and Scripting

Executing two commands in parallel

Hi, I am stuck into a situation where i want to execute a command in my shell script well along with a previous command in order to achieve something but i am not figuring out a way. here is a snippet: service management restart rm -rf lock.file in the above, if you see, i am trying to... (5 Replies)
Discussion started by: sunrexstar
5 Replies

6. Shell Programming and Scripting

Parallel SQL sessions in shell script

i have 3 sqls , sql 1 and sql 2 shuld run in parallel , but sql 3 should run after completion f sql1 nd sql2, my code is as below, please suggest the changes sqlplus username1/password1@DB1 @sql >> log1 & sqlplus username2/password2@DB2 @sql2 >> log1 & how can i execute the... (7 Replies)
Discussion started by: only4satish
7 Replies

7. Shell Programming and Scripting

Executing Multiple Queries in parallel in Shell

I have n number of SQL queries needs to executed in Shell. Result of this query need to assign in a variable. Once all the queries are executed script needs to exit. Sample Query: SQL 1: Select Count(*) from TABLE GROUP BY COL1,COL2 SQL 2: Select Count(*) from TABLE GROUP BY COL1,COL2 ... (2 Replies)
Discussion started by: Niranjancse
2 Replies

8. Shell Programming and Scripting

Pass parameters to a function and running functions in parallel

Hi , I have a script which is using a text file as I/P. I want a code where it reads n lines from this file and pass the parameters to a function and now this script should run in such a way where a function can be called in parallel with different parameters. Please find below my script, it... (1 Reply)
Discussion started by: Ravindra Swan
1 Replies

9. Shell Programming and Scripting

Parallel for in a Script Shell

Hello, This is my Script which configure a list of nodes. ( 40 nodes, and the configuration 10 minutes) #! /bin/sh if then echo "USE: ./start.sh nodes else nb_lignes=`wc -l $1 | cut -d " " -f1` echo "$nb_lignes machines" for i in $(seq $nb_lignes) //instructions done fi My... (2 Replies)
Discussion started by: chercheur111
2 Replies

10. UNIX for Beginners Questions & Answers

Executing SQL's in parallel

Hi Folks, I have requirement to pull a bunch of SQL's from a table in DB and execute them in parallel and update the status of each query as and when they complete. Can you please help me with ideas on how this can be achieved? create table list_of_sql ( id number, full_sql... (3 Replies)
Discussion started by: member2014
3 Replies
GLGENQUERIES(3G)						    OpenGL 3.3							  GLGENQUERIES(3G)

NAME
glGenQueries - generate query object names C SPECIFICATION
void glGenQueries(GLsizei n, GLuint * ids); PARAMETERS
n Specifies the number of query object names to be generated. ids Specifies an array in which the generated query object names are stored. DESCRIPTION
glGenQueries returns n query object names in ids. There is no guarantee that the names form a contiguous set of integers; however, it is guaranteed that none of the returned names was in use immediately before the call to glGenQueries. Query object names returned by a call to glGenQueries are not returned by subsequent calls, unless they are first deleted with glDeleteQueries(). No query objects are associated with the returned query object names until they are first used by calling glBeginQuery(). ERRORS
GL_INVALID_VALUE is generated if n is negative. GL_INVALID_OPERATION is generated if glGenQueries is executed between the execution of glBeginQuery() and the corresponding execution of glEndQuery(). ASSOCIATED GETS
glIsQuery() SEE ALSO
glBeginQuery(), glDeleteQueries(), glEndQuery() COPYRIGHT
Copyright (C) 2005 Addison-Wesley. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. OpenGL 3.3 03/08/2011 GLGENQUERIES(3G)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy