数据库版本:12.2.0
操作系统版本:RHEL7.2
最近观察到一个数据库alert日志老是报硬解析太多错误,且对应的sql语句都是查看数据字典表:
2017-06-16T08:46:46.417468+08:00 TTEST(4):WARNING: too many parse errors, count=100 SQL hash=0x03b29074 TTEST(4):PARSE ERROR: ospid=3504, error=12850 for statement: 2017-06-16T08:46:46.417595+08:00 TTEST(4):SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, c.comments AS remarks FROM all_objects o, all_tab_comments c WHERE o.owner LIKE :1 ESCAPE '/' AND o.object_name LIKE :2 ESCAPE '/' AND o.object_type IN ('xxx', 'TABLE', 'VIEW') AND o.owner = c.owner (+) AND o.object_name = c.table_name (+) ORDER BY table_type, table_schem, table_name TTEST(4):Additional information: hd=0x64d87278 phd=0x6853e3f0 flg=0x110676 cisid=110 sid=110 ciuid=110 uid=110
看到都是数据库内部的sql并没有感觉会是开发的问题,检查了对应的数据库用户的权限以及数据配置,但是并没有发现有问题。
搜索了一下,发现不少网友的Hibernate程序都遇到过这个问题。
在eagle的网站中也发现类似问题:
SELECT NULL AS table_cat, c.owner AS table_schem, c.table_name, c.column_name, c.POSITION AS key_seq, c.constraint_name AS pk_name FROM all_cons_columns c, all_constraints k WHERE k.constraint_type = 'P' AND k.table_name = :1 AND k.owner LIKE :2 ESCAPE '/' AND k.constraint_name = c.constraint_name AND k.table_name = c.table_name AND k.owner = c.owner ORDER BY column_name 给出的解释是:当JAVA程序中通过DatabaseMetaData#getPrimaryKeys()调用,将会执行这个SQL,如果不及时关闭,则还可能产生严重的内存占用。 看了些其它的资料,也是说的java在调用某些函数的使用应用到该语句,所以呢,最好还是让开发排查一下。
在MOS中也发现一篇文章:
Liferay Sending Invalid Request To The Database (Doc ID 1492529.1)
给出的说明是:
By default, jdbc.default.idleConnectionTestPeriod is set to 60 and will cause C3PO to ping the database every 60 seconds to test each pooled connection and make sure it’s still alive. To configure these pings to be less frequent, increase the jdbc.default.idleConnectionTestPeriod to be a higher number, or set it to zero to disable pinging altogether (if that is the desired behavior). Changing this parameter requires a restart of the Liferay application server/application.
将该参数的默认值调大后,后台已经看不到报错信息。但是还要继续观察一段时间。