Re: Lazy dbms_job

  • From: Ranko Mosic <ranko.mosic@xxxxxxxxx>
  • To: terrysutton@xxxxxxx
  • Date: Thu, 21 Apr 2005 13:07:52 -0400

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.=20
cpu time used is 0.6 sec on 180 sec sleep.=20
and yes, thanks, there are twice as many locks.=20
rm.

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 get=
 it
> to run every second, but I know of job which run every 4-5 seconds this w=
ay.
> But the dbms_job facility is not designed to do super-precise scheduling.
>=20
> If you need these procedures to run every second, create a procedure with=
 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 r=
un
> constantly.  You don't even need to use dbms_job, though that can be used=
 to
> ensure the job starts again if should ever stop.  You don't need to stop =
the
> procedure, and the sleep procedure shouldn't consume significant resource=
s.
> You will see you enqueue waits increase (sleep creates an enqueue), so if
> you're monitoring wait events, you'll want to note this.
>=20
> --T
>=20
> ----- Original Message -----
> From: "Ranko Mosic" <ranko.mosic@xxxxxxxxx>
> To: <oracle-l@xxxxxxxxxxxxx>
> Sent: Thursday, April 21, 2005 6:24 AM
> Subject: Lazy dbms_job
>=20
> I am running following procedure ( Oracle 9i ):=3D20
>=20
> dbms_job.submit( l_job, 'background_submit_proc( JOB, NEXT_DATE);' );
>=20
> create or replace
>    procedure background_submit_proc( p_job in number, p_NEXT_DATE OUT DAT=
E=3D
>  )
>    as
>    begin
>               uui(); -- these are procedures that are executed;
>               uui1();=3D20
>               uui2();
>=20
> =3D09p_next_date :=3D3D sysdate + 1/24/60/60*1;
>=20
>    exception when others then raise;
> end;
> /
>=20
> 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 se=
co=3D
> nd .=3D20
>=20
> Regards, Ranko.
> --
> //www.freelists.org/webpage/oracle-l
>=20
> --
> //www.freelists.org/webpage/oracle-l
>
--
//www.freelists.org/webpage/oracle-l

Other related posts: