我们有一个每晚执行 DBCC CheckDB 的 sql 代理作业。本周它在运行时开始出现故障。错误消息说存在死锁。
我们无法确定导致死锁的原因。因此,我们昨晚在下班时间重新启动了服务器,然后再次运行该作业,但仍然失败。
我们想知道是什么导致了这种情况发生。我们如何才能看到导致死锁的原因?
环境: SQL Server 2005
SQL 代理作业代码:
truncate table master..tbl_dbccresults;
insert into master..tbl_dbccresults
exec master..sp_msforeachdb @command1 = 'dbcc checkdb (?) with tableresults';
错误详情:
Executed as user: xxxxx\xxxxxx. Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
[SQLSTATE 40001] (Error 1205) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528) DBCC execution completed. If DBCC printed error messages, contact your system administrator.
[SQLSTATE 01000] (Error 2528). The step failed.