question

satya avatar image
satya asked

How to find the dead lock queries ?

Hi Every one, Is there any chance to get the dead lock victims code / queries in a Production database. We cant on the trace files in Error Log to capture the information bcz we dont have permissions to access the errorlog. So Please tell me a way to find out the dead lock queries.
deadlock
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
To get deadlocks you have a few choices. First, you can use Traceflag 1222. Setting that will output the deadlock graph to the error log. If you don't have permission there, then you can use Extended Events in 2008 and better to capture the deadlock_xml_report event to get a deadlock graph that will show you everything you need. But, you have to set that up ahead of time. For servers prior to 2008 you can capture deadlock graphs using trace events. These you will also have to set up ahead of time. If you haven't set up extended events yet, you can't get information except from the error log (which you say you can't reach, but that will only help if the traceflags are already set).
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.