我想知道如果调度程序需要超过一小时才能完成但会将调度程序配置为每小时重新运行一次会发生什么。它会创建多个运行会话还是等待上一次运行完成?
答案 0 :(得分:4)
它会等待。我会每分钟开始这项工作,但需要2分钟才能运行
SQL> create table t ( tag varchar2(10), d date);
Table created.
SQL>
SQL> create or replace
2 procedure P is
3 begin
4 insert into t values ('start',sysdate);
5 commit;
6 dbms_lock.sleep(120);
7 insert into t values ('end',sysdate);
8 commit;
9 end;
10 /
Procedure created.
SQL>
SQL> begin
2 dbms_scheduler.create_job (
3 job_name => 'JOB1',
4 job_type => 'PLSQL_BLOCK',
5 job_action => 'begin p; end;',
6 start_date => systimestamp,
7 repeat_interval => 'freq=minutely;bysecond=0;',
8 enabled => true);
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> select * from t;
TAG D
---------- -------------------
start 03/05/2018 22:47:00
end 03/05/2018 22:49:00
start 03/05/2018 22:49:00