find out which queries are causing the deadlock

  • Hi, I occasionally get the following message on our production sql server box.

    Transaction (Process ID 787) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock.

    I can find out the query that was chosen as the victim. How can I find out the other query that is part of the deadlock? Also, how can we fix this?

  • This will log deadlock info to the SQL Server error log:

    print 'Set on Trace Flag 1222 to log deadlocks'

    dbcc traceon(1222,-1)

    print 'Show all trace flags that are on'

    dbcc tracestatus(-1) with no_infomsgs

  • Hi Michael, Do I do this when I have a deadlock and turn it off again after I find the issue? Is there any performance penalty because of this?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply