DBCC CHECKDB作业失败:错误表示存在死锁但无法确定原因

时间:2013-06-06 14:25:56

标签: sql sql-server sql-server-2005

我们有一个夜间sql代理程序作业,它执行DBCC CheckDB。本周它在运行时开始失败。错误消息表明存在死锁。

我们无法确定导致死锁的原因。所以我们昨晚在非工作时间重新启动服务器,然后再次运行,但仍然失败。

我们想知道造成这种情况的原因。我们怎样才能看出导致僵局的原因?

环境: 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.

1 个答案:

答案 0 :(得分:1)

要解决SQL Server死锁问题,最好在服务器上启用-1222跟踪标志,以便在SQL Server错误日志中记录死锁信息,您可以将其用于进一步调查。您也可以使用SQL Server探查器跟踪死锁事件。我建议以下有关解决SQL Server死锁问题的串行博客文章,请参阅:http://blogs.msdn.com/b/bartd/archive/2006/09/09/deadlock-troubleshooting_2c00_-part-1.aspx