Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Making a for loop parallel instead of serial - trolling for ideas

Re: Making a for loop parallel instead of serial - trolling for ideas

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 16 Apr 2002 19:31:30 +0100
Message-ID: <3CBC6E02.1DD5@yahoo.com>


David Van Zandt wrote:
>
> Thanks Laura. I'm aware of doing the "nohup file &". The sticker is,
> inside the FOR loop I have multiple commands:
> for fi in $SIDLIST; do
> . db_$fi
> echo xxx
> /path/export '/' file=$destdir/$fi.dmp parfile=$pardir/export.par
> [some error handling]
> done
>
> Man suggests I can do "nohup (command1; command2; commandn) &. I'll try the
> parentheses between the do and done, and see what happens (in dev, of
> course...).
>
> >
> > >For years I have assumed that my nightly exports of ten Oracle databases
> > >(one node) had to process sequentially -- perhaps because my Korn for
> loop
> > >was working, I left it alone.
> > >
> > >Unfortunately, I've become curious of late, and my theory is that the O/S
> > >should be capable of handling multiple export streams concurrently.
> > >Obviously I can "nohup" a shell script one after another. What I'm
> missing
> > >is the technique of running through that "for" loop without having to
> embed
> > >the (former) for logic into another script. For example, I'm presently
> > >doing a for loop that sets my SID and OH, then launches export with a
> > >parameter script. I do not wish to go back to having one hardcoded
> script
> > >for each of these databases -- obviously.
> > >
> > >Anyhow, does anyone care to comment whether or not this seems feasible,
> or
> > >if I'm overlooking a better approach?
> > >
> >
> > Can't you/why can't you launch each process as a new background task?
> >
> > for l in 1 2 3 4 5 6
> > do
> > launch backup $l &
> > done
> >
> > That should mean each backup ends up running in parrallel.
> >
> > >TIA,
> > >dvz
> > >
> > >
> >
> > wishes
> >
> > --
> > laura fairhead # laura@madonnaweb.com http://lf.8k.com
> > # if you are bored crack my sig.
> > 1F8B0808CABB793C0000666667002D8E410E83300C04EF91F2877D00CA138A7A
> > EAA98F30C494480157B623C4EF1B508FDED1CEFA9152A23DE35D661593C5318E
> > 630C313CD701BE92E390563326EE17A3CA818F5266E4C2461547F1F5267659CA
> > 8EE2092F76C329ED02CA430C5373CC62FF94BAC6210B36D9F9BC4AB53378D978
> > 80F2978A1A6E5D6F5133B67B6113178DC1059526698AFE5C17A5187E7D930492
as per the other post, and also you can issue the 'wait' command outside the loop which will wait until all the b'grounded procs finish before you continue on...

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Tue Apr 16 2002 - 13:31:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US