This video focus on how to capture a deadlock in SQL server. If you are a beginner then this video is for you. Please refer below video reference links that are discussed in this video.
What is a deadlock and how it occurs
How SQL server choses a deadlock victim
T-SQL script to find How many deadlock occured since server startup
SELECT 'Deadlocks Occurrence',
CONVERT(BIGINT,((1.0 * v.cntr_value /
NULLIF(datediff(DD,w.create_date,CURRENT_TIMESTAMP),0)))) as
AvgPerDay,
CAST(v.cntr_value AS NVARCHAR(100)) + ' deadlocks recorded since startup.' AS Details,
w.create_date as StartupDateAndTime
FROM sys.dm_os_performance_counters v
INNER JOIN sys.databases w ON w.name = 'tempdb'
WHERE RTRIM(v.counter_name) = 'Number of Deadlocks/sec'
AND RTRIM(v.instance_name) = '_Total'
Turn on Trace flags
DBCC TRACEON (1204, -1)
DBCC TRACEON (1222, -1)
Analyzing Deadlocks with SQL Server Profiler
Microsoft technet on System health extended event
Analyze & prevent deadlocks
a.
b.
Watch video How to Capture deadlock in SQL server | Trace deadlock | SQL interview Q&A | Ms SQL online without registration, duration 23 minute 45 second in high hd quality. This video was added by user Right to Learn @BK 02 April 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8 thousand once and liked it 169 people.