Recovering a database with just the .ldf and .mdf files

The PC running SQL Server 7.0 crashed. The .mdf and .ldf files of some databases were backed up to another hard disk. I don't know if they did a sp_detach_db because I'm trying to run sp_attach_db to put the databases in the new SQL Server 7.0, but it doesn't work. Is there any way to recover something having just those files (.mdf and .ldf)?

Under the circumstances, with SQL Server 7.0, if the *.mdf and *.ldf files were merely copied to another server,...

one option may be to perform the following:

  • Install Windows with the same configurations, name, IP address, service packs, hot fixes, drive layout, drive size, etc.
  • Install SQL Server with the same configurations, service packs, hot fixes, etc.
  • Restore the master database.
  • Place the *.mdf and *.ldf files in the same location as the master.dbo.sysdatabases expects.
  • Restart SQL Server to ensure no issues are recorded in the SQL Server error log.
  • Test the application to ensure the application is working properly.
If this is not successful, it may be necessary to restore all of the databases from tape. Based on this issue, it is probably beneficial to plan and implement a high availability and/or disaster recovery solution to prevent an issue similar to this one from causing long-term downtime.

This was first published in August 2004

Dig Deeper on Microsoft SQL Server Installation



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: