Save Deadlock Graphs (SQL Server Profiler)
Applies To: SQL Server 2016
This topic describes how to save a deadlock graph by using SQL Server Profiler. Deadlock graphs are saved as XML files.
On the File menu, click New Trace, and then connect to an instance of SQL Server.
The Trace Propertiesdialog box appears.
If Start tracing immediately after making connection is selected, the Trace Propertiesdialog box fails to appear, and the trace begins instead. To turn off this setting, on the Toolsmenu, click Options, and clear the Start tracing immediately after making connection check box.
In the Trace Properties dialog box, type a name for the trace in theTrace name box.
In the Use the template list, select a trace template on which to base the trace, or select Blank if you do not want to use a template.
Do one of the following:
Select theSave to file check box to capture the trace to a file. Specify a value for Set maximum file size.
Optionally, select Enable file rollover and Server processes trace data.
Select the Save to table check box to capture the trace to a database table.
Optionally, click Set maximum rows, and specify a value.
Optionally, select the Enable trace stop time check box, and specify a stop date and time.
Click the Events Selectiontab.
In the Eventsdata column, expand the Locksevent category, and then select the Deadlock graphcheck box. If the Locks event category is not available, check Show all events to display it.
The Events Extraction Settingstab is added to the Trace Propertiesdialog box.
On the Events Extraction Settingstab, click Save Deadlock XML Events Separately.
In the Save As dialog box, enter the name of the file in which to store the deadlock graph events.
Click All Deadlock XML batches in a single file to save all deadlock graph events in a single XML file, or click Each Deadlock XML batch in a distinct fileto create a new XML file for each deadlock graph.
After you have saved the deadlock file, you can open the file in SQL Server Management Studio. For more information, see Open, View, and Print a Deadlock File (SQL Server Management Studio).