Sql Server 2008中的死锁故障排除 [英] Deadlock troubleshooting in Sql Server 2008
问题描述
我的网站似乎无法容纳大量访问者,我相信这是因为服务器太简单了。
My website doesn't seem to handle a high number of visitors, I believe it's because the server is too simple.
2小时前,我的网站获得了很多点击,我注意到发生了3个死锁错误,该错误是:
2 hours ago my website was getting a lot of hits and I noticed that 3 deadlock errors occurred, the error is:
System.Data.SqlClient.SqlException
:
事务(进程ID 58)与另一个进程在锁定资源上死锁,因此被选择为死锁受害者。重新运行事务。
System.Data.SqlClient.SqlException : Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
我不确定为什么会发生...查看堆栈跟踪,我可以看到发生了这种情况
I'm not sure why this happened... Looking at the stack trace, I could see that this happened with a select query.
有人知道此错误的原因吗?
Anyone knows what may be the cause of this error?
服务器正在运行Windows 2008和Sql Server 2008。
The server is running Windows 2008 and Sql Server 2008.
推荐答案
除非您启用行版本控制,否则写入将阻止对SQL Server的读取。您应该使用 sp_who2
存储过程和SQL Profiler跟踪。 sp_who2
会告诉您哪些进程正在阻塞哪个进程,探查器将告诉您最后一个语句是针对阻塞进程的内容。
Writes will block reads on SQL Server, unless you have row versioning enabled. You should use the sp_who2
stored procedure and a SQL Profiler trace. sp_who2
will tell you which processes are blocking which, and the profiler will tell you what the last statement was for the blocking process.
这篇关于Sql Server 2008中的死锁故障排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!