今天,开发反应一个job执行有时成功,有时失败,让帮忙查看下原因。
检查dba_jobs视图发现FAILURES为0,broken为N
检查alert log发现了报错信息:
ORA-12012: 自动执行作业 43 出错
ORA-01400: 无法将 NULL 插入 ("a"."gw")
ORA-06512: 在 "a.gw", line 22
ORA-06512: 在 "a.pre_gw", line 3
ORA-06512: 在 line 1
那么为什么明明报错了,但是failures显示为0呢,那么查查这个failures的意思吧:
dba_jobs视图:
JOB Identifier of job. Neither import/export nor repeated executions change it. LOG_USER USER who was logged in when the job was submitted PRIV_USER USER whose default privileges apply to this job SCHEMA_USER select * from bar means select * from schema_user.bar LAST_DATE Date that this job last successfully executed LAST_SEC Same as LAST_DATE. This is when the last successful execution started. THIS_DATE Date that this job started executing (usually null if not executing) THIS_SEC Same as THIS_DATE. This is when the last successful execution started. NEXT_DATE Date that this job will next be executed NEXT_SEC Same as NEXT_DATE. The job becomes due for execution at this time. TOTAL_TIME Total wallclock time spent by the system on this job,in seconds BROKEN If Y,no attempt is being made to run this job. See dbms_jobq.broken(job). INTERVAL A date function FAILURES How many times has this job started and failed since its last success? 哦,原来是从上次成功执行后算的,也就是说成功执行一次后,就清零了。再次查看报错的时间,是几天前,那么昨天是成功执行了的,因此是0。 WHAT Body of the anonymous PL/SQL block that this job executes NLS_ENV alter session parameters describing the NLS environment of the job MISC_ENV a versioned raw maintained by the kernel INSTANCE Instance number restricted to run the job