1、作业协调器
SQL> select program from v$process where program like ‘%J%’;
oracle@host01.example.com (CJQ0)
有1个作业协调器
2、作业队列进程数量
SQL> select NAME,VALUE from v$parameter where lower(NAME)=‘job_queue_processes’;
NAME VALUE
job_queue_processes 4000
SQL> select BANNER from v$version;
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
如果是12c默认值应该是1000,
18c默认是4000了
create table times(c1 date);
alter session set nls_date_format=‘dd-mm-yy hh24:mi:ss’;
3、作业、程序、时间表
作业,可以是SQL语句
execute dbms_scheduler.create_job(-
job_name=>‘savedate’,-
job_type=>‘plsql_block’,-
job_action=>‘insert into times values(sysdate);’,-
start_date=>sysdate,-
repeat_interval=>‘freq=minutely;interval=1’,-
enabled=>true,-
auto_drop=>false);
作业,可以是存储过程
execute dbms_scheduler.create_job(-
job_name=>‘savedate2’,-
job_type=>‘STORED_PROCEDURE’,-
job_action=>‘p_dbms_scheduler_savedate2’,-
start_date=>sysdate,-
repeat_interval=>‘freq=minutely;interval=1’,-
enabled=>true,-
auto_drop=>false);
4、建立的作业、程序、时间表存储在数据字典
在数据字典中user_scheduler_jobs/all_scheduler_jobs/dba_scheduler_jobs
select JOB_NAME,JOB_TYPE,JOB_ACTION,REPEAT_INTERVAL,start_date from dba_scheduler_jobs where job_name=UPPER(‘savedate’);
![在这里插入图片描述](https://www.www.zyiz.net/i/ll/?i=0b4c51ed1b244bc89e270ea93fa6e520.jpg
5、
禁止、删除
exec dbms_scheduler.disable(‘savedate’);
exec dbms_scheduler.drop_job(‘savedate’);
–定义一个存储过程
create or replace procedure p_dbms_scheduler_savedate2 as
begin
insert into times values(sysdate);
commit;
end;