oracle job
job修改执行时间
BEGIN
sys.dbms_job.NEXT_DATE(103, to_date('2015-11-12 01:40:00', 'yyyy-mm-dd hh24:mi:ss'));
sys.dbms_job.INTERVAL(103, 'TRUNC(SYSDATE+1)+1/24+40/24/60');
END;
/
job删除
begin
sys.dbms_job.remove();
end;
/
job指定节点运行
exec dbms_job.instance(job=>292, instance=> 1);
job停止
exec sys.DBMS_IJOB.BROKEN(1403,TRUE);
select b.SID,b.SERIAL#,c.SPID
from dba_jobs_running a,v$session b,v$process c
where a.sid = b.sid and b.PADDR = c.ADDR;
job恢复
exec sys.DBMS_IJOB.BROKEN(442,FALSE,to_date('2016-01-21 19:19:00','YYYY-MM-DD HH24:MI:SS'));
job启动
begin
sys.dbms_job.run();
end;
/
创建JOB
DECLARE
job_id number;
begin
sys.dbms_job.SUBMIT(job => job_id,
WHAT => 'OPER.pak_sms_sendmsg.p_send_msg;',
NEXT_DATE => to_date('2016-2-2 23:00:00', 'yyyy-mm-dd hh24:mi:ss'),
INTERVAL => 'trunc(sysdate+1)+23/24');
commit;
end;
/
--ADD_MONTHS(trunc(sysdate,'yyyy'),12)+1/24
DECLARE
job_id number;
begin
sys.dbms_job.SUBMIT(job => job_id,
WHAT => 'OPER.pak_sms_sendmsg.p_send_msg;',
NEXT_DATE =>sysdate,
INTERVAL => 'sysdate+5/1440');
commit;
end;
/