SQL> select e.*,rownum,rowid from XXXXXMIN.XXX_XX_XX_XXX_OLD e where e.AX_ID=**** and e.BX_ID=**;
AX_ID BX_ID COMMITED_XXXXX UNCOMMITED_XXXXX UNSHARED_XXXXX UPDATED_T ROWNUM ROWID
---------- ---------- -------------- ---------------- -------------- --------- ---------- ------------------
**** ** ********** * * ********* * AABOd5AAIAAAGcaABR
SQL> select /*+ full(e) */ e.*,rownum,rowid from XXXXXMIN.XXX_XX_XX_XXX_OLD e where e.AX_ID=**** and e.BX_ID=**;
AX_ID BX_ID COMMITED_XXXXX UNCOMMITED_XXXXX UNSHARED_XXXXX UPDATED_T ROWNUM ROWID
---------- ---------- -------------- ---------------- -------------- --------- ---------- ------------------
**** ** ********** * * ********* * AABOd5AAIAABFRCACk
小结:在执行delete from "XXXXXMIN"."XXX_XX_XX_XXXXX_OLD" where "AX_ID" = :1时,该SQL的执行计划是走索引扫描,因为表与索引之间的逻辑数据不一致(索引列的值和行所对应的ROWID组成的索引数据与表数据不一致),在变量“:1”的值刚好是异常的值时,导致了ORA 600 [13011]的报错。
三、解决方案
1、重建XXXXXMIN.PK_XXX_XX_XX_XXXXX索引
因XXXXXMIN.PK_XXX_XX_XX_XXXXX为"AX_ID", "BX_ID"列的联合主键索引,并且AX_ID列作为"XXXXXMIN"."XXX_VX" ("ID")的关联外键,BX_ID列作为 "XXXXXMIN"."XXX_DATAXXXXX" ("ID")的关联外键。所以为避免对业务造成影响,使用ONLINE在线重建的方式重建XXXXXMIN.PK_XXX_XX_XX_XXXXX索引。
ALTER INDEX XXXXXMIN.PK_XXX_XX_XX_XXX REBUILD ONLINE;
2、验证重建索引后的数据
1 select /*+ INDEX_FFS(t pk_xxx_xx_xx_xxx) */ rowid,
2 dbms_rowid.ROWID_RELATIVE_FNO(rowid) relative_fno,
3 dbms_rowid.ROWID_BLOCK_NUMBER(rowid) block
4 from XXXXXMIN.XXX_XX_XX_XXXXX_OLD t where (t.AX_ID is not null or BX_ID is not null)
5 minus
6 select /*+ FULL(t1)*/ rowid,
7 dbms_rowid.ROWID_RELATIVE_FNO(rowid) relative_fno,
8 dbms_rowid.ROWID_BLOCK_NUMBER(rowid) block from XXXXXMIN.XXX_XX_XX_XXXXX_OLD t1;
no rows selected