DBMS Scheduler error: ORA-27367: program "Schema.PROG_programname" associated with this job is disabled

DBMS Scheduler error: ORA-27367: program "Schema.PROG_programname" associated with this job is disabled

我使用 dbms 创建了一个 oracle 作业 scheduler.But 状态在执行中失败。它给出了以下错误。 'ORA-27367: program "Schema.PROG_SIXMONTHPRIORITY" associated with this job is disabled'可是我没有禁用这个才行。 'program_action => 'SIXMONTHPRIORITY'' 是我在模式中创建的过程。当我单独执行该过程时,它会被执行。

BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM (
program_name      => 'PROG_SIXMONTHPRIORITY',
program_action     => 'SIXMONTHPRIORITY',
program_type      => 'STORED_PROCEDURE');
END;

BEGIN
DBMS_SCHEDULER.CREATE_SCHEDULE (
 schedule_name   => 'P_SCHEDULE_3',
 start_date    => SYSTIMESTAMP,
 repeat_interval  => 'FREQ= MINUTELY; INTERVAL=30; BYMONTHDAY=19; BYHOUR=13',
 end_date     => SYSTIMESTAMP + INTERVAL '1' day,
 comments     => 'Every 30 minutes');
END;

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
  job_name     => 'CAL_SIX_MON_PRIORITY_3',
  program_name   => 'PROG_SIXMONTHPRIORITY',
  schedule_name   => 'P_SCHEDULE_3');
END;

谁能找出这个错误的原因?

您创建的调度程序对象也可以单独启用或禁用。确保在创建调度程序对象时指定“enabled => true”:

BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM (
        program_name      => 'PROG_SIXMONTHPRIORITY',
        program_action     => 'SIXMONTHPRIORITY',
        program_type      => 'STORED_PROCEDURE',
        enabled => true);
END;

BEGIN
    DBMS_SCHEDULER.CREATE_SCHEDULE (
        schedule_name   => 'P_SCHEDULE_3',
        start_date    => SYSTIMESTAMP,
        repeat_interval  => 'FREQ= MINUTELY; INTERVAL=30; BYMONTHDAY=19; BYHOUR=13',
        end_date     => SYSTIMESTAMP + INTERVAL '1' day,
        comments     => 'Every 30 minutes');
END;

BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
        job_name     => 'CAL_SIX_MON_PRIORITY_3',
        program_name   => 'PROG_SIXMONTHPRIORITY',
        schedule_name   => 'P_SCHEDULE_3',
        enabled => true);
END;

对于已有对象,可以直接设置属性:

BEGIN
    DBMS_SCHEDULER.ENABLE ('PROG_SIXMONTHPRIORITY');
    DBMS_SCHEDULER.ENABLE ('CAL_SIX_MON_PRIORITY_3');
END;
/