Saturday, 2 June 2018

HOW TO CHANGE "NEXT_RUN_DATE" IN SCHEDULER JOB.

Hi,

Lets take below example, here the Job 'REPORT' has last executed on 31-MAY-18 at 08.00 PM, and this will going to execute on daily basis at 8 PM. 

Now, I have received request that, reschedule this to today at 11 PM, it means NEXT_RUN_DATE should be 31-MAY-18 at 11.00 PM instead on 01-JUN-18 08.00 PM.

Here you need to change in attributes of REPEAT_INTERVAL. (not in NEXT_RUN_DATE).

Lets see this in practical,

Current state of REPORT job.


SQL> select * from dba_scheduler_jobs a where a.job_name='REPORT';











Need to reschedule to 31-MAY-18 at 11.00 PM.

SYS on 31-MAY-18 @ Test > 
> begin
> dbms_scheduler.set_attribute(
> name=> 'REPORT',
> attribute => 'REPEAT_INTERVAL',
> value=> 'FREQ=DAILY;BYHOUR=23;BYMINUTE=00;BYSECOND=0'
> );
> end;
> /
  
  2    3    4    5    6    7    8
SQL> PL/SQL procedure successfully completed.

SQL> select * from dba_scheduler_jobs a where a.job_name='REPORT';









Conclusion: In order to change in NEXT_RUN_TIME, you need to change attributes in REPEAT_INTERVAL.

Cheers !!!

No comments:

Post a Comment