一生产系统,最近数据库操作频繁出现-1218错误:
<!-- lang: java -->
java.sql.SQLException: [BEA][DB2 JDBC Driver][DB2]Error occured with SQLCode -1218 with the following parameters: 4096
at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
at weblogic.jdbc.db2.drda.DRDARequest.processSQLCA(Unknown Source)
at weblogic.jdbc.db2.drda.DRDARequest.processCodePoint(Unknown Source)
at weblogic.jdbc.db2.drda.DRDAStatementRequest.processCodePoint(Unknown Source)
at weblogic.jdbc.db2.drda.DRDAExecuteStatementRequest.processCodePoint(Unknown Source)
at weblogic.jdbc.db2.drda.DRDARequest.processReply(Unknown Source)
at weblogic.jdbc.db2.DB2ImplStatement.getNextResultType(Unknown Source)
at weblogic.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at weblogic.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
根据DB2错误码分析,第一感觉以为是数据库库缓冲池太小,不能满足业务需要,需要扩大缓冲池大小来解决这个问题。仔细考虑后觉得有些不对劲,查询了许多资料,都是说怎么扩充缓冲池的,后来查询了数据库最近一段时间的日志,在数据库日志中找到了真正的原因是因为平台上的可用物理内存不中,导致我们新建的缓冲池没有激活,数据库系统自动将缓冲池切换到一个隐藏的容量很小的缓冲池上导致的。DB2的这个坑爹的设计!数据库日志信息大体如下:
<!-- lang: java -->
MESSAGE : ZRC=0x850F0005=-2062614523=SQLO_NOSEG
"No Storage Available for allocation"
DIA8305C Memory allocation failure occurred.
DATA #1 : String, 286 bytes
Failed to allocate the desired database shared memory set.
Check to make sure the configured DATABASE_MEMORY + overflow
does not exceed the maximum shared memory on the system.
Attempting to start up with only the system buffer pools.
Desired database shared memory set size is (bytes):
DATA #2 : unsigned integer, 4 bytes
1651048448
MESSAGE : ADM6073W The table space "SYSCATSPACE" (ID "0") is configured to use
buffer pool ID "1", but this buffer pool is not active at this time.
In the interim the table space will use buffer pool ID "4096". The
inactive buffer pool should become available at next database startup
provided that the required memory is available.