简体   繁体   English

SQL Server数据库恢复

[英]SQL Server database recovery

I simply copied my .mdf/.ldf files to another file and suddenly my Microsoft SQL 2008 database dies. 我只是将.mdf / .ldf文件复制到另一个文件,然后突然我的Microsoft SQL 2008数据库死了。 I can't open these files on another system either. 我也无法在另一个系统上打开这些文件。 Can anyone explain what's happened? 谁能解释发生了什么事? Any way to recover this application's database now? 现在有什么方法可以恢复此应用程序的数据库?

您是先停止服务还是分离文件?

You are not supposed to copy files when the server is online. 服务器处于联机状态时,不应复制文件。

if you want to copy when the server is online, you can right click on management studio , -> detach-> 如果要在服务器联机时进行复制,则可以右键单击Management Studio,->分离->

then copy the files to another instance , and choose attach on new server. 然后将文件复制到另一个实例,然后选择在新服务器上附加。 remember you need to know the location of the files, before you detach, also you should be knowing, also the logins need to transfer. 请记住,在分离之前,您需要知道文件的位置,也应该知道,并且登录名也需要传输。

Have you tried moving the database files back to where they were? 您是否尝试过将数据库文件移回原处? (Specifically, stop SQL server, move files, start SQL Server). (具体来说,停止SQL Server,移动文件,启动SQL Server)。

Whenever I do this kind of work, I make copies of the files, and rename the original ones (from, say, MyData.mdf to xMyData.mdf). 每当执行此类工作时,我都会复制文件,然后重命名原始文件(例如,从MyData.mdf到xMyData.mdf)。 Makes it easier to back out when my fatfingers take over. 当我的胖手接管时,可以更轻松地退出。

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

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