Skip to main content
If SQL database deadlocks occur while you are using the program, enable deadlock information logging using the Extended Events system.

Create an XEvents session

Create the session with the SQL Server Management Studio wizard:
  1. Launch the New Session Wizard from Object Explorer under Management → Extended Events → Sessions.
    Screenshot of SQL Server Management Studio launching the New Session Wizard from Object Explorer under Management, Extended Events, Sessions.
  2. Specify a name for your session. To launch it on server start, select the Start the event session at server startup option.
    Screenshot of the New Session Wizard with a session name entered and the Start the event session at server startup option selected.
  3. In the Select Events To Capture section, look for xml_deadlock_report.
    Screenshot of the Select Events To Capture step of the New Session Wizard with xml_deadlock_report selected.
  4. In the Specify Session Data Storage section, specify the path to the location where the file containing the recorded session results is stored. The Enable file rollover option enables automatic rotation in the specified directory.
  5. In the Summary section, you can open and save the wizard session results in T-SQL.

View deadlock information

From the XEvents session

To read .xel files, SQL Server provides the sys.fn_xe_file_target_read_file table-valued function. Run the following query in SQL Server Management Studio, specifying the path to the trace files:

From the system_health session

If deadlock logging is not enabled, you can view deadlock information using the system_health session, which is always enabled by default. Run the following query in SQL Server Management Studio:

In Azure

Azure has a separate session that is collected in blob storage by default. To view it, run the query below in the master context:
After you run the query, contact technical support and provide the deadlock information from the results.