sql server deadlock problem
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
Mentioned below are trace flags which are classical way to enable Deadlock trace in SQL Server Editions.
- Enable Trace Flag 1204 - Here data are captured in node level.
Dbcc traceon (T1204,-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)
- 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);
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了