How can I restore a database from .mdf file?

Tags:
SQL Server backup
SQL Server database restore
How can I restore a database from .mdf file? I only have .mdf backup file.
ASKED: March 19, 2008  12:01 AM
UPDATED: February 12, 2014  5:18 PM

Answer Wiki

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

Restoring MSSQL Database from .bak files

1. Open SQL Server Management Studio on your local machine.
2. Right click the Databases folder. From the pop-up menu, select New Database.
3. Enter a database name, and then click Ok.
4. Right click the new database icon. From the pop-up menu, select Tasks -> Restore -> Database.
5. Select the From Device option, and then click the browse button.
6. Click Add and navigate to the appropriate file. Click Ok.
7. In the Restore Database window, select the checkbox next to your .bak file.
8. Switch to the Options page. Select the Overwrite the existing databasecheckbox.
9. Click Ok.
10. Verify the contents of your database, which is now active on your local machine.

Restoring MSSQL Database from .mdf files

1. Open SQL Server Management Studio on your local machine.
2. Right click the Databases folder. From the pop-up menu, select Attach.
3. Click Add and select the appropriate .mdf file. Click Ok, and then click Ok again.
4. Verify the contents of your database, which is now active on your local machine.

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
  • 6543
    Hi, I am having mdf and ldf files but I can't restore the these files in the database How can I restore the above files? Please can anyone help me?
    10 pointsBadges:
    report
  • Narashiman
    The above is the method for converting the .mdf to .bak. You just need to restore the .mdf file and then take a backup from the SQL Server (which will be in .bak format) Hope this post help you all. Cheers!! Narashiman
    35 pointsBadges:
    report
  • Narashiman
    Restoring MSSQL Database from .bak files 1. Open SQL Server Management Studio on your local machine. 2. Right click the Databases folder. From the pop-up menu, select New Database. 3. Enter a database name, and then click Ok. 4. Right click the new database icon. From the pop-up menu, select Tasks -> Restore -> Database. 5. Select the From Device option, and then click the browse button. 6. Click Add and navigate to the appropriate file. Click Ok. 7. In the Restore Database window, select the checkbox next to your .bak file. 8. Switch to the Options page. Select the Overwrite the existing databasecheckbox. 9. Click Ok. 10. Verify the contents of your database, which is now active on your local machine. Restoring MSSQL Database from .mdf files 1. Open SQL Server Management Studio on your local machine. 2. Right click the Databases folder. From the pop-up menu, select Attach. 3. Click Add and select the appropriate .mdf file. Click Ok, and then click Ok again. 4. Verify the contents of your database, which is now active on your local machine.
    35 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