I figured what 1/288 is for. It is 5/(24*60). But
this value is valid only if we assume job finished within
minute. If job takes more than One minute, next schedule
time will be incorrect.
e.g.
00:00 --> first Job (took 30 seconeds)
00:05 --> second job ( took 1 minute and 30 seconds).
so next time will be
00:11 -->third job
Is there a way to get next interval without using current
time?
connect internal
grant execute on dbms_lock to lsc:
connect lsc
create or replace procedure sleep
as
begin
dbms_lock.sleep(90);
end;
/
variable job number
begin
dbms_job.submit(:job, 'sleep;', sysdate, 'trunc(sysdate,''mi'')+1/288');
end;
/
commit;
select next_date from user_jobs;
next_date
------------
08:14:02
select sysdate from dual;
08:14:23
exec dbms_job.run(4);
sleeps 90 seconds............
select next_date from user_jobs;
next_date
-----------
08:19:00
wait for 5 minutes for next execution
08:19:00 job starts
sleeps 90 seconds............
select next_date from user_jobs;
next_date
-----------
08:24:00
it is scheduled for every 5 minutes even the jobs takes longer than a minute
Bookmarks