Logging deadlocks in sql server

Опубликовано: 09 October 2024
на канале: kudvenkat
78,289
356

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.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

Slides
http://csharp-video-tutorials.blogspo...

All SQL Server Text Articles
http://csharp-video-tutorials.blogspo...

All SQL Server Slides
http://csharp-video-tutorials.blogspo...

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...

All Dot Net and SQL Server Tutorials in Arabic
   / kudvenkatarabic  

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