Oracle数据库出现出ORA-00600[6002]与[25027]报错处理
Oracle数据库出现出ORA-00600[6002]报错处理
一套Oracle 10g RAC出现故障强行恢复后,日志出现ORA-00600[6002]与ORA-00600[25027]报错,详细日志如下:
Mon Jan 06 15:39:28 BEIST 2013Errors in file /app/oracle/admin/TESTDZ/udump/TESTDZ2_ora_4063486.trc:ORA-00600: internal error code, arguments: [6002], [0], [18], [2], [0], [], [],[]Mon Jan 06 15:39:32 BEIST 2013Trace dumping is performing id=[cdmp_20140106153931] [color=darkred]ORA-00600: internal error code, arguments: [25027], [6], [0], [], [], [], [], []
查看trc文件后,获取重要信息如下:Block header dump: 0x10c63714Object id on Block? Yseg/obj: 0xd4cf csc: 0xc70.421afef9 itc: 2 flg: E typ: 2 - INDEX brn: 0 bdba: 0x10c6350b ver: 0x01 opc: 0 inc: 0 exflg: 0Itl Xid Uba Flag Lck Scn/Fsc0x01 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.000000000x02 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
我们从官方和TRC报错来分析,ORA-00600 6002错误一般都与索引相关,具体内容是指:当Oracle试图去插入一个索引键值时,首先需要找到合适的位置,并且去进行相关校验,校验内容包括索引列数量、数据大小等,一旦发现不一致,则将出现ORA-600 的 6002错误。
Oracle官方的解释如下:Oracle was trying to insert a key and key data into a b*tree index. In order to do this, it had to first find the correct leaf block to do the insert. Once the correct leaf block is retrieved, Oracle validates the block by checking the data size and number of columns in the key. If there is a mismatch then ORA-600 [6002] is reported.
其主要的参数含义如下:Arg [a] Number of bytes in keydata Arg Number of bytes in the index layer of the leaf header Arg [c] Number of columns in index search key structure Arg [d] Number of columns in the index layer fo the leaf header
所以如果遇到这个错误,首先应该找到出现问题的索引对象,可以尝试通过重建索引消除这个错误影响。如下是跟踪文件中体现的出现错误的块头信息:
Block header dump: 0x10c63714Object id on Block? Y[color=darkred]seg/obj: 0xd4cf csc: 0xc70.421afef9 itc: 2 flg: E typ: 2 - INDEX brn: 0 bdba: 0x10c6350b ver: 0x01 opc: 0 inc: 0 exflg: 0
不过有时候也有数据表的报错,如下:Block header dump: 0x0b429283Object id on Block? Y[color=darkred]seg/obj: 0x1713a9 csc: 0xc70.423ecdb1 itc: 2 flg: - typ: 1 - DATA fsl: 0 fnx: 0x0 ver: 0x01
我们可以看到出现问题的对象号是d4cf,类型正是索引,如果是数据表呢,通过备份恢复或重建表进行恢复。我们以索引为例,通过数据库查询可以找到这个对象名称,通过重建索引即可解决:
SQL>select object_name from dba_objects where object_id = to_number('d4cf','xxxxx');OBJECT_NAME--------------------------------------------------------------------------------PK_SERVERVATIO20
SQL>alter index testdz_zsb.PK_SERVERVATIO20 rebuild online;
ORA-00600【6002】错误需要根据对象的不同进行分析,通常是可以通过索引重建解决的。有时候问题会出现在IOT对象上,可以通过备份数据,TRUNCATE再INSERT回插记录解决。