Skip to main content

Posts

Showing posts with the label SQL Server deadlocks

How To Get SQL Server deadlocks using system_health extended event

  How To see parameter value on xml_deadlock_report? This article will help us to retrieve the SQL Server deadlock information using the default system-health extended event session. You may consider it as a black box recorder to track the SQL instance activities. We do not need to enable trace flags 1204 and 1222 to capture the deadlocks using this extended event session.  Simply run the below SQL query for see the each deadlock report in the XML file.   T-SQL Query: DECLARE @xelfilepath NVARCHAR ( 260 ) SELECT @xelfilepath = dosdlc . path FROM sys . dm_os_server_diagnostics_log_configurations AS dosdlc ; SELECT @xelfilepath = @xelfilepath + N'system_health_*.xel'   DROP TABLE IF EXISTS   #TempTable   SELECT CONVERT ( XML , event_data ) AS EventData         INTO #TempTable FROM sys . fn_xe_file_target_read_file ( @xelfilepath , NULL, NULL, NULL)      ...