Вы находитесь на странице: 1из 3

Deadlock Research Steps: 1.

Get the Deadlock Monitor info:


a. logon as dbdbaam1, dbdbaem1 or adbhmc and flush deadlock in memory: db2 flush event monitor db2detaildeadlock b. then pull the deadlock monitor detail with db2evmon command: AM EM
db2evmon -path /db2/adb/db2adbam/NODE0000/SQL00001/db2event/db2detaildeadlock | grep -p Deadlock db2evmon -path /db2/adb/db2adbem/NODE0000/SQL00001/db2event/db2detaildeadlock | grep -p Deadlock

PHNM

db2evmon -path /db2db/phnm/db2hnm/NODE0000/SQL00001/db2event/db2detaildeadlock | grep -p Deadlock

May want to save deadlock info to a file for easier scrolling by adding > <file> 2. Find the SQL and Table Locks involved.
a. Step 1 will return something like the list below b. Scroll and Look for Timestamps that match -911 rc=2 time. c. Find SQL, Tables and Locks.
58) Deadlocked Connection ... Deadlock ID: 2 Deadlock Node: 0 Participant no.: 2 Participant no. holding the lock: 3 Appl Id: G991F348.F407.081211073246 Appl Seq number: 0024 Appl Id of connection holding the lock: *N0.db2adbem.081211074134 Seq. no. of connection holding the lock: 0048 Lock wait start time: 12/11/2008 07:44:42.840741 Lock Name : 0x01240004000000000000000054 Lock Attributes : 0x00000010 Release Flags : 0x00000001 Lock Count : 1 Hold Count : 1 Current Mode : IS - Intent Share Requesting lock as part of escalation: TRUE Deadlock detection time: 12/11/2008 07:44:57.687919 Table of lock waited on : ACCT_ON_PAGE << LOCK IT WANTS Schema of lock waited on : DB2INST1 Tablespace of lock waited on : ACCT_ON_PAGE Type of lock: Table Mode of lock: IX - Intent Exclusive Mode application requested on lock: S - Share Node lock occured on: 16 Lock object name: 4 Application Handle: 162 Deadlocked Statement: Type : Dynamic Operation: Fetch

Section : 4 Creator : NULLID Package : SYSSH400 Cursor : SQL_CURSH400C4 Cursor was blocking: FALSE Text : select URN_ACCT,NAME,DUNS_NUM,ACCT_HQ from adbgb.acct_on_page_gbp where ucase (name )like ucase ('%BRITISH%') and sub_ind not in 'zz' List of Locks: Database partition : 16 Lock Name : 0x012400040004C9030000000052 Lock Attributes : 0x00000010 Release Flags : 0x00000001 Lock Count : 1 Hold Count : 0 Lock Object Name : 313603 Object Type : Row << LOCKS IT HOLDS Tablespace Name : ACCT_ON_PAGE Table Schema : DB2INST1 Table Name : ACCT_ON_PAGE Mode : S - Share 161) Deadlocked Connection ... Deadlock ID: 2 Deadlock Node: 0 Participant no.: 1 Participant no. holding the lock: 2 Appl Id: *N0.db2adbem.081211074134 Appl Seq number: 0049 Appl Id of connection holding the lock: G991F348.F407.081211073246 Seq. no. of connection holding the lock: 0024 Lock wait start time: 12/11/2008 07:44:42.439291 Lock Name : 0x01240004000000000000000054 Lock Attributes : 0x00000000 Release Flags : 0x40000000 Lock Count : 1 Hold Count : 0 Current Mode : none Deadlock detection time: 12/11/2008 07:44:57.764633 Table of lock waited on : ACCT_ON_PAGE << LOCKS IT WANTS Schema of lock waited on : DB2INST1 Tablespace of lock waited on : ACCT_ON_PAGE Type of lock: Table Mode of lock: S - Share Mode application requested on lock: IX - Intent Exclusive Node lock occured on: 15 Lock object name: 4 Application Handle: 858 Deadlocked Statement: Type : Dynamic Operation: Execute Section : 3 Creator : NULLID Package : SYSSH200 Cursor : SQL_CURSH200C3 Cursor was blocking: FALSE Text : Update DB2INST1.ACCT_ON_PAGE Set Acct_Active=? Where URN_ACCT=? List of Locks: Database partition : 15 Lock Name : 0x000000320000000100016B0056 Lock Attributes : 0x00000000 Release Flags : 0x40000000 Lock Count : 1 Hold Count : 0 Lock Object Name : 0 Object Type : Internal Variation << LOCKS IT HOLDS Mode : S - Share

3. To find the User / Handle involved:


a. Find the Appl Id from Deadlock info
ex: Appl Id: G991F348.F407.081211073246

b. Go to Application Snapshot Log directory


cd /archive/em/stlp/OPS/snapapps_logs

c. grep <Appl Id value> snapapps_yymmdd*


ex: grep G991F348.F407.081211073246 snapapps_081211* | grep Application ID snapapps_0812110735.log:Application ID = G991F348.F407.081211073246 snapapps_0812110740.log:Application ID snapapps_0812110745.log:Application ID ex: vi snapapps_0812110740.log = G991F348.F407.081211073246 = G991F348.F407.081211073246 (07:44:57)

d. Edit the snapapps_yymmdd file listed for the deadlock time e. Search for the Appl Id value
ex: <esc> /G991F348.F407.081211073246

f. Scroll to see User ID and application used, e.g. QMF


Application Snapshot Application handle Application status Status change time Application code page Application country/region code DUOW correlation token Application name Application ID Sequence number TP Monitor client user ID TP Monitor client workstation name TP Monitor client application name TP Monitor client accounting string Connection request start timestamp Connect request completion timestamp Application idle time CONNECT Authorization ID Client login ID Configuration NNAME of client Client database manager product ID Process ID of client application Platform of client application Communication protocol of client = = = = = = = = = = = = = = = = = = = = = = = 162 UOW Waiting 12/11/2008 07:40:12.796868 1208 1 G991F348.F407.081211073246 qmfwin.exe G991F348.F407.081211073246 0022

12/11/2008 07:31:03.911954 12/11/2008 07:31:03.914762 12 seconds ROY55683 IBMDMS057 IBMDMS057 SQL09051 3268 NT TCP/IP