Logging deadlocks in sql server

Logging deadlocks in sql server

trace sql server deadlock
sql server deadlock log
how to log deadlocks in sql server
sql server deadlock log file
sql logging deadlocks
trace deadlocks in sql server 2008
sp_readerrorlog

Text version of the video
http://csharp-video-tutorials.blogspot.com/2015/08/logging-deadlocks-in-sql-server.html

Slides
http://csharp-video-tutorials.blogspot.com/2015/08/logging-deadlocks-in-sql-server_27.html

All SQL Server Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html

All SQL Server Slides
http://csharp-video-tutorials.blogspot.com/p/sql-server.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

In this video we will discuss how to write the deadlock information to the SQL Server error log

When deadlocks occur, SQL Server chooses one of the transactions as the deadlock victim and rolls it back. There are several ways in SQL Server to track down the queries that are causing deadlocks. One of the options is to use SQL Server trace flag 1222 to write the deadlock information to the SQL Server error log.

Enable Trace flag : To enable trace flags use DBCC command. -1 parameter indicates that the trace flag must be set at the global level. If you omit -1 parameter the trace flag will be set only at the session level.

DBCC Traceon(1222, -1)

To check the status of the trace flag
DBCC TraceStatus(1222, -1)

To turn off the trace flag
DBCC Traceoff(1222, -1)

To read the error log
execute sp_readerrorlog

Get Paid Taking Pictures
Share