阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

ORA-23421: job number XXXX is not a job in the job queue

187次阅读
没有评论

共计 2221 个字符,预计需要花费 6 分钟才能阅读完成。

检查一个数据库的 alert 日志时,查看一些 job 报错,由于是自己的测试库,考虑把 job 停止掉。但是遇到如下错误:

sys@im1>exec DBMS_JOB.broken(275,true);

BEGIN DBMS_JOB.broken(275,true); END;

*

ERROR at line 1:

ORA-23421: job number 275 is not a job in the job queue

ORA-06512: at “SYS.DBMS_SYS_ERROR”, line 86

ORA-06512: at “SYS.DBMS_IJOB”, line 529

ORA-06512: at “SYS.DBMS_JOB”, line 245

ORA-06512: at line 1

查看了资料说:不是 job 的 owner 的用户 delete,remove,broken 一个 job 时,会报错:ORA-23421: job number XXXX is not a job in the job queue

只有 job 的 owner 才能够对 job 进行修改变更。

但是查询找到 job 的 owner priv_user

sys@im1>select job, what, log_user, priv_user,broken from dba_jobs where job=275;

      JOB WHAT                                    LOG_USER  PRIV_USER  B

———- —————————————- ———- ———- –

      275 WEB_SMS.cleanAppBuffer;                  SYSTEM    SYSTEM    N

 

2. 以上面的 sql 语句 priv_user 登录数据库

system@im1>exec DBMS_JOB.broken(295,false);

PL/SQL procedure successfully completed.

3. 执行如下语句:

system@im1>exec DBMS_JOB.broken(295,true);

PL/SQL procedure successfully completed.

system@im1>commit;

Commit complete.

system@im1>select job, log_user, priv_user,broken from dba_jobs where job in (295);

      JOB LOG_USER  PRIV_USER  B

———- ———- ———- –

      295 SYSTEM    SYSTEM    Y

 

另一种方法是以 sys 用户:

sys@im1>exec DBMS_IJOB.broken(275,true);

PL/SQL procedure successfully completed.

 

sys@im1>select job, what, log_user, priv_user,broken from dba_jobs where job=275;

      JOB WHAT                                    LOG_USER  PRIV_USER  B

———- —————————————- ———- ———- –

      275 WEB_SMS.cleanAppBuffer;                  SYSTEM    SYSTEM    Y

 

sys@im1>exec DBMS_IJOB.broken(275,false);

PL/SQL procedure successfully completed.

sys@im1>select job, what, log_user, priv_user,broken from dba_jobs where job=275;

      JOB WHAT                                    LOG_USER  PRIV_USER  B

———- —————————————- ———- ———- –

      275 WEB_SMS.cleanAppBuffer;                  SYSTEM    SYSTEM    N

尝试以 system 用户执行命令此命令,会报错:

system@im1>exec DBMS_IJOB.broken(295,false);

BEGIN DBMS_IJOB.broken(295,false); END;

      *

ERROR at line 1:

ORA-06550: line 1, column 7:

PLS-00201: identifier ‘DBMS_IJOB.BROKEN’ must be declared

ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

参考文章:

DBMS_JOB Remove Procedure Fails With ORA-23421 [ID 452864.1]

ORA-23421 OR ORA-03421 TRYING TO ALTER A JOB [ID 1029977.6]

ORA-23421: job number is not a job in the job queue when dropping an existing job [ID 1214884.1]

当 job$ 的索引 INDEX I_JOB_JOB 损坏,也会导致此错误,对索引进行重建即可!

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2221字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中