|
oracle创建三个定时任务,每个小时调用一次REPORT_HOUR,每天调用一次REPORT_DAY,每个月调用一次REPORT_MONTH- declare
- job1 number;
- job2 number;
- job3 number;
- begin
- sys.dbms_job.submit(job => job1,
- what => 'REPORT_HOUR;',
- next_date => to_date('01-01-2014 00:00:00', 'dd-mm-yyy hh24:mi:ss'),
- interval => 'sysdate+1/24');
-
- sys.dbms_job.submit(job => job2,
- what => 'REPORT_DAY;',
- next_date => to_date('01-01-2014 00:00:00', 'dd-mm-yyy hh24:mi:ss'),
- interval => 'sysdate+1');
-
- sys.dbms_job.submit(job => job3,
- what => 'REPORT_MONTH;',
- next_date => to_date('01-01-2014 00:00:00', 'dd-mm-yyy hh24:mi:ss'),
- interval => 'TRUNC(LAST_DAY(SYSDATE)+1)');
- end;
复制代码 创建完成后,可通过查询dba_jobs表查询当前数据库的定时任务。删除定时任务,通过上一条语句查询要删除任务的JOB字段值,通过此值来删除对应任务。- sys.dbms_job.remove(job1);
复制代码
|
|