How to Restore an MDF File on the SQL Server
An MDF file contains all the tables, user permissions and properties for your SQL Server database. The database administrator takes a backup of the tables, views, users and other database objects in case of an emergency. Using the SQL Server Management Studio that comes with the database engine, database administrators attach the MDF file to restore the database to operation. The administrator can accomplish this using Structured Query Language (SQL) executed against the server.
Instructions
-
-
1
Click the Windows "Start" button. Click "All Programs," then click "SQL Server" in the program groups. Click "SQL Server Management Studio" to open your database console.
-
2
Right-lick the database server name located on the left of the screen and select "Attach." This opens a new SQL Server configuration window where you restore the MDF file.
-
-
3
Enter the MDF file's location in the "Attach Databases" dialog text box. If you don't know the location by heart, click the "Browse" button and click through the directories to locate the MDF file. Double-click the file to set the MDF file location in your SQL Server attachment settings.
-
4
Click "OK" to attach and restore the MDF file. It may take several minutes to complete the task. After the process completes, click the database server name on the left again. You notice the new database is located in the list of available databases on the server.
-
1
References
- Photo Credit computer image by blaine stiger from Fotolia.com