且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Sql 2008中使用mdf和ldf文件恢复数据库?

更新时间:2023-02-03 08:29:49

如果你有mdf'和ldfs,你可以将数据库文件附加到另一个实例(即使你可以附加mdf)

系统数据库主包含用户信息,msdb包含作业和其他信息;如果你无法恢复这些文件,你需要手动添加它们

ssms - >右键单击数据库 - >附上;选择文件并附上



您可能必须对新连接的数据库运行'DBCC CHECKDB()'语句
You can attach the database files to another instance if you have the mdf' and ldfs ( even with mdf you will be able to attach )
System database master contains the user info, and msdb contains the jobs and other info; if you couldn't recover these files, you need to add them manually
ssms -> rightclick database -> attach ; choose the files and attach
OR
You may have to run a 'DBCC CHECKDB()' statement against the newly attached database


2)
您可以将.mdf和.ldf文件复制到其他服务器并只需将它们附加。

https://msdn.microsoft.com/en-us/library/ ms190209.aspx

您将丢失在实例级别创建的任何服务器范围的登录,但您将保留数据库用户。
2) You can copy the .mdf and .ldf files to a different server and just Attach them.
https://msdn.microsoft.com/en-us/library/ms190209.aspx
You will lose any server-wide logins created at the instance level but you will retain your database users.


3)
如果数据库没有打开,那么我认为文件可能已损坏。看看微软的这篇支持文章。 https://support.microsoft.com/en-us/kb/288809 [ ^ ]

如果这没有帮助,那么只能选择尝试第三方程序。可以在Market中查找或者可以像SQL Server Recovery Toolbox一样使用。我作为专家推荐给你。或者可以使用您已知的任何其他工具。 http://www.oemailrecovery.com/sql_repair.html

所以我告诉了你们所有人可能的方法。)
3) If the database is not open, then I think the files could be damaged. see this support article from microsoft. https://support.microsoft.com/en-us/kb/288809[^]
If this does not help, then only have the option to try third-party program. Can in the Market to look for or can use like SQL Server Recovery Toolbox. I as the expert recommend it to you. Or can use any other tool known to you. http://www.oemailrecovery.com/sql_repair.html
So I told you all the possible ways.)