Re: Lazy dbms_job

  • From: Ranko Mosic <ranko.mosic@xxxxxxxxx>
  • To: terrysutton@xxxxxxx
  • Date: Tue, 26 Apr 2005 14:54:02 -0400

Just found, _job_queue_interval can still be configured in 9i as hidden par=
am.=20

On 4/21/05, Ranko Mosic <ranko.mosic@xxxxxxxxx> wrote:
> It is rescheduled because procedure execution times are not known in
> advance - it might take longer than 1 second; as soon as all 3 procs
> finish ( again, execution time is not known ), job is rescheduled to
> run at sysdate + 1/24/60/60.
> dbms_job is used because we want the whole thing to run in background.
> cpu time used is 0.6 sec on 180 sec sleep.
> and yes, thanks, there are twice as many locks.
> rm.
>=20
> On 4/21/05, Terry Sutton <terrysutton@xxxxxxx> wrote:
> > First, I'm curious why you do the rescheduling within the job.  Why don=
't
> > you just set the interval to 1/(60*60*24)?  You still aren't going to g=
et it
> > to run every second, but I know of job which run every 4-5 seconds this=
 way.
> > But the dbms_job facility is not designed to do super-precise schedulin=
g.
> >
> > If you need these procedures to run every second, create a procedure wi=
th an
> > infinite loop, using the dbms_lock.sleep procedure to stop for a second
> > between executions of the 3 procedures.  Start the procedure and let it=
 run
> > constantly.  You don't even need to use dbms_job, though that can be us=
ed to
> > ensure the job starts again if should ever stop.  You don't need to sto=
p the
> > procedure, and the sleep procedure shouldn't consume significant resour=
ces.
> > You will see you enqueue waits increase (sleep creates an enqueue), so =
if
> > you're monitoring wait events, you'll want to note this.
> >
> > --T
> >
> > ----- Original Message -----
> > From: "Ranko Mosic" <ranko.mosic@xxxxxxxxx>
> > To: <oracle-l@xxxxxxxxxxxxx>
> > Sent: Thursday, April 21, 2005 6:24 AM
> > Subject: Lazy dbms_job
> >
> > I am running following procedure ( Oracle 9i ):=3D20
> >
> > dbms_job.submit( l_job, 'background_submit_proc( JOB, NEXT_DATE);' );
> >
> > create or replace
> >    procedure background_submit_proc( p_job in number, p_NEXT_DATE OUT D=
ATE=3D
> >  )
> >    as
> >    begin
> >               uui(); -- these are procedures that are executed;
> >               uui1();=3D20
> >               uui2();
> >
> > =3D09p_next_date :=3D3D sysdate + 1/24/60/60*1;
> >
> >    exception when others then raise;
> > end;
> > /
> >
> > Whole thing runs fine. It modifies NEXT_DATE so it reschedules itself
> > as soon as
> > 3 procedures are finished. Procedures are very fast ( takes less than
> > a second to execute them ). So job's NEXT_DATE should be incremented
> > almost every second.
> > It is not. It is incremented every 15 seconds.=3D20
> > Is there a way to make it more responsive ? I want it to execute every =
seco=3D
> > nd .=3D20
> >
> > Regards, Ranko.
> > --
> > //www.freelists.org/webpage/oracle-l
> >
> > --
> > //www.freelists.org/webpage/oracle-l
> >
>
--
//www.freelists.org/webpage/oracle-l

Other related posts: