Question

  Asked: Apr 23 2008   10:15 AM GMT
  Asked by: Thrstorm


How to restore mdf file as backup database


Restore, MDF, Database, Backup

I have my database saves as mdf , i want what is the steps to restore or create a new database using this mdf file. I tired to restore as usual, it shows error? Please help

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



An MDF file isn't a backup file isn't the main data file (or master data file depending on who you ask) hence the file extension mdf. You can attach the mdf to the database by right clicking on the databases folder in Enterprise Manager (SQL 2000) or Management Studio (SQL 2005) then selecting all tasks and then Attach Database.

When you do this you will get an error about the log file missing. This shouldn't matter as SQL Server will simply create a new log file for you.

This will only work if the SQL Server was stopped when you copied the mdf file from the old SQL Server. If you copied the file while the SQL Server was running this file probably will not attach either and you will need to get a valid backup of the database.

You can read up more on SQL Server backup's here (PDF download).
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Storage and Database.

Looking for relevant Storage Whitepapers? Visit the SearchStorage.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Mrdenny  |   Apr 24 2008  1:19AM GMT

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.