oracle 中的pl/sql自动运行的特性:在unixde的corn 实用程序自动调度任务运行在oracle中的pl/sql中用dbms_job包允许你调度pl/sql
oracle 中的pl/sql自动运行的特性:
在unixde的corn 实用程序自动调度任务运行
在oracle中的pl/sql中用dbms_job包允许你调度pl/sql语句块,使它在指定的时间自动运行。该语句将被oracle的某后台进程处理。为拉便于运行,需要设置二个init.ora参数:
1, job_queue_process 指定启动的后台处理数。如果是0或没有设置,,将没有后台处理进入作业,它们就不会运行。
2, job_queue_interval以秒为单位指定每一个过程在检查新的作业前等待的时间。在job_queue_interval所代表的
秒数内,一个作业最多只能执行一次。
----available online as part of dbms_job.sql
create sequene temp_seq
start with 1
increment by 1;
create or rrplace procedure tempinsert as
begin
insert into temp_table (num_col,char_col)
value (temp_seq.nextval,to_char(sysdate,'dd-mon-yyyy hh24:mi:ss));
commit
end tempinsert;
下列sql*plus脚本,我们可以使tempinsert每90秒运行一次;
------available online as part of dbms_job.sql
sql> variable v_jobnum number
sql> begin
2 dbms_job.submit(:v_jobnum,'tempinsert;',sysdate,'sysdate+(90/24*60*60)');
3 commit;
4 end;