Oracle 创建 、启用、停用job、修改job 间隔
2014-04-14 17:51 Qonly 阅读(1889) 评论(0) 编辑 收藏 举报1. 创建job:
DECLARE
JobNo NUMBER;
begin
sys.dbms_job.submit(job => JobNo, --job 编号
what => 'Getvtinvoice_sap;', --job调用的存储过程
next_date => to_date('2014-03-17 14:50:00',
'yyyy-mm-dd hh24:mi:ss'), --下次调用时间
interval => 'sysdate+10/1440'); --调用间隔
commit;
end;
2.修改job 间隔:
begin
sys.dbms_job.change(job => 123,
what => 'Getvtinvoice_sap;',
next_date => to_date('2014-04-14 16:50:00',
'yyyy-mm-dd hh24:mi:ss'),
interval => 'sysdate+10/1440');
commit;
end;
--3.停用job
begin
dbms_job.broken(job =>121, broken =>true);--Pro_CMMPtoZZJInf_VehicleInfo;
dbms_job.broken(job =>122, broken =>true);--Pro_ZZJInftoZZJ_VehicleInfo;
end;
--4.启用job
begin
dbms_job.broken(121, false, sysdate +30/1440);
dbms_job.broken(122, false, sysdate +30/1440);
end;