日期:2014-05-16  浏览次数:20587 次

oracle数据库查询、删除、创建作业
1、查询作业
select job,what,next_date,next_sec,failures,broken from user_jobs;

2、删除作业
begin
     dbms_job.remove(:JOB_NUM);
end;

3、创建作业
--每小时执行
DECLARE
  jobno number;
BEGIN
  dbms_job.submit(jobno, 'RAW_PREACTHOUR(sysdate);', to_date('2010-07-05 16:58:00','yyyy-mm-dd hh24:mi:ss'), 'to_date(to_char(sysdate,''yyyymmddhh24mi''),''yyyymmddhh24mi'')+1/24');
END;
--每日05:10:00执行
DECLARE
  jobno number;
BEGIN
  dbms_job.submit(jobno, 'CUR_DAYREPORT_WIREWAYS(sysdate);', to_date('2010-07-07 05:10:00','yyyy-mm-dd hh24:mi:ss'), 'to_date(to_char(sysdate,''yyyymmddhh24mi''),''yyyymmddhh24mi'')+1');
END;
--每月的第七天05:16:00执行
DECLARE
  jobno number;
BEGIN
  dbms_job.submit(jobno, 'RAW_REPORTING_YEAR(sysdate);', to_date('2011-01-07 05:16:00','yyyy-mm-dd hh24:mi:ss'), 'TRUNC(LAST_DAY(SYSDATE ) + 7) + 316/1440');
END;