ogg附加日志报错:
GGSCI ( as jyc@jyc) 18> add trandata JYC.TEST
2021-06-04 12:38:09 WARNING OGG-00552 Database operation failed: SQLExecDirect error: ALTER TABLE "jyc"."TEST" DATA CAPTURE CHANGES INCLUDE LONGVAR COLUMNS. ODBC error: SQLSTATE 40001 native database error -911. [IBM][CLI Driver][DB2/LINUXX8664] SQL0911N The current transaction has been rolled back because of a deadlock or timeout. Reason code "68". SQLSTATE=40001[IBM][CLI Driver][DB2/LINUXX8664] SQL0911N The current transaction has been rolled back because of a deadlock or timeout. Reason code "68". SQLSTATE=40001.
ERROR: Error in changing transaction logging for table: 'JYC.TEST'
Database error -911 ([IBM][CLI Driver][DB2/LINUXX8664] SQL0911N The current transaction has been rolled back because of a deadlock or timeout. Reason code "68". SQLSTATE=40001
[IBM][CLI Driver][DB2/LINUXX8664] SQL0911N The current transaction has been rolled back because of a deadlock or timeout. Reason code "68". SQLSTATE=40001
)
.
查看数据库表锁:
[db2inst2@ ~]$ db2pd -db jyc -locks show detail
Database Partition 0 -- Database jyc -- Active -- Up 119 days 15:43:26 -- Date 2021-06-04-13.00.59.474232
Locks:
Address TranHdl Lockname Type Mode Sts Owner Dur HoldCount Att ReleaseFlg rrIID
0x00007F1C5538F600 1193 5359534C564C3031DDECEF2841 Internal P ..S G 1193 1 0 0x00000000 0x40000000 0 Pkg UniqueID 4c535953 31304c56 Name 28efecdd Loading = 0
0x00007F1C5538F400 1193 03004400000000000000000054 Table .IS G 1193 255 10 0x00003000 0x40000000 0 TbspaceID 3 TableID 68
[db2inst2@ ~]$ db2 "select tabschema, tabname, tableid, tbspaceid from syscat.tables where tbspaceid = 3 and tableid = 68"
TABSCHEMA TABNAME TABLEID TBSPACEID
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------- ---------
JYC TEST 68 3
检查对应应用程序锁:
[db2inst2@ ~]$ db2pd -db jyc -locks show detail
Database Partition 0 -- Database jyc -- Active -- Up 119 days 15:43:26 -- Date 2021-06-04-13.00.59.474232
Locks:
Address TranHdl Lockname Type Mode Sts Owner Dur HoldCount Att ReleaseFlg rrIID
g = 0
0x00007F1C5538F400 1193 03004400000000000000000054 Table .IS G 1193 255 10 0x00003000 0x40000000 0 TbspaceID 3 TableID 68
[db2inst2@ ~]$ db2 "get snapshot for locks on jyc"
Database Lock Snapshot
Database name = jyc
Database path = /db2data/jyc/db2inst2/NODE0000/SQL00001/
Input database alias = jyc
Locks held = 2
Applications currently connected = 250
Agents currently waiting on locks = 0
Snapshot timestamp = 2021-06-04 13:01:48.265299
Application handle = 9796
Application ID = C0A80A7F.CFDD.210604035103
Sequence number = 00102
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-06-04 13:01:37.698258
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
Application handle = 9671
Application ID = C0A80A38.AC68.210604015728
Sequence number = 00444
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-06-04 13:00:30.495596
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
.............
Application handle = 8687
Application ID = C0A80A32.F8F7.210604014927
Sequence number = 00129
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-06-04 13:01:33.462596
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
Application handle = 8608
Application ID = C0A80A66.CD4E.210604015203
Sequence number = 00169
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-06-04 13:01:06.706107
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
Application handle = 5233
Application ID = C0A80A32.1387.210513045705
Sequence number = 07868
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-05-13 14:52:03.469048
Application code page = 1208
Locks held = 2
Total wait time (ms) = 0
List Of Locks
Lock Name = 0x5359534C564C3031DDECEF2841
Lock Attributes = 0x00000000
Release Flags = 0x40000000
Lock Count = 1
Hold Count = 0
Lock Object Name = 0
Object Type = Internal Plan Lock
Mode = S
Lock Name = 0x03004400000000000000000054
Lock Attributes = 0x00000000
Release Flags = 0x40000000
Lock Count = 255
Hold Count = 10
Lock Object Name = 68
Object Type = Table
Tablespace Name = jyc
Table Schema = jyc
Table Name = TEST
Mode = IS
Application handle = 8358
Application ID = C0A80A38.DE98.210604042130
Sequence number = 00027
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = UOW Waiting
Status change time = 2021-06-04 13:00:30.502861
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
Application handle = 63904
Application ID = C0A80A7F.F595.210601013016
Sequence number = 00001
Application name = db2jcc_application
CONNECT Authorization ID = jyc
Application status = Connect Completed
Status change time = 2021-06-01 09:30:13.404499
Application code page = 1208
Locks held = 0
Total wait time (ms) = 0
检查明细:
[db2inst2@ ~]$ db2 get snapshot for application agentid 5233
[db2inst2@ ~]$ db2 list applications|grep 5233
JYC db2jcc_applica 5233 C0A80A32.1387.210513045705 JYC 1
清除锁:
[db2inst2@ ~]$ db2 "force application(5233)"
相关参考:https://blog.csdn.net/fuwencaho/article/details/27109597