如果文件消失,如何删除(localdb)数据库(How to delete (localdb) database if the file is gone)

编程入门 行业动态 更新时间:2024-10-25 08:18:39
如果文件消失,如何删除(localdb)数据库(How to delete (localdb) database if the file is gone)

如果我运行SQL Server Management Studio并告诉它连接到(localdb)\ v11.0,它知道我曾经使用过的每个数据库,尽管大部分数据库文件都已经过去了。

如果我要求它删除这些数据库中的一个,它会抱怨它不能删除数据库,因为数据库文件不见了(duhhh)。 那么,我该如何清理这个混乱,并删除所有数据库引用的辅助数据库文件都不见了?

短发

If I run SQL Server Management Studio, and tell it to connect to (localdb)\v11.0, it knows about every database I've ever used, despite the fact that most of the the database files are long gone.

If I ask it to delete one of these databases, it complains that it can't DROP the database because the database file is gone (duhhh). So, how do I clean up this mess and delete all of database references whose assicated database files are gone?

Bob

最满意答案

在这种情况下,分离数据库而不是试图放弃它。 在SQL Management Studio中,右键单击数据库,选择“任务”,然后选择“分离”。

In this situation, detach the database rather than trying to drop it. In SQL Management Studio, right-click on the database, select "Tasks" then "Detach".

更多推荐

本文发布于:2023-08-04 10:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415137.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   文件   localdb   file   delete

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!