How to find the deadlock reason in sql server ro14?

前端 未结 3 763
天涯浪人
天涯浪人 2021-01-07 03:32

Facing a deadlock in SQL server database and can see deadlock entry in SQL logs. How the log entries can be used to find the reason for this deadlock?

3条回答
  •  滥情空心
    2021-01-07 03:55

    Deadlock information can be captured in the SQL Server Error Log or by using Profiler / Server Side Trace.

    • 1204 - this provides information about the nodes involved in the deadlock
    • 1222 - returns deadlock information in an XML format

    You can turn on each of these separately or turn them on together.

    To turn these on you can issue the following commands in a query window or you can add these as startup parameters. If these are turned on from a query window, the next time SQL Server starts these trace flags will not be active, so if you always want to capture this data the startup parameters is the best option.

    DBCC TRACEON (1204, -1)
    DBCC TRACEON (1222, -1)
    

    Please refer to the following Links for more details

    • Redgate
    • MS SQL Tips

提交回复
热议问题