简体   繁体   English

如何从 MDF 数据库中删除一个主文件?

[英]How can I remove one primary file from an MDF database?

One of the MDF files for a SQL Server database inadvertently ended up with 2 primary files (1 database is pointing to 2 different MDF files). SQL Server 数据库的一个 MDF 文件无意中以 2 个主文件结束(1 个数据库指向 2 个不同的 MDF 文件)。 How can I remove the reference to one of these files, so that I may reattach my database and bring it online?如何删除对这些文件之一的引用,以便我可以重新附加我的数据库并将其联机?

I realized that we had Sandbox environments cloned from all of our production stuff that was about 1 month old.我意识到我们从大约 1 个月前的所有生产资料中克隆了沙盒环境。 Luckily, that particular database is not used very often and had not been written to in over a month.幸运的是,那个特定的数据库并不经常使用,并且已经有一个多月没有写入了。 So I was able to capture a BAK file from the Sandbox environment, and restore the database to our production environment.所以我能够从沙盒环境中捕获一个 BAK 文件,并将数据库恢复到我们的生产环境中。 Worked like a charm!像魅力一样工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM