如何在oracle作业调度中启用程序?

时间:2016-03-06 08:14:02

标签: oracle plsql toad

这是我的代码。当我执行执行

dbms_scheduler.run_job('daily_update_job_v1'); 

收到以下错误

  

ORA-27367:program" .PROG_RESET_LOG_STATUS_V1"与此相关   工作被禁用。

有关以下问题的任何帮助。感谢

CREATE OR REPLACE PROCEDURE reset_log_status_v1 ( LOG_STATUS  IN   
VARCHAR2) IS
BEGIN
 UPDATE (
      SELECT
            B.LOG_STATUS 

    FROM    LP_QUAT_ISSUE_MST A,
            LP_QUAT_ISSUE_DTL B
    WHERE   A.QUAT_NO = B.QUAT_NO 
    AND     (trunc(A.QUAT_DT) + A.NO_DAY_GIVEN) <= trunc(SYSDATE)
)   
SET LOG_STATUS ='N';
END;

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


BEGIN
DBMS_SCHEDULER.CREATE_SCHEDULE (
 schedule_name   => 'daily_update_v1',
 start_date    => SYSTIMESTAMP,
 repeat_interval  => 'FREQ=DAILY; INTERVAL=1',
 end_date     => SYSTIMESTAMP + INTERVAL '365' day,
 comments     => 'DAILY UPDATE');
END;


BEGIN
DBMS_SCHEDULER.CREATE_JOB (
  job_name     => 'daily_update_job_v1',
  program_name   => 'PROG_RESET_LOG_STATUS_V1',
  schedule_name   => 'daily_update_v1'
  );
END;

execute dbms_scheduler.run_job('daily_update_job_v1');

1 个答案:

答案 0 :(得分:0)

DBMS_SCHEDULER.ENABLE('PROG_RESET_LOG_STATUS_V1');