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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: RE: dbms_job - running jobs every 15 minutes

RE: RE: dbms_job - running jobs every 15 minutes

From: Freeman Robert - IL <FREEMANR_at_tusc.com>
Date: Wed, 22 Jan 2003 10:19:24 -0800
Message-ID: <F001.00537A5D.20030122101924@fatcity.com>


Yea... I realized that after I sent the email, so I submitted my second suggestion...
Thanks though for your thoughts!!

Robert G. Freeman
Technical Management Consultant
TUSC - The Oracle Experts www.tusc.com
904.708.5076 Cell (It's everywhere that I am!) Author of several books you can find on Amazon.com!

-----Original Message-----
Sent: Wednesday, January 22, 2003 2:45 AM To: Multiple recipients of list ORACLE-L

>
>How about
>
>dbms_job.submit(:jobno, 'statspack.snap',
>sysdate+n/1440, 'sysdate
>15/1440');
>
>where n= a number of minutes to the nearest 15
>minutes. So if it's 14:25
>then it would
>be sysdate+5/1440.
>
>since you only need to do this one time, just make
>sure that sysdate + n =
>0, 15, 30 or 45
>after the hour... :-) Of course, if you want to
>automate the thing, then
>build this around a PL/SQL procedure...that
>calculates the value of n.....
>Not elegant, but I think that when
>someone looks at DBA_JOBS they are not going to ask
>what the $*#(@( you were
>trying to do..
>I subscribe to the KISS philosophy...
>
>:-)
>
>RF
>
>
>-----Original Message-----
>Jared.Still_at_radisys.com
>Sent: Tuesday, January 21, 2003 6:24 PM
>To: Multiple recipients of list ORACLE-L
>
>
>Feeling particularly anal the other day, I used
>the following
>specification to
>run statspack at the top of the hour, 15, 30 and 45
>minutes after the
>hour.
>
>variable jobno number;
>variable instno number;
>begin
> select instance_number into :instno from
>v$instance;
> dbms_job.submit(
> :jobno
> , 'statspack.snap;'
> -- every 15 minutes at 00,15,30 and
>45
> , trunc(sysdate,'hh24') + ( ( 15 +
>( 15 *
>floor(to_number(to_char(sysdate,'mi')) / 15))) / (
>24 * 60 ))
> , 'trunc(sysdate,''hh24'') + ( (
>15 + ( 15 *
>floor(to_number(to_char(sysdate,''mi'')) / 15))) /
>( 24 * 60 ))'
> );
> commit;
>end;
>/
>
>
>Seems to me that the time specs could be simplified
>a bit.
>
>Anyone care to give it a go? :)
>
>Jared
>
>--
>Please see the official ORACLE-L FAQ:
>http://www.orafaq.net

Robert,

   I am afraid that you will soon run into the 'slipping job' syndrom. Without any 'trunc' (or anything functionally similar), 'sysdate' in the interval happens to be the date when the job started - which may be up to one minute (usually) the time when you asked it to start. Means that you can easily slip by four minutes every hour.
I agree with adding 15/1440 (one day = 1440mn), but your base time musn't be 'sysdate' but sysdate rounded to the nearest quarter of an hour. Considering that a quarter of an hour is a 96th (24 * 4) of a day you have several more or less complicated ways to do it. Vladimir (whose formula I am still trying to understand :-)) took the seconds since midnight, you can also do something such as
 [today 00:00] trunc(sysdate)
 + [current time rounded to the latest quarter of an hour] floor((sysdate - trunc(sysdate))* 96) / 96
 + 15/1440

HTH, Stephane Faroult
Oriole

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Stephane Faroul
  INET: sfaroult_at_oriolecorp.com

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: ListGuru_at_fatcity.com (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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Freeman Robert - IL
  INET: FREEMANR_at_tusc.com

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: ListGuru_at_fatcity.com (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).
Received on Wed Jan 22 2003 - 12:19:24 CST

Original text of this message

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