LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-02-2018, 06:55 PM   #1
atwc
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, 02:31 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,287

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

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
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 09:54 AM.
 
Old 01-03-2018, 10:06 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,090
Blog Entries: 12

Rep: Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610Reputation: 2610
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, 08:50 AM   #5
atwc
LQ Newbie
 
Registered: Jan 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
sqlplus.sh
---------

sqlplus -s usert/password@host <<-EOF>> error.txt
SET LINESIZE 1000
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;
EOF

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

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.
 
  


Reply


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 10:29 AM
shared folder and parallel execution of applications m.fazel Linux - Virtualization and Cloud 0 06-10-2013 02:44 PM
Parallel processes execution using fork() Thodoris21 Programming 3 05-15-2012 04:36 PM
Parallel execution when two MPI are present chiendarret Linux - Software 0 11-26-2010 12:55 PM
Parallel Execution Capable Scripts? irfanhab Programming 5 08-28-2004 06:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 AM.

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