using dbms_alert to manage multiple processes

2003-08-15 Thread rgaffuri
I have a coordinator package that is going to run alot of long running batch processes 
through dbms_job. Could be as many as 300 of them. I know to set my 
job_queue_processes = 36. 

however, I want to 'wait' until all of these are done. My concern is with concurrency. 

here is pseudo code:

max number := 0;
counter number := 0;
loop
  dbms_job.submit
  dbms_alert.register...
  max := max + 1;
exit when finished submitted

for i in 1.. max LOOP
  dbms_alert.waitany(... stuff...)
end loop;

my concern is in the split second while my coordinate is awake, that another 
dbms_alert could get issued and Ill never reach my max counter in the loop.

do I need to use dbms_lock to serialize this? Its not that big of a deal, Im just 
hoping that oracle serializes it for me. 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: <[EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


RE: using dbms_alert to manage multiple processes

2003-08-15 Thread Jamadagni, Rajendra
Title: RE: using dbms_alert to manage multiple processes





Will all processes signal one named alert or a process specific alert? If it is one alert then keep counting as you receive, if they are individually named alerts, keep a local pl/sql table and mark as you receive them. When you have alerts, dbms_lock for the same purpose is like riding a bike while it is being towed.

Raj

Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 15, 2003 1:44 PM
To: Multiple recipients of list ORACLE-L
Subject: using dbms_alert to manage multiple processes



I have a coordinator package that is going to run alot of long running batch processes through dbms_job. Could be as many as 300 of them. I know to set my job_queue_processes = 36. 

however, I want to 'wait' until all of these are done. My concern is with concurrency. 


here is pseudo code:


max number := 0;
counter number := 0;
loop
  dbms_job.submit
  dbms_alert.register...
  max := max + 1;
exit when finished submitted


for i in 1.. max LOOP
  dbms_alert.waitany(... stuff...)
end loop;


my concern is in the split second while my coordinate is awake, that another dbms_alert could get issued and Ill never reach my max counter in the loop.

do I need to use dbms_lock to serialize this? Its not that big of a deal, Im just hoping that oracle serializes it for me. 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: <[EMAIL PROTECTED]
  INET: [EMAIL PROTECTED]


Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California    -- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



This e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*2


Re: RE: using dbms_alert to manage multiple processes

2003-08-15 Thread rgaffuri
thanks. Im running the following test code from two different sessions. Odd thing is 
when I run the signal routine once nothing happens. However, when i run it the second 
time, my waiting routine executes on it? 

I run this first: 

declare
  vname varchar2(10) := 'myalert';
  vmessage varchar2(50) := 'NOTHING';
  vstatus number;
begin
 dbms_alert.register('myalert');
for i in 1.. 10 loop
  dbms_alert.waitany(vname,vmessage,vstatus);
  dbms_output.put_line('messag  '||vname||' '||vmessage||' '||vstatus||' '||i);
  end loop;
end;
/

I run this with a '/', nothing happens in the other session the first time. When I do 
another '/' my other session gets woken up Any ideas? 

declare
  vname varchar2(10) := 'myalert';
  vmessage varchar2(20) := 'SUCCEED';
begin
 for i in 1.. 10 loop
  dbms_alert.signal(vname,vmessage);
  commit;
  end loop;
end;
/
> 
> From: "Jamadagni, Rajendra" <[EMAIL PROTECTED]>
> Date: 2003/08/15 Fri PM 02:24:23 EDT
> To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
> Subject: RE: using dbms_alert to manage multiple processes
> 
> Will all processes signal one named alert or a process specific alert? If it
> is one alert then keep counting as you receive, if they are individually
> named alerts, keep a local pl/sql table and mark as you receive them. When
> you have alerts, dbms_lock for the same purpose is like riding a bike while
> it is being towed.
> 
> Raj
> 
> 
> Rajendra dot Jamadagni at nospamespn dot com
> All Views expressed in this email are strictly personal.
> QOTD: Any clod can have facts, having an opinion is an art !
> 
> 
> -Original Message-
> Sent: Friday, August 15, 2003 1:44 PM
> To: Multiple recipients of list ORACLE-L
> 
> 
> I have a coordinator package that is going to run alot of long running batch
> processes through dbms_job. Could be as many as 300 of them. I know to set
> my job_queue_processes = 36. 
> 
> however, I want to 'wait' until all of these are done. My concern is with
> concurrency. 
> 
> here is pseudo code:
> 
> max number := 0;
> counter number := 0;
> loop
>   dbms_job.submit
>   dbms_alert.register...
>   max := max + 1;
> exit when finished submitted
> 
> for i in 1.. max LOOP
>   dbms_alert.waitany(... stuff...)
> end loop;
> 
> my concern is in the split second while my coordinate is awake, that another
> dbms_alert could get issued and Ill never reach my max counter in the loop.
> 
> do I need to use dbms_lock to serialize this? Its not that big of a deal, Im
> just hoping that oracle serializes it for me. 
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: <[EMAIL PROTECTED]
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 
> This e-mail 
> message is confidential, intended only for the named recipient(s) above and may 
> contain information that is privileged, attorney work product or exempt from 
> disclosure under applicable law. If you have received this message in error, or are 
> not the named recipient(s), please immediately notify corporate MIS at (860) 
> 766-2000 and delete this e-mail message from your computer, Thank 
> you.*2
> 
> 
Title: RE: using dbms_alert to manage multiple processes





Will all processes signal one named alert or a process specific alert? If it is one alert then keep counting as you receive, if they are individually named alerts, keep a local pl/sql table and mark as you receive them. When you have alerts, dbms_lock for the same purpose is like riding a bike while it is being towed.

Raj
----------------
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Frid