挂在查询中的MS SQL特定表

时间:2021-02-09 23:38:24

I have SQL Server 2008. I run a query in a table on a database. The weirdest thing keeps happening. I run a simple select statement on the table. I know there are 62 rows in the table but it gets stuck at row 48 and goes on "querying...". Waited already for hours and it didn't move on from there. I only know of two programs, and one reporting service connecting to that particular table and one other user. Does anyone have any idea on what could be causing this and how I could trace the source of the lock on that table?

我有SQL Server 2008.我在数据库的表中运行查询。最奇怪的事情不断发生。我在表上运行一个简单的select语句。我知道表中有62行,但它在第48行卡住并继续“查询......”。已经等了几个小时了,它没有继续前进。我只知道两个程序,一个报告服务连接到该特定表和另一个用户。有没有人知道可能导致这种情况的原因以及如何跟踪该表上锁的来源?

As a side note, I noted that the logs only had a notice that Autogrow failed the day before I checked. Could this have something to do with it?

作为旁注,我注意到日志只在我检查前一天发出了Autogrow失败的通知。这可能与它有关吗?

1 个解决方案

#1


9  

What if you do a

如果你做了怎么办?

SELECT * FROM YourTable WITH(NOLOCK)

Does it still hang?

它还挂着吗?

Additionally when it does appear to be blocked you can try running

此外,当它似乎被阻止时,您可以尝试运行

exec sp_who2

And looking in the BlkBy column to see what process is blocking you.

并查看BlkBy列以查看阻止您的进程。

If that doesn't shed any light this article gives some info on some DMVs that might help get some insight into reasons for waits.

如果这没有任何消息,本文提供了一些有关某些DMV的信息,可能有助于深入了解等待的原因。

#1


9  

What if you do a

如果你做了怎么办?

SELECT * FROM YourTable WITH(NOLOCK)

Does it still hang?

它还挂着吗?

Additionally when it does appear to be blocked you can try running

此外,当它似乎被阻止时,您可以尝试运行

exec sp_who2

And looking in the BlkBy column to see what process is blocking you.

并查看BlkBy列以查看阻止您的进程。

If that doesn't shed any light this article gives some info on some DMVs that might help get some insight into reasons for waits.

如果这没有任何消息,本文提供了一些有关某些DMV的信息,可能有助于深入了解等待的原因。