oracle-创建job执行存储过程

---oracle9以前版本的job方式,目前11G的仍然可用,只是不显示job名称---
SQL> VARIABLE SCL_WL_RK number;
SQL> 
SQL> begin
  2    dbms_job.submit(:SCL_WL_RK,'WL_RK;',sysdate,'sysdate+10/(60*24)');--每10分钟一次
  3  commit;
  4  end;
  5  /
PL/SQL procedure successfully completed
SCL_WL_RK
----查询job状态
----job id,job 名称,失败次数,状态
SQL> select job,what,failures,broken from user_jobs;
       JOB WHAT           FAILURES BROKEN
---------- ------------------------------------------------------
       103 WL_RK;          0 N   

---oracle11G的job方式,可显示job名称--
SQL>begin
  sys.dbms_scheduler.create_job(job_name            => '用户名.job显示名称',
                                job_type            => 'PLSQL_BLOCK',
                                job_action          => 'begin
  存储过程名;
  end;',
                                start_date          => to_date('12-08-2015 09:30:00', 'dd-mm-yyyy hh24:mi:ss'),
                                repeat_interval     => 'Freq=MINUTELY;Interval=14',
                                end_date            => to_date(null),
                                job_class           => 'DEFAULT_JOB_CLASS',
                                enabled             => true,
                                auto_drop           => false,
                                comments            => '每14分钟执行一次wl_rk存储过程');
end;
/

 

你可能感兴趣的:(oracle)