oracle job的创建、修改、删除、运行

-------------查询JOB-----------------
select job, what, next_date, next_sec, sysdate, failures, broken,interval
  from user_jobs a;
  
 select * from user_jobs; 
 
-------------添加JOB-----------------
variable n number;
begin
  dbms_job.submit(:n, 'MY_JOP;', sysdate,'sysdate+2/(24*60*60)');
  commit;
end;
--这两种方式都可以创建
begin
  sys.dbms_job.isubmit(job => 101,
                   what => 'proc_city_area;',
                   next_date => to_date('29-12-2016', 'dd-mm-yyyy'),
                   interval => 'TRUNC(SYSDATE)+1');
 
  COMMIT;
end;


-------------修改JOB-----------------
begin
  dbms_job.change(62 ,'MY_JOP;', sysdate,'sysdate+2/(24*60)' );
  commit;
end;
begin
  dbms_job.change(62 ,'MY_JOP;', to_date('2016-08-01 22:00:00', 'yyyy-mm-dd hh24:mi:ss'),'sysdate+1');
  commit;
end;

-------------删除JOB-----------------
begin
 dbms_job.remove(41);
end;

-------------运行Job-----------------------
begin
 dbms_job.run(41);
end;

你可能感兴趣的:(oracle)