0

After searching in different sites and QnAs, i am so confused on how i can:

  1. Find Deadlocks and what time they occured
  2. How to identify what happened and a deadlock arrised.
  3. And what is the query that caused a deadlock.

Is there any Query to extract such information?

Note that i have seen the tables

sys.dm_tran_locks

sys.dm_exec_requests

and still i do not understand.

0

1 Answer 1

2

A good way to find the deadlocks which have happened is with the use of the First Responder Kit from Brent Ozar.

This can be found here: https://www.brentozar.com/first-aid/

When installed, you can run the sp_blitzlock command and see deadlock information.

https://www.brentozar.com/archive/2017/12/introducing-sp_blitzlock-troubleshooting-sql-server-deadlocks/

Another option, is to look in the ring buffer Martin suggested: https://www.sqlshack.com/monitoring-sql-server-deadlocks-using-the-system_health-extended-event/#:~:text=system_health%20event%20session.-,Extract%20SQL%20Server%20Deadlock%20information%20using%20T%2DSQL%20from%20the%20ring%20buffer%20target,-We%20can%20use

7
  • i have installed it and i can now see the procedure. Although i name the database which the deadlock happened, i'm getting an empty list. exec sp_BlitzLock @DatabaseName = 'Mydb' Jan 18 at 10:21
  • Do you see any deadlocks when you remove the @DatabaseName? Perhaps it is running from another database? (not sure if that is possible and how that is logged)
    – Peter
    Jan 18 at 10:23
  • No, even after removing this, i'm getting an empty list. Jan 18 at 10:24
  • You sure you are having deadlocks? What if you create a deadlock by yourself, will it return?
    – Peter
    Jan 18 at 10:27
  • 1
    Thank you for giving me your valuable time and information. i'm now in a better place to continue this journey! Jan 18 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.