1.job相关的功能。
SQL> desc dbms_job;
Element Type
------------------ ---------
ANY_INSTANCE CONSTANT
ISUBMIT PROCEDURE
SUBMIT PROCEDURE
REMOVE PROCEDURE
CHANGE PROCEDURE
WHAT PROCEDURE
NEXT_DATE PROCEDURE
INSTANCE PROCEDURE
INTERVAL PROCEDURE
BROKEN PROCEDURE
RUN PROCEDURE
USER_EXPORT PROCEDURE
BACKGROUND_PROCESS FUNCTION
IS_JOBQ FUNCTION
2.用户下的job信息
select * from user_jobs;
正在运行的job
select * from dba_jobs_running;
3.创建job
variable jobid number;
begin
dbms_job.submit(:jobid,'proc_CreateAllStreportData(1);',trunc(sysdate)+18/24,'trunc(sysdate)+1+18/24');
end;
/
show err;
begin
sys.dbms_job.submit(job => :job,
what => 'P_CLEAR_PACKBAL;',
next_date => to_date('04-08-2008 05:44:09', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'sysdate+ 1/360');
commit;
end;
/
4.删除job
exec dbms_job.remove(job_id);
exp:
exec dbms_job.remove(41);
commit;--不加commit是删不掉的
5.运行JOB
begin
dbms_job.run(:job1);
end;
/
6.中止job
dbms_job.broken(:job1);
7.修改job
dbms_job.change(:job,:what,:next_date,:interval);
dbms_job.what(:job,:what);
dbms_job.next_date(:job,:next_date);
dbms_job.instance(:job,:instance);
dbms_job.interval(:job,:interval);
dbms_job.broken(:job,:broken,:next_date);
8.job的相关参数设定、字段属性定义、时间间隔设定请参见:
http://www.cnblogs.com/advocate/archive/2010/05/05/1728218.html