How to monitor a deadlock in DB2

13 June,2012 by Jack Vamvas

Question: How can I trace and capture DB2 database deadlock details? I then want to  view the deadlock details.

Answer: Capturing DB2 deadlock details is straightforward. Use a similar process to below. Basically, you create an Event Monitor , capture some activity into a file, drop the event monitor.

 

#connect to db
#1-Create event monitor- make sure you've got write permissions
db2 "CREATE EVENT MONITOR dlmon FOR DEADLOCKS WRITE TO FILE '/tmp'"
#2 Turn on event monitordb2 
SET EVENT MONITOR dlmon STATE = 1
#3. (Do stuff to the database that you want to monitor)
#4. Turn off event monitordb2 SET EVENT MONITOR dlmon STATE = 0
#5. Translate event monitor into readable stuff
db2evmon -path /tmp > /tmp/filtered.out
#6. Read the events
vi /tmp/filtered.out
#7. 
db2 DROP EVENT MONITOR dlmon 

 

 Read More

SQL0911N Reason Code 68 The current transaction has been rolled back because of a deadlock or timeout

DB2 - Drop the DB2DETAILDEADLOCK event monitor

Author: Jack Vamvas(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to monitor a deadlock in DB2

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright