Make process parallel


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Make process parallel
# 1  
Old 05-08-2015
Make process parallel

Hi,

I have a file which has a list of 200 tables e.g: table.txt
I need to do a count for each table and store it in a file.

So I did something like this:

Code:
for TABLE in `cat table.txt`
do
T_CNT=$(sqlplus -s -l / as sysdba <<EOF
set echo off heading off feadback off
SELECT count(*)
FROM ${TABLE};
exit;
EOF)

echo "$T_CNT|$TABLE >> $AUDIT_FILE
done

The above script does the job, but it goes through each table one at a time.
Is there a way to make this process more parallel, so that I can query multiple tables at a time?

I was thinking of doing a split. Something like
Code:
split -l 20 table.txt

The above line would create 10 splits, so I could query 10 tables at a time.

But I'm not sure what my next step is so that 10 Select clauses are issued at smae time.

Please advise.
# 2  
Old 05-08-2015
I bet you'd get much better speedup by connecting to the database once instead of 200 times, and accomplish this without DDOS-ing your database server.

Code:
awk 'BEGIN { print "set head off;" } { print "SELECT CONCAT(CONCAT(\""$1"\", \"|\"), COUNT(*)) FROM "$1";" }' tables.txt | sqlplus -s -l / as sysdba > $AUDIT_FILE

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

2. Shell Programming and Scripting

How to make parallel execution on folder ?

I have few very huge files ~ 2 Billion rows of 130 column(CDR data) in a folder, I have written shell script need to read on each file in a folder and will create a new files based on some logic. But problem is it's taking time to create a new file due to the size , So i dont want to corrupt... (6 Replies)
Discussion started by: rspwilliam
6 Replies

3. UNIX for Dummies Questions & Answers

Running parallel process

i am having 4 process,have to run parallel and not after one by one. sample1.sh sample2.sh sample3.sh sample4.sh Thanks in advance. i (11 Replies)
Discussion started by: sagar_1986
11 Replies

4. Programming

Parallel process in java

Hello; Please Are both threads execute in parallel? Thank you (4 Replies)
Discussion started by: chercheur857
4 Replies

5. Shell Programming and Scripting

Parallel process in Perl

HI All, I have scenerio where I need to call sub modules through for loop for (i=0; i<8000 ;i++) { .. BLOCKA } BLOCKA { .. .. subroutine 1; subroutine 2; } I want this to be run in parallel process1 BLOCKA { (6 Replies)
Discussion started by: gvk25
6 Replies

6. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

7. Shell Programming and Scripting

how to start a process and make it sleep for 5 mins and then kill that process

how to start a process and make it sleep for 5 mins and then kill that process (6 Replies)
Discussion started by: shrao
6 Replies

8. AIX

Make : parallel execution

Hi, Is there any way to run parallel jobs using make command? I am using non-GNU make utility on AIX 4.3. I want to run 2 jobs symultaneously using make utility. Thanks. Suman (0 Replies)
Discussion started by: suman_jakkula
0 Replies

9. Shell Programming and Scripting

split process files in parallel and rejoin

Hi I need to split a huge file into multiple smaller files using split command. After that i need to process each file in the back ground with sql loader .Sql loader is a utlity to load CSV files into oracle . Check the status of each of these sqlloaders and then after sucessfull... (6 Replies)
Discussion started by: xiamin
6 Replies

10. UNIX for Dummies Questions & Answers

killing parallel oracle process

Hi guys: I have a an oracle job which uses 10 parallel hints and would like to killit when it hangs. I want to kill all the processes that have been spawned. what I do right now is get the pid of the scheduler process which initiated theis job and the do a ps -ef| grep 'pid' and trace through... (1 Reply)
Discussion started by: oracle8
1 Replies
Login or Register to Ask a Question