DB2 的SQLState=40001 和SQLState=55039解决方案

解决55039故障(SQL0290N 不允许访问表空间,SQLState 55039)

1、db2 list tablespaces show detail;
Tablespace ID = 2
Name = USERSPACE1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0004
Detailed explanation:
Quiesced: EXCLUSIVE
Total pages = 77824
Number of quiescers = 1
Quiescer 1:
Tablespace ID = 2
Object ID = 180

2、--找到有问题的对象TabName例如(USERINFO)
--select * from SYSCAT.TABLES WHERE tableID='有问题的对象ID'
select * from SYSCAT.TABLES WHERE tableID='267'

--3、db2 QUiesce tablespaces for table 对象名字 reset;
db2 QUiesce tablespaces for table USERINFO reset;

模拟55039故障
db2 QUiesce tablespaces for table USERINFO Exclusive;


SQL0911N解决方案(因为死锁或者超时,当前事务已经回滚,原因码68 ,SQLState40001)
本地图片,请重新上传
长久做法建议修改数据库参数
修复这四个参数:DLCHKTIME MAXLOCKS LOCKLIST LOCKTIMEOUT
db2 update db cfg for zhptdb using LOCKTIMEOUT 3600 immediate;

快速解决方案:
1、查找持有X锁的会话
db2 get snapshot for locks on zhptdb
Application handle = 16037(会话句柄)
Application ID = 10.10.3.142.42248.150213023522
Lock Object Name = 5
Object Type = Row
Tablespace Name = HGQW_TBS
Table Schema = HGQW
Table Name = TB_HGQW_QWZH_XCXSCL
Mode = X (常见的锁类型 X:全称exclude 、 S:全称share)
2、db2 'force application(会话句柄)'
db2 'force application(16037)'

你可能感兴趣的:(数据库-----DB2)