Oracle
 sql >> Database >  >> RDS >> Oracle

Come pianificare i lavori Oracle DBMS in una finestra

Puoi usare questo:

begin
dbms_scheduler.create_job (
   job_name           =>  'jb_en_lopes',
   job_type           =>  'STORED_PROCEDURE',
   job_action         =>  'pr_en_lopes',
   start_date         =>  '09-oct-2017 09:00:00 am',
   repeat_interval    =>  'freq=minutely; interval=10; byhour=9,10,11,12,13,14,15,16,17,18,19,20; byday=MON,TUE,WED,THU,FRI;',
   enabled            =>  true);
end;

Quando questo pianificatore è in carica, ottengo i risultati di seguito:

select * 
  from dba_scheduler_job_log l
 where l.job_name = 'JB_EN_LOPES'
 order by l.log_date desc;

 LOG_ID LOG_DATE                            OPERATION   STATUS

1051594 10-OCT-17 09.59.01.197420 AM +03:00    RUN      SUCCEEDED  
1051592 10-OCT-17 09.58.02.229724 AM +03:00    RUN      SUCCEEDED  
1051590 10-OCT-17 09.57.03.177907 AM +03:00    RUN      SUCCEEDED  
1051588 10-OCT-17 09.56.01.197341 AM +03:00    RUN      SUCCEEDED

Dove :

select owner, job_name, next_run_date                                  
  from dba_scheduler_jobs                                               
 where JOB_NAME = 'JB_EN_LOPES'; 

 OWNER    JOB_NAME       NEXT_RUN_DATE

 myschema JB_EN_LOPES   10-OCT-17 08.00.00.194958 PM +03:00

Aggiornamento :

Se non hai accesso a dba_ viste, quindi considera di sostituire quei prefissi con user_ e rimuovi owner colonna dall'elenco di selezione per l'ultima query come

select job_name, next_run_date                                  
  from user_scheduler_jobs                                               
 where JOB_NAME = 'JB_EN_LOPES';