ORA-600(qerltcInsertSelectRop_bad_state)错误
来源于: http://blog.itpub.net/22458783/viewspace-615501/
这是碰到的第一个11.2上的bug,在利用IGNORE_ROW_ON_DUPKEY_INDEX提示执行插入时,很可能碰到这个错误。
测试版本11.2.0.1 for Linux X86-64:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
建立一个测试表:
SQL> CREATE TABLE T
2 (ID NUMBER,
3 NAME VARCHAR2(30),
4 CONSTRAINT PK_T PRIMARY KEY (ID));
表已创建。
SQL> INSERT INTO T
2 VALUES (100, 'TEST');
已创建 1 行。
SQL> COMMIT;
提交完成。
SQL> INSERT INTO T
2 SELECT ROWNUM, OBJECT_NAME
3 FROM DBA_OBJECTS
4 ;
INSERT INTO T
*
第 1 行出现错误:
ORA-00001: 违反唯一约束条件 (YANGTK.PK_T)
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
2 INTO T
3 SELECT ROWNUM, OBJECT_NAME
4 FROM DBA_OBJECTS
5 ;
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
*
第 1 行出现错误:
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []
显然是由于使用IGNORE_ROW_ON_DUPKEY_INDEX提示引起了错误的产生。查询METALINK没有找到任何关于这个错误的描述。这也难怪,比较11.2才出来的时间不长,估计还没有什么人碰到这个bug。不过Oracle的测试人员没有测试到这个新特性的bug不太应该。
在alert文件中,这个错误信息如下:
Errors in file /data/oracle/diag/rdbms/test112/test112/trace/test112_ora_23223.trc (incident=2401):
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []
Incident details in: /data/oracle/diag/rdbms/test112/test112/incident/incdir_2401/test112_ora_23223_i2401.trc
对应的trace信息:
*** 2009-09-24 19:05:35.981
*** SESSION ID:(130.13965) 2009-09-24 19:05:35.981
*** CLIENT ID:() 2009-09-24 19:05:35.981
*** SERVICE NAME:(SYS$USERS) 2009-09-24 19:05:35.981
*** MODULE NAME:(SQL*Plus) 2009-09-24 19:05:35.981
*** ACTION NAME:() 2009-09-24 19:05:35.981
Incident 2401 created, dump file: /data/oracle/diag/rdbms/test112/test112/incident/incdir_2401/test112_ora_23223_i2401.trc
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []
详细错误信息为:
*** 2009-09-24 19:05:35.982
*** SESSION ID:(130.13965) 2009-09-24 19:05:35.982
*** CLIENT ID:() 2009-09-24 19:05:35.982
*** SERVICE NAME:(SYS$USERS) 2009-09-24 19:05:35.982
*** MODULE NAME:(SQL*Plus) 2009-09-24 19:05:35.982
*** ACTION NAME:() 2009-09-24 19:05:35.982
Dump continued from file: /data/oracle/diag/rdbms/test112/test112/trace/test112_ora_23223.trc
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []
========= Dump for incident 2401 (ORA 600 [qerltcInsertSelectRop_bad_state]) ========
*** 2009-09-24 19:05:35.984
dbkedDefDump(): Starting incident default dumps (flags=0x2, level=3, mask=0x0)
----- Current SQL Statement for this session (sql_id=81hhzbq7z7skv) -----
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
INTO T
SELECT ROWNUM, OBJECT_NAME
FROM DBA_OBJECTS
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
-------------------- -------- -------------------- ----------------------------
skdstdst()+36 call kgdsdst() 000000000 ? 000000000 ?
7FFFF5EB1E08 ? 000000001 ?
7FFFF5EB6308 ? 000000000 ?
ksedst1()+98 call skdstdst() 000000000 ? 000000000 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
ksedst()+34 call ksedst1() 000000000 ? 000000001 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
dbkedDefDump()+2736 call ksedst() 000000000 ? 000000001 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
ksedmp()+36 call dbkedDefDump() 000000003 ? 000000002 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
ksfdmp()+64 call ksedmp() 000000003 ? 000000002 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
dbgexPhaseII()+1764 call ksfdmp() 000000003 ? 000000002 ?
7FFFF5EB1E08 ? 000000001 ?
000000000 ? 000000000 ?
dbgexProcessError() call dbgexPhaseII() 2AAAAC2EF6F0 ? 2AAAAC2F03F0 ?
+2279 7FFFF5EBE0F8 ? 000000001 ?
000000000 ? 000000000 ?
测试发现,不管IGNORE_ROW_ON_DUPKEY_INDEX的哪种写法,都会引发这个600错误,但是如果插入数据量小的话,可能并不会引发错误:
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
2 INTO T
3 SELECT ROWNUM, OBJECT_NAME
4 FROM DBA_OBJECTS
5 WHERE ROWNUM <= 200;
已创建199行。
SQL> ROLLBACK;
回退已完成。
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
2 INTO T
3 SELECT ROWNUM, OBJECT_NAME
4 FROM DBA_OBJECTS
5 WHERE ROWNUM <= 1000;
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T(ID)) */
*
第 1 行出现错误:
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []
可以看到,如果插入200条记录,则不会报错。如果插入的数据量达到1000,则会引发ORA-600错误。
进一步测试发现,如果插入行数超过255,就会报错,看来应该是某个变量超过了上限导致的错误。
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T, PK_T) */
2 INTO T
3 SELECT *
4 FROM T1
5 WHERE ROWNUM <= 250;
已创建249行。
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T, PK_T) */
2 INTO T
3 SELECT *
4 FROM T1
5 WHERE ROWNUM <= 255;
已创建5行。
SQL> INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T, PK_T) */
2 INTO T
3 SELECT *
4 FROM T1
5 WHERE ROWNUM <= 256;
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(T, PK_T) */
*
第 1 行出现错误:
ORA-00600: 内部错误代码, 参数: [qerltcInsertSelectRop_bad_state], [], [], [], [], [], [], [], [], [], [], []