日期:2014-05-16  浏览次数:20468 次

如何诊断 job 执行失败

如何诊断 job 执行失败

1. 看job有没有机会执行
  确保init.ora中job_queue_processes参数是否被设为>0的值.
  show parameter job_queue_processes

2. 看是否执行job出错.
    查看alert.log获取出错信息.

3. 看是否job所调用的procedure/package出错.
   这个需要你自己在procedure/package中自己书写记录错误日志的代码.

4. 经常查看你的DBA_JOBS看看,相应的job是不是broken了,
BROKEN: Y: no attempt is made to run this job
                N: an attempt is made to run this job

A job can be broken in two ways:
Oracle has failed to successfully execute the job after sixteen attempts. The job has been explicitly marked as broken by using the procedure DBMS_ JOB.BROKEN.
在尝试(默认)16次后还是不能成功执行,该job会被oracle自动标记为broken=y

 或者你可以手动运行看看,有什么错误提示。
EXECUTE DBMS_JOB.RUN(JOB_ID);