甲骨文:执行作业 dbms_scheduler
Oracle: execute a Job dbms_scheduler
我想在 Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production 中执行调度程序
我有这个包裹:
create or replace PACKAGE "S_IN_TDK" is
procedure parseMsg;
end;
和这份工作
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
program_name => 'S_IN_TDK.parseMsg',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
但是当我 运行 作业时我得到了这个错误:
Fallo al procesar el comando SQL
- ORA-27476: "S_IN_TDK.PARSEMSG" does not exist
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 2
我也试过了
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
但后来我得到了这个错误:
Informe de error -
ORA-06550: line 2, column 3:
PLS-00306: wrong number or types of arguments in call to 'CREATE_JOB'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
参数 program_name
需要调度程序 PROGRAM
对象的名称。如果你想 运行 一个内联程序,那么请改用 job_action
参数:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
请注意,job_action
需要一个完整的 PL/SQL 块作为输入。
DBMS_SCHEDULER.CREATE_JOB
具有三个必需参数:job_name
、job_type
和 job_action
。添加 job_type => 'PLSQL_BLOCK',
并添加 enabled => true,
以立即完成作业 运行。
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_type => 'PLSQL_BLOCK',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
enabled => true,
comments => 'Job that polls device n2 every 10 seconds');
END;
/
使用此查询检查作业状态:
select *
from dba_scheduler_job_run_details
where job_name = 'PARSEMSG'
order by log_date desc;
我想在 Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production 中执行调度程序 我有这个包裹:
create or replace PACKAGE "S_IN_TDK" is
procedure parseMsg;
end;
和这份工作
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
program_name => 'S_IN_TDK.parseMsg',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
但是当我 运行 作业时我得到了这个错误:
Fallo al procesar el comando SQL
- ORA-27476: "S_IN_TDK.PARSEMSG" does not exist
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 2
我也试过了
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
但后来我得到了这个错误:
Informe de error -
ORA-06550: line 2, column 3:
PLS-00306: wrong number or types of arguments in call to 'CREATE_JOB'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
参数 program_name
需要调度程序 PROGRAM
对象的名称。如果你想 运行 一个内联程序,那么请改用 job_action
参数:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
comments => 'Job that polls device n2 every 10 seconds');
END;
请注意,job_action
需要一个完整的 PL/SQL 块作为输入。
DBMS_SCHEDULER.CREATE_JOB
具有三个必需参数:job_name
、job_type
和 job_action
。添加 job_type => 'PLSQL_BLOCK',
并添加 enabled => true,
以立即完成作业 运行。
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'parseMsg',
job_type => 'PLSQL_BLOCK',
job_action => 'begin S_IN_TDK.parseMsg; end;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=10',
--job_style => 'LIGHTWEIGHT',
enabled => true,
comments => 'Job that polls device n2 every 10 seconds');
END;
/
使用此查询检查作业状态:
select *
from dba_scheduler_job_run_details
where job_name = 'PARSEMSG'
order by log_date desc;