1 Reply Latest reply: Jan 14, 2013 1:44 AM by Mihael RSS

    Run the scheduler for 3 hours only

    Chanchal Wankhade
      Hello All,

      We have oracle 10G R2 on windows.

      I am trying to use dbms_scheduler create the schedule to run procedures.

      My requirement is to run the job from 12.30 pm to 3.30 pm for the interval of every 10 minuts and 2.45 t0 3.45 for the interval of 5 minuts.

      For the above requirement, Can you please suggest how can i create a job. I have created something like below :-
      begin
      DBMS_SCHEDULER.CREATE_JOB(
      JOB_NAME          =>     'TEST_JOB',
      JOB_TYPE          =>     'PLSQL_PROCEDURE',
      JOB_ACTION          =>     'BEGIN TEST; END; ',
      START_DATE          =>     SYSTIMESTAMP,
      END_DATE          =>     NULL,
      COMMENTS          =>     'JOB IS CREATED FOR TESTING PURPOSE',
      ENABLED               =>     TRUE,
      REPEAT_INTERVAL          =>     ‘freq=WEEKLY;BYDAY=MON,TUE,WED,THU,FRI; byhour=12.30 to 15; byminute=10; bysecond=0;’
      )
      Can we do this.
        • 1. Re: Run the scheduler for 3 hours only
          Mihael
          I am trying to use dbms_scheduler create the schedule to run procedures.

          My requirement is to run the job from 12.30 pm to 3.30 pm for the interval of every 10 minuts
          You can use calendar expression like

          +'FREQ=DAILY; BYHOUR=00,01,02,03; BYMINUTE=00,10,20,30,40,50'.+

          In this case interval will be 00:00-03:50.

          If you want interval be 00:30-03:30, then you can create 3 shedulers and combine them, for example :

          DBMS_SCHEDULER.CREATE_SCHEDULE(schedule_name => 'sched_1', repeat_interval => 'FREQ=DAILY; BYHOUR=00; BYMINUTE=30,40,50');

          DBMS_SCHEDULER.CREATE_SCHEDULE(schedule_name => 'sched_2', repeat_interval => 'FREQ=DAILY; BYHOUR=01,02; BYMINUTE=00,10,20,30,40,50');

          DBMS_SCHEDULER.CREATE_SCHEDULE(schedule_name => 'sched_3', repeat_interval => 'FREQ=DAILY; BYHOUR=03; BYMINUTE=00,10,20,30');

          DBMS_SCHEDULER.CREATE_SCHEDULE(schedule_name => 'sched_all', repeat_interval => 'sched_1,sched_2,sched_3');