Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Shortcut: Saving and sharing SQL Server deadlock graphs

$
0
0

In anearlier post, I described how query plans could be saved as .sqlplan file, shared, and loaded again in SQL Server Management Studio (SSMS). It's also possible to extract them out of SQL Server Profiler or Extended Events Profiler.

This is useful, but the same applies to deadlock graphs. SQL Server 2005 added Deadlock graph as a type of event in SQL Server Profiler. (It's also part of Extended Events Profiler).

If I open a new trace in Profiler, I can add Deadlock graph to the list of events:


Shortcut: Saving and sharing SQL Server deadlock graphs

Then when a deadlock occurs, we can see an entry for it in the trace:


Shortcut: Saving and sharing SQL Server deadlock graphs

Now if you want to share that with someone else, you can right-click the deadlock graph event and extract the event data:


Shortcut: Saving and sharing SQL Server deadlock graphs

When you do this for a deadlock, the output is saved as a .xdl file extension.


Shortcut: Saving and sharing SQL Server deadlock graphs

You can then send it to someone else and they can load it in SSMS:


Shortcut: Saving and sharing SQL Server deadlock graphs

One important thing to note is that a deadlock graph is actually a list of deadlocks, not just one deadlock. When a deadlock graph is opened in SSMS, it only shows the first deadlock in the graph.


Viewing all articles
Browse latest Browse all 3160

Latest Images

Trending Articles