SQL Server告诉我数据库正在使用,但它不是 [英] SQL Server tells me database is in use but it isn't

查看:250
本文介绍了SQL Server告诉我数据库正在使用,但它不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试删除或还原数据库时,SQL Server会一直告诉我数据库正在使用,但是当我运行此元数据查询时:

SQL Server keeps telling me a database is in use when I try to drop it or restore it, but when I run this metadata query:

select * from sys.sysprocesses 
where dbid 
  in (select database_id from sys.databases where name = 'NameOfDb')

它不返回任何内容。

有时它会返回一个CHECKPOINT_QUEUE等待类型的进程。如果我试图杀死那个进程,它不会让我(不能杀死一个非用户进程)。

Sometimes it will return 1 process which is a CHECKPOINT_QUEUE waittype. If I try to kill that process, it won't let me (cannot kill a non-user process).

任何人都知道有什么问题?

Anyone have any idea what's wrong?

推荐答案

可能有很多事情阻塞了你的数据库。例如,如果您在该数据库上打开了一个查询窗口,它将被您锁定。不计数外部访问,如IIS上的Web应用程序。

There could be lots of things blocking your database. For example, if you have a query window opened on that database, it would be locked by you. Not counting external accesses, like a web application on IIS.

如果真的想强制删除它,请检查关闭现有的连接选项或尝试手动停止SQL Server的服务。

If you really wanna force the drop on it, check the close existing connections option or try to manually stop SQL Server's service.

这篇关于SQL Server告诉我数据库正在使用,但它不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆