Restoring a SQL database with an .mdf file

Tags:
MDF
SQL Server database
SQL Server database restore
How can I restore a SQL database with an .mdf file?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can’t restore from an MDF. You can however attach the MDF back to your SQL Server instance using the sp_attach_db_single_file system stored procedure. Check Books OnLine for the full syntax.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • JatinMuttreja
    you can do it by stopping SQL service from SERVICES AND APPLICATIONS. first create the database with same name, than after stopping sql service, just simply copy paste the MDF and LDF files from your backup.
    10 pointsBadges:
    report
  • Denny Cherry
    This won't always work, as the sizes will be different from the sizes of the files that are listed in the master database. Not to mention why would you stop the instance to do something which you don't have to take an outage to complete?
    66,005 pointsBadges:
    report
  • VinnySan37
    You may restore sql database thanks to following software sql server fix tool will save all sql tables, stores and so on inside new .sql file
    10 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following