What was the process deadlocked with?

  • I have a job that runs some DBCC commands and shrinks several user databases after hours.  It quit with a deadlock condition last night.  I can see in the event log how far the job got by the backup steps it recorded there, but is there any way to tell what it was deadlocked with so we can avoid this in the future?

    DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Message 2528)  Transaction (Process ID 54) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001] (Error 1205).  The step failed.

    There is no "i" in team, but idiot has two.
  • I think its a bit late to find out what processes contributed to your deadlock situation, but you can enable trace flags 1204 and 3604 so that you can capture the deadlock details if this continues to happen. 

    http://www.sqlservercentral.com/columnists/skumar/tracingdeadlocks.asp

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Thanks John.  These deadlocks happen during a maintenance job that runs once a week.  If I read the article correctly, once I enable the trace flags, they will only write the log file if a deadlock happens, right?

    There is no "i" in team, but idiot has two.
  • Yes.  If SQL Server encounters a deadlock, the detailed info. will get written to the log file. 

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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