Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 有没有办法检查表锁日志?_Sql Server - Fatal编程技术网

Sql server 有没有办法检查表锁日志?

Sql server 有没有办法检查表锁日志?,sql-server,Sql Server,我看到一些关于死锁的超时错误,特别是: Transaction (Process ID 161) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. 这是间歇性的,虽然我知道是什么导致了问题,但我想在投入太多时间和精力之前进行调查和验证 是否有办法查看这些类型错

我看到一些关于死锁的超时错误,特别是:

Transaction (Process ID 161) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
这是间歇性的,虽然我知道是什么导致了问题,但我想在投入太多时间和精力之前进行调查和验证

是否有办法查看这些类型错误的日志,以查看事务正在运行的查询和/或当时锁定的表


由于它是间歇性的,我很难在行动中抓住问题。

死锁总是间歇性的,不可预测的

默认情况下,SQL Server不保留任何关于死锁的历史信息,这有助于调查死锁的原因。如果你想收集这些信息,你必须提前做好准备

基本上有两个选项:设置跟踪标志1222并检查错误日志中的信息,或者启动捕获死锁图事件的探查器会话。两者都将提供有关死锁查询及其死锁资源的信息