我正在尝试解决一个用经典ASP编写的带有SQL Server2000数据库的站点的问题。
每隔几天,这个网站似乎就会宕机。当您尝试访问该网站时,该网站没有响应。浏览器中的加载指示器将旋转,页面将保持空白。
当我在站点关闭后运行sp_who2时,总是有一个进程占用了大量的CPU时间。此进程将阻塞数据库中的所有其他进程。
我可以通过终止这个进程来让站点重新工作。
我搞不清楚到底是怎么回事。当我查看此进程在锁定之前运行的存储过程时,它没有任何问题。运行此存储过程的页将关闭所有连接对象。
有什么可能导致这个死锁的想法,或者我如何才能阻止它的发生?
发布于 2012-09-26 22:29:30
不确定这是否是问题所在,但可能是并非所有记录集和连接都是关闭的...当我们在过去遇到类似的问题时,我们以以下例程结束。(请注意,这只是一个显示一个记录集关闭的代码片段,实际过程实际上遍历了15个不同的记录集,以查看它们是否需要关闭。)。
然后,modCloseObjects() prodedure总是在页面末尾、重定向之前、内部错误处理等方面被调用。
' subroutine will close and set the objects to Nothing. '
' Close Recordsets and then the Connection '
sub modCloseObjects()
'Close the record sets one by one '
If ucase(TypeName(oRS)) = "RECORDSET" then
if oRS.state <> adStateClosed then
oRS.close
Set oRS = Nothing
end if
end if
' if you have other recordSet objects, add them to the rourtine here: '
' Close the connection '
If ucase(TypeName(objConn)) = "CONNECTION" then
if objConn.state <> adStateClosed then
objConn.close
Set objConn = Nothing
end if
end if
end sub如果你没有adovbs.inc,你还需要以下常量:
Const adStateClosed = &H00000000https://stackoverflow.com/questions/12598365
复制相似问题