Restoring a SQL Server Database from BAK and MDF Files
Using Microsoft® Database Publishing Wizard (DPW) you can restore a SQL Server database from a backup file (BAK
) created outside the Hosting Control Panel or from an MDF file. For information on Database Publishing Wizard, see What are the Database Publishing Service and Database Publishing Wizard?
NOTE: We recommend you create SQL Server database backups through the Hosting Control Panel. For more information, see Backing Up SQL Server Databases.
To use DPW, you must locally install SQL Server Express and SQL Server Management Studio for the version of SQL Server you used to create the database.
From SQL 2005 Databases
From SQL 2008 Databases
The process to restore the database depends on which type of file you created.
BAK Files
To Restore a SQL Server Database from BAK Files
- The Connect to Server dialog box displays.
If it does not display, from the File menu, select Connect Object Explorer.
- From Server Type, select Database Engine.
- Enter the required Server Name and Authentication information (if it does not auto-populate)
NOTE: This is the information for your local install of SQL Server Express.
- Click Connect.
- Right-click the Databases folder, and then select New Database.
- Enter a Database Name, and then click OK.
- Open the Databases folder to find your new database.
- Right-click your new database, and then, from the Tasks menu, select Restore, and then Database.
- Select From Device, and then click ... to browse.
- Click Add, navigate to and select your
BAK
file, and then click OK. - Select your
BAK
file. - Click Options on the left, and then select Overwrite the existing database.
- Click OK to execute the restore.
- Verify the contents of your database, which is now active on your local machine.
- Publish your database using the Microsoft Database Publishing Wizard. For more information, see Publishing a Database Using the Database Publishing Wizard.
NOTE: You cannot use DPW with Microsoft SQL Server 2008 Databases. However, you can potentially restore SQL Server 2008
BAK
files into SQL Server 2005 databases.
MDF Files
To Restore a SQL Server Database from MDF Files
- The Connect to Server dialog box displays.
If it does not display, from the File menu, select Connect Object Explorer.
- From Server Type, select Database Engine.
- Enter the required Server Name and Authentication information (if it does not auto-populate)
NOTE: This is the information for your local install of SQL Server Express.
- Click Connect.
- Right-click the Databases folder, and then select Attach.
- Click Add, navigate to and select the MDF file you want to use, and then click OK twice.
- Verify the contents of your database, which is now active on your local machine.
- Publish your database using the Microsoft Database Publishing Wizard. For more information, see Publishing a Database Using the Database Publishing Wizard.
NOTE: You cannot use DPW with Microsoft SQL Server 2008 Databases. However, you can potentially restore SQL Server 2008
BAK
files into SQL Server 2005 databases.