Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-02-2018, 07:55 PM   #1
LQ Newbie
Registered: Jan 2018
Posts: 2

Rep: Reputation: Disabled
Parallel execution of Oracle procedure

i have say x number of procedure to run, ie i have one procedure which accepts variable and i need that to run in parallel and capture the error code if in case if it fails through the unix.

sqlplus <EOF> exec test_t (abc,124); </EOF>
sqlplus <EOF> exec test_t (abc,125); </EOF>
sqlplus <EOF> exec test_t (abc,123); </EOF>

I want all these to run parallely and capture the error if any1 fails. Is there any possible way to do the same in Linux.

if one of the calls fail, how does the error handling work? Also i have someother task which needs to be started after the above is completed. So how does WAIT condition work? bcz i need to get the status of the procedure calls once its completed. So how do i know weather all the calls have been completed.
ie say i have 4 calls and 2 of them fails, then will the error be written to the one common error file?
Old 01-03-2018, 03:31 AM   #2
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,613

Rep: Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497Reputation: 3497
look for background processes and how to check their return code.
Old 01-03-2018, 10:51 AM   #3
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171
Also: what you are describing is generally called a workflow, and various off-the-shelf tools exist for doing such things – either interactively or in a batch job style.

"Workflows" generally consist of a set of activities, each of which have prerequisites and perhaps co-requisites, and with various prescribed opportunities for parallelism. Workflows also contain specifications for error-handling and exceptions.

Workflow managers consider the workflows that are presented to them, as well as constraints that are defined in their own configuration. They seek to complete the workflows in an optimal but predictable way.

Last edited by sundialsvcs; 01-03-2018 at 10:54 AM.
Old 01-03-2018, 11:06 AM   #4
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,231
Blog Entries: 12

Rep: Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702Reputation: 2702
It's likely possible in bash. I've done this in C programming.

You run a process and you monitor that process. You do this as many times as you require, or as much as the system limitations will allow.

Perhaps you should update the forum members to let us know what your expertise is with either scripting or programming, because you'll need one or both of those to accomplish what you are asking about.

To answer your questions, directly, from the programming perspective:
  • Error handing is performed by the parent process, it will wait for an exit signal and can parse exit status
  • Since a parent process is waiting for the child, or children to exit, it certainly can take action upon the exits of the child processes, and in many programming cases, does do this
  • You'll know that the calls have been completed, by your monitoring of the signals from the child processes, this is an accounting exercise you need to code
  • A common error file can be used and is probably advisable
You will have to architect these behaviors in code or script. For me it is easier in code and I have several blog entries that describe a similar architecture.

Once again, the issue here is your level of expertise, and also how much effort you are willing to put into this project. The examples shown in several of my blog entries describe an architecture which I worked incrementally on, over a period of months. It certainly can be duplicated by myself now, in a matter of hours, but my point is that the code evolved as I learned more about how to manage things and also changed as I made decisions how to improve the system.
Old 01-11-2018, 09:50 AM   #5
LQ Newbie
Registered: Jan 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled

sqlplus -s usert/password@host <<-EOF>> error.txt
select '$name', TO_CHAR(current_timestamp(0),'DD-Mon-YYYY HH24:MI:SS') as start_time from dual;
EXEC proc('$name');
select '$name' ,TO_CHAR(current_timestamp(0),'DD-Mon-YYYY HH24:MI:SS') as end_time from dual;

while read name
(sh &
while [ $(jobs -l | wc -l) -ge 3 ]
echo "";
sleep 120;
done < abc.txt

echo "Complete"

By doing the above check condition it makes sure only 2 process runs at a time and will wait for the specified time given and then check again and process it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
parallel execution of each iteration of a loop in csh simplybharath Linux - Newbie 2 04-25-2016 11:29 AM
shared folder and parallel execution of applications m.fazel Linux - Virtualization and Cloud 0 06-10-2013 03:44 PM
Parallel processes execution using fork() Thodoris21 Programming 3 05-15-2012 05:36 PM
Parallel execution when two MPI are present chiendarret Linux - Software 0 11-26-2010 01:55 PM
Parallel Execution Capable Scripts? irfanhab Programming 5 08-28-2004 07:04 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration