Ask the Expert

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)?

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: