文章图片标题

oracle下使用job调度存储过程

分类:oracle 作者:阳光倾城 评论:0 点击: 383 次 日期:2016-09-21

 

-- commond line:
declare
job number;
begin
  sys.dbms_job.submit(job => :job,
                      what => 'REPORT.PR_SCHEDULER;',
                      next_date => to_date('20-09-2016 23:59:59', 'dd-mm-yyyy hh24:mi:ss'),
                      interval => 'sysdate+1');
  commit;
end;
/

--- for plsql sql window:

-- 新增调度job
declare job number;
begin
  sys.dbms_job.submit(job,
                      'REPORT.PR_SCHEDULER;',
                      to_date('22-09-2016 23:59:59', 'dd-mm-yyyy hh24:mi:ss'),
                      'sysdate+1');
  commit;
end;
-- 激活job
declare jobid number;
begin
  select job into jobid from dba_jobs s where s.what='REPORT.PR_SCHEDULER;';
  sys.dbms_job.run(jobid);
  commit;
end;

-- 删除无效job
begin
sys.dbms_job.remove(21);
commit;
end;




声明: 除非注明,本文属( 阳光倾城 )原创,转载请保留链接: http://www.tomrrow.com/archives-8353.html