4 Replies Latest reply on Oct 23, 2017 5:15 PM by Amin Chavarria

    Advance scheduler

    Amin Chavarria

      how to schedule a task for 5th of October but not to run the weekend but until the following Monday 7th of October, how to program it with dba_scheduler

       

      regards

      Amin

        • 1. Re: Advance scheduler
          Lisandro Fernigrini

          I already answered on this question in the spanish forum:

           

          Programación avanzada dbms_scheduler

           

          1) Create a schedule for Mondays that are 6 or 7 of each month (that menas that 5 was either sunday or saturday)

           

           

              DBMS_SCHEDULER.CREATE_SCHEDULE ( 

                 schedule_name     => 'Lunes6y7', 

                 start_date        => NULL, 

                 repeat_interval   => 'FREQ=MONTHLY; BYMONTHDAY=6,7; BYDAY=MON', 

                 end_date          => NULL, 

                 comments          => 'Se ejecuta los lunes 6 y 7 de cada mes'); 

           

           

          2) Then, include the schedule in the definitive schedule (you need to use this one to schedule the process)

           

              DBMS_SCHEDULER.CREATE_SCHEDULE ( 

                 schedule_name     => 'Dia5oLunes6y7', 

                 start_date        => NULL, 

                 repeat_interval   => 'FREQ=MONTHLY; BYMONTHDAY=5; BYDAY=MON,TUE,WED,THU,FRI; include=Lunes6y7', 

                 end_date          => NULL, 

                 comments          => 'Se ejecuta el dia 5 si es dia de semana o los lunes 6 y 7 si el dia 5 cae en sabado o domingo); 

           

           

          The trick is to include Mondays that are 6 or 7 (include=Lunes6y7) in the schedule for each 5th of each month (FREQ=MONTHLY; BYMONTHDAY=5;) excluding Saturdays and Sundays (BYDAY=MON,TUE,WED,THU,FRI;)

          • 2. Re: Advance scheduler
            GregV

            Hi,

             

            Is this on a yearly basis? Do you want every 5th October or next Monday if it falls on a weekend? Is that it?

            • 3. Re: Advance scheduler
              Lisandro Fernigrini

              On the Spanish forum OP asked the schedule to run on the 5th of each month if it was a working day (Monday to Friday) or on the following Monday if the 5th was Saturday or Sunday. Here he just asked for October.

              • 4. Re: Advance scheduler
                Amin Chavarria

                Hi GregV,

                 

                the execution would be monthly on the 5th of each month

                 

                regards

                Amin