[Database] SQL Server deadlock analysis query

In SQL Server, deadlock occurs because two or more processes are waiting for each other's reserved locked resources, resulting in a situation where the jobs are permanently blocked from each other. When a deadlock occurs, SQL Server will choose one of the jobs as the victim, and end its transaction with an error. as follows.

Please click to enter the picture description (up to 18 characters)

Generally speaking, the DBA will enable and set the trace flag (1222) to collect deadlock information in order to analyze the occurrence of deadlock. Another method is to use the extended events (Extended Events) system_health session (Sessions) to query the cause of the deadlock. as follows.

Please click to enter the picture description (up to 18 characters)

Click xml, you can find the reason for the deadlock.

Please click to enter the picture description (up to 18 characters)

Guess you like

Origin blog.csdn.net/wlcs_6305/article/details/114922640