Scheduling of Jobs using Oracle Scheduler

Asked

Viewed 1,097 times

1

Good morning, good afternoon and good night.

You could help me with a problem regarding the oracle dbms_schedule.

I need to create a JOB that starts every day at 22hrs and stops at 4hrs in the morning, but it has to be run every 1 hour.

But I can’t make the end_date work, whenever I select it in the table "USER_SCHEDULE_JOBS" it is like NULL.

Code:

/* Criação da Schedule para o programa */      

BEGIN
  DBMS_SCHEDULER.CREATE_SCHEDULE
  (
    schedule_name => 'a_cada_1_hora_a_partir_das_22',
    start_date => systimestamp + 1/24*22,
    repeat_interval => 'FREQ=HOURLY;INTERVAL=1',
    end_date => systimestamp + 1/24*4,
    comments => 'Executar a cada 1 hora à partir das 19 horas da noite até 22 horas'
  );
END;
/

/* Criação da JOB para rodar o programa de acordo com a SCHEDULE criada */

BEGIN
  DBMS_SCHEDULER.CREATE_JOB
  (
    job_name => 'JOB_TESTE_1',
    program_name => 'INSERT_TBL_JOB_TESTE',
    schedule_name => 'a_cada_1_hora_a_partir_das_22',
    enabled => TRUE,
    auto_drop => FALSE,
    comments => 'Executar o programa INSERT_TBL_JOB_TESTE entre 19hrs até 22hrs.'
   );
END;
/

I could not understand very well what is in the Oracle documentation and I’m having difficulties in programming this interval, could help me?

Thank you, from now on.

1 answer

1


Well had no answers to the problem but I ended up getting the solution here, stay there as help for those who have the same problem:

To configure a time range just use the "BYHOUR" and pass the hours, it was like this:

BEGIN
  DBMS_SCHEDULER.CREATE_SCHEDULE
  (
    schedule_name => 'a_cada_1_hora_a_partir_das_22',
    start_date => systimestamp,
    repeat_interval => 'FREQ=DAILY; BYHOUR=22,23,00,01,02,03,04',
    comments => 'Executar a cada 1 hora à partir das 22 horas da noite até 4 horas da manhã'
  );
END;
/

Thanks ^^

Browser other questions tagged

You are not signed in. Login or sign up in order to post.