We were helping a customer with a suspected deadlock problem, which turned out not to be occurring in TechDoc but with another application. Nonetheless, the process involves a few steps and we thought it might be helpful to document the process in case someone else might need to debug a SQL Server deadlock in the future.
- Open SSMS (SQL Server Management Studio) and connect to the database server where the database resides
- On the side menu, open Management > Extended Events > Sessions > system_health
- Right click on package0.event_file and click on View Target Data...
- When that comes up, hopefully there are a lot of events
- To narrow it down, click on Filters... up on the toolbar
- Check the box on Filter on event name if it's not already checked
- Click on the Click here to add a clause message
- For the Field, choose name in the drop down
- Leave the Operator as =
- For the Value, enter xml_deadlock_report
- Click OK to apply the filter
- If there's still lots of events, you may have to go back to the filter and add a Field of database_id and a Value of whatever the database ID is
Now, you may have one of more xml_deadlock_report events listed. If not, there were no deadlocks or it's been too long. The Extended Events are kept in a ring buffer that is overwritten as time goes by.
- Click on a deadlock event to select it
- Down below, details of that deadlock will be shown
- Click on the Deadlock tab
- In the center, there should be two Key Locks shown
- Look at the object name one of the key locks to verify that it is a lock in the database that we are looking for
- If not, click on the next deadlock and go back to step 2
- If it is a deadlock, click back on the Details tab
- In the Details tab, there should be a Field named xml_report
- Double click on that field, and the actual XML report should open
- You can now save that XML report and provide it for evaluation of the deadlock
Product Type:
