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);

sql server deadlock problem的更多相关文章

  1. sql server deadlock跟踪的四种方法

    最近写程序常会遇到deadlock victim,每次一脸懵逼.研究了下怎么跟踪,写下来记录下. 建测试数据 CREATE DATABASE testdb; GO USE testdb; CREATE ...

  2. Check SQL Server Deadlock

    Sometimes a script keeps running for a long time and can't stop, then a db blocking is occurring. We ...

  3. SQL Server Lock Escalation - 锁升级

    Articles Locking in Microsoft SQL Server (Part 12 – Lock Escalation) http://dba.stackexchange.com/qu ...

  4. SQL Server 得到SPID,唯一的sessionID

    像.net中的session一样,假设能知道了数据库中的sessionID,那全部的操作都能知道了,由于有了这个唯一的身份识别的标识. 能够做的事情有非常多,如:当前哪个用户在做什么操作,在运行什么s ...

  5. Problem to create "New Database Diagram" in Microsoft SQL Server Management Studio for SQL Server 2012

    Error: when click "New Database Diagram", a error popped up and said "Attempted to re ...

  6. (转)SQL Server上的一个奇怪的Deadlock及其分析方法

    原文地址:http://blogs.msdn.com/b/apgcdsd/archive/2012/02/28/sql-server-deadlock.aspx 最近遇到了一个看上去很奇怪,分析起来很 ...

  7. SQL Server technical bulletin - How to resolve a deadlock

    https://support.microsoft.com/en-us/help/832524/sql-server-technical-bulletin-how-to-resolve-a-deadl ...

  8. How to solve a login problem of SQL Server?

    Sometimes when we attempting to login the SQL Server 20xx Management Studio, when we type in the cor ...

  9. Microsoft SQL Server Trace Flags

    Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...

随机推荐

  1. SSH配置免秘钥登录

    一.  SSH 配置免秘要登录 配置SSH 免秘要登录,虽然就那么几步,但总是会出现点小问题,今天就做下记录.SSH 免秘钥就是让两台机器相互信任,不需要输入密码就能相互登录.配置相互信任就是把各自的 ...

  2. 使用yum 出现 Loaded plugins: fastestmirror

    使用yum 安装是出现 : Loaded plugins: fastestmirror [root@localhost yum.repos.d]# yum –y install httpd  http ...

  3. 数组中binarySearch 中小小的误区! 用的时候大家要注意点

  4. window子对象

    Window 子对象 (1)Location 对象 Location 对象包含有关当前 URL(统一资源定位符) 的信息.(Uniform Resource Location) Location 对象 ...

  5. 微信小程序-学习总结(1)

    微信小程序尺寸单位 rpx单位是微信小程序中css的尺寸单位,rpx可以根据屏幕宽度进行自适应.规定屏幕宽为750rpx. 设备               rpx换算成px(屏幕宽度/750)   ...

  6. LOJ#2230. 「BJOI2014」大融合

    LOJ#2230. 「BJOI2014」大融合 题目描述 小强要在$N$个孤立的星球上建立起一套通信系统.这套通信系统就是连接$N$个点的一个树.这个树的边是一条一条添加上去的. 在某个时刻,一条边的 ...

  7. curl学习总结

    1.接口    function interface($postfields=array(),$url){        //设置post请求HTTP头字段的数组        $httpheader ...

  8. MySQL中myisam和innodb的主键索引有什么区别?

    MyISAM引擎使用B+Tree作为索引结构,叶节点的data域存放的是数据记录的地址.下图是MyISAM索引的原理图: 这里设表一共有三列,假设我们以Col1为主键,则上图是一个MyISAM表的主索 ...

  9. vb.net 正則表達式 取 固定格式的字符

    vb.net 正則表達式 取 固定格式的字符: 原始字符串:strSqlTmp="select * from A_TEST where a_data = '@1@' and b_link = ...

  10. vmware虚拟机网络模式

    转自:https://blog.csdn.net/u013201439/article/details/51491746 前言 有时因为工作和学习需要,我们安装了虚拟机,但是却发现不理解虚拟机的网络连 ...