场景
今天上午,开发同事反映一条insert语句,导致数据库实例直接crash。我们通过分析alert日志。
Exception [type: SIGSEGV, SI_KERNEL(general_protection)] [ADDR:0x0] [PC:0x186015B, opiaba()+639] [flags: 0x0, count: 1]
Errors in file /u01/app/diag/rdbms/oradb/oradb/trace/oradb_ora_441.trc (incident=308737):
ORA-07445: exception encountered: core dump [opiaba()+639] [SIGSEGV] [ADDR:0x0] [PC:0x186015B] [SI_KERNEL(general_protection)] []
Incident details in: /u01/app/diag/rdbms/oradb/oradb/incident/incdir_308737/oradb_ora_441_i308737.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Jan 11 09:45:53 2021
Dumping diagnostic data in directory=[cdmp_20210111094553], requested by (instance=1, osid=441), summary=[incident=308737].
Mon Jan 11 09:45:55 2021
Sweep [inc][308737]: completed
Sweep [inc2][308737]: completed
Mon Jan 11 09:46:09 2021
Errors in file /u01/app/diag/rdbms/oradb/oradb/trace/oradb_pmon_32599.trc (incident=308017):
ORA-00600: internal error code, arguments: [17147], [0x2A0285000], [], [], [], [], [], [], [], [], [], []
Incident details in: /u01/app/diag/rdbms/oradb/oradb/incident/incdir_308017/oradb_pmon_32599_i308017.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Mon Jan 11 09:46:10 2021
Dumping diagnostic data in directory=[cdmp_20210111094610], requested by (instance=1, osid=32599 (PMON)), summary=[incident=308017].
Errors in file /u01/app/diag/rdbms/oradb/oradb/trace/oradb_pmon_32599.trc:
ORA-00600: internal error code, arguments: [17147], [0x2A0285000], [], [], [], [], [], [], [], [], [], []
PMON (ospid: 32599): terminating the instance due to error 472
System state dump requested by (instance=1, osid=32599 (PMON)), summary=[abnormal instance termination].
System State dumped to trace file /u01/app/diag/rdbms/oradb/oradb/trace/oradb_diag_32615_20210111094610.trc
Instance terminated by PMON, pid = 32599
上述可以看到,报了ORA-600和ORA-07445的错误。继续分析dump文件,如下:
[oracle@oradb trace]$ more /u01/app/diag/rdbms/oradb/oradb/incident/incdir_308737/oradb_ora_441_i308737.trc
*** 2021-01-11 09:45:47.445
dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0x3, level=3, mask=0x0)
----- Current SQL Statement for this session (sql_id=aa74781kf359y) -----
begin
insert into xxx_xxx_xxx (ID, PARENT_ID, PARENT_TYPE,
YEAR, PERIOD, DR_CR,
CO_CODE, ACCOUNT_ID, ACC_TYPE,
ACC_TYPE_NAME, ACC_CODE, ACC_NAME,
MONEY, REMARK,
BILL_ID,OPPOSITE_COMPANY,LOAN_AR_BILL_ACC_ID,REC_NO)
values (:1 , :2 , :3 ,
:4 , :5 , :6 ,
:7 , :8 , :9 ,
:10 , :11 , :12 ,
:13 , :14 ,
:15 ,:16 ,:17 ,
:18 )
;
类似这样的语句有5000条,每一条有18个绑定变量,超过了65535绑定变量,数据库直接crash。
metalink也佐证了上述结论:
Instance terminated due to ora-7445 [opiaba] which leads to ora-600 [17147]. ora-7445 [opiaba] error is reported due to the use of more than 65535 binds in the same sql / plsql statement.
You may find some or all of the following function codes in the 'Call Stack' portion of the trace file:
opiaba opiprs rpiswu2 kksLoadChild kxsGetRuntimeLock kksfbc
This scenario is reported in bug 13973845 which is closed of duplicated bug 12578873.
继续查看metalink,得到的解决方案如下:
Please download and install patch 12578873. Bug is fixed in Windows Bundle 13 (Patch 20263424) for 11.2.0.4. Workaround is to modify your application to use less than 65535 binds.
Please note bug fix will only prevent instance termination but will not allow the use of more than 65535 binds in the same sql / plsql statement. You have to use less than 65535 binds in the same sql / plsql statement.
让程序员修改sql语句,小于65535的绑定变量。