【发布时间】:2017-05-22 00:17:44
【问题描述】:
我正在运行一个基于 Spring、JPA/Hibernate、Tomcat 和 MS SQL Server 的网站。查看系统日志时,我注意到如下几行:
SqlExceptionHelper:146 - Transaction (Process ID 61) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
我知道什么是死锁,但我希望知道死锁涉及到哪个表。我怎样才能得到这些信息?
请注意,我无法在开发环境中看到此错误。我也无法在 MS SQL 服务器中找到此信息。
【问题讨论】:
-
由于您在SQL Server中看不到错误,并且您看到了真正发生后的日志,我想您可能会在遇到此异常时添加查询日志,这将更有利于跟踪错误。
-
解决死锁可能有点复杂。我建议使用扩展事件捕获更多信息。您可以在这些文章中找到有关如何设置的更多信息。 social.technet.microsoft.com/wiki/contents/articles/… 或 brentozar.com/archive/2014/03/extended-events-doesnt-hard
-
Su 和 FFSQLGuy,非常感谢您的意见!!!
标签: sql-server spring hibernate