variable jobno number; dbms_job.submit(:jobno, —-job号 'your_procedure;',—-执行的存储过程, ';'不能省略 next_date, —-下次执行时间 'interval' —-每次间隔时间,interval以天为单位 );
show parameter job_queue_process;
select * from v$parameter where name='job_queue_processes';
alter system set job_queue_processes = 10;
字段(列) 类型 描述 job number 任务的唯一标示号 log_user varchar2(30) 提交任务的用户 priv_user varchar2(30) 赋予任务权限的用户 schema_user varchar2(30) 对任务作语法分析的用户模式 last_date date 最后一次成功运行任务的时间 last_sec varchar2(8) 如hh24:mm:ss格式的last_date日期的小时,分钟和秒 this_date date 正在运行任务的开始时间,如果没有运行任务则为null this_sec varchar2(8) 如hh24:mm:ss格式的this_date日期的小时,分钟和秒 next_date date 下一次定时运行任务的时间
create table t( id varchar2(30), name varchar2(30) );
create or replace procedure proce_t is
begin
insert into t(id, name) values('1', to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'));
commit;
end proce_t;
/
variable jobno number; begin dbms_job.submit(:jobno,'proce_t;', sysdate, 'sysdate+1/24/60'); commit; end; /
pl/sql procedure successfully completed jobno --------- 25
sql> select job, next_date, next_sec, failures, broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 25 2012/9/14 1 10:59:46 0 n
sql> select job, next_date, next_sec, failures, broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 25 2012/9/14 1 11:01:48 0 n
begin dbms_job.broken(25, true, sysdate); commit; end; /
pl/sql procedure successfully completed
sql> select job, next_date, next_sec, failures, broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 25 4000/1/1 00:00:00 0 y
sql> select job, next_date, next_sec, failures, broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 25 4000/1/1 00:00:00 0 y
begin dbms_job.run(25); commit; end; /
sql> select job, next_date, next_sec, failures, broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 25 2012/9/14 1 11:06:17 0 n
show parameter job_queue_processes;
alter system set job_queue_processes=10;
variable jobno number; begin dbms_job.submit(:jobno, 'proce_t;', sysdate, 'sysdate+1/24/12'); --interval是以天为单位的 commit; end; /
select job,next_date,next_sec,failures,broken from user_jobs;
sql> select job,next_date,next_sec,failures,broken from user_jobs; job next_date next_sec failures broken ---------- ----------- ---------------- ---------- ------ 26 2012/9/14 1 11:12:08 0 n 25 2012/9/14 1 11:07:18 0 n
Interval => TRUNC(sysdate,'mi') + 1/(24*60)
Interval => TRUNC(sysdate) + 1 +1/(24)
Interval => TRUNC(next_day(sysdate,'星期一'))+1/24
Interval =>TRUNC(LAST_DAY(SYSDATE))+1+1/24
Interval => TRUNC(ADD_MONTHS(SYSDATE,3),'Q') + 1/24
Interval => ADD_MONTHS(trunc(sysdate,'yyyy'),6)+1/24
Interval =>ADD_MONTHS(trunc(sysdate,'yyyy'), 12)+1/24
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有