sql server deadlock problem

https://www.red-gate.com/simple-talk/sql/learn-sql-server/how-to-track-down-deadlocks-using-sql-server-2005-profiler/

 

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/41a510cc-0e54-4bfb-92d2-12996abf99f6/help-needed-to-read-the-deadlock-graph?forum=sqldatabaseengine

Event: Proc [Database Id = 12 Object Id = 525453146] 

执行以下的sql语句,可以得到数据库名字和object名字

SELECT OBJECT_NAME(525453146) ,
DB_NAME(12);

 

 

https://www.cnblogs.com/rush/archive/2012/02/19/2358209.html

trace追踪的时候,选择deadlock:graph,deadlock:lock,deadlock:chain

 

https://blogs.msdn.microsoft.com/sqlserverfaq/2013/04/26/how-to-monitor-deadlock-using-extended-events-in-sql-server-2008-and-later/

Mentioned below are trace flags which are classical way to enable Deadlock trace in SQL Server Editions.

  1. Enable Trace Flag 1204 - Here data are captured in node level.

Dbcc traceon (T1204,-1)

  1. Enable Trace Flag 1222 - Here data is returned in XML Format. Also one can see the processes information also which are involved in deadlock.

DBCC Traceon (T1222,-1)

  1. Run SQL Profiler Trace to capture the Deadlock events.

This deadlock information can be viewed in SQL Server Error Logs and Trace Files.

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

 

DBCC TRACEON - Trace Flags

Trace flags are used to set specific server characteristics or to alter a particular behavior.

For example, trace flag 3226 is a commonly used startup trace flag which suppresses successful backup messages in the error log.

Trace flags are frequently used to diagnose performance issues or to debug stored procedures or complex computer systems, but they may also be recommended by Microsoft Support to address behavior that is negatively impacting a specific workload.

All documented trace flags and those recommended by Microsoft Support are fully supported in a production environment when used as directed.

Note that trace flags in this list may have additional considerations regarding their particular usage, so it is advisable to carefully review all the recommendations given here and/or by your support engineer.

Also, as with any configuration change in SQL Server, it is always best to thoroughly test the flag in a non-production environment before deploying.

1204

Returns the resources and types of locks participating in a deadlock and also the current command affected. For more information, see this Microsoft Support article.

Scope: global only

SQL Server technical bulletin - How to resolve a deadlock

 

1222

Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply遵从 with any XSD schema.

Scope: global only

 

 

DBCC TRACESTATUS

Displays the status of trace flags.

DBCC TRACESTATUS(1204,-1); 
DBCC TRACESTATUS(1222,-1); 
DBCC TRACESTATUS(-1);

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值