Restoring the SQL Server Database
The following section describes how to import the data from the source system to the target system using the Restore method for a Microsoft SQL server database.
Use the following steps to restore an SQL server database:
1. Connect to the appropriate instance of the Microsoft SQL server Database Engine and in Object Explorer, click the server name to expand the server tree.
2. Expand Databases. Select the database created during the installation of the target system.
3. Right-click the databases, select Tasks, and then click Restore.
4. Click Database, which opens the Restore Database window.
5. To specify the source and location of the backup sets to restore, select Device under Source section.
6. Click the browse button to open the Select backup device window.
7. In the Backup media list box, select File and then click Add to locate the backup file.
8. Browse to, and select the backup file, and then click OK.
9. After you add the devices you want to the Backup location list box, click OK to return to the General page.
10. On the General page, the name of the restoring database appears in the Database text box under the destination section. Change the name, if needed.
11. Select a backup set from Backup Sets to restore.
12. In Restore to, retain the default (Most recent possible).
13. To view or select the advanced options, click Options in the Select a page pane.
14. In the Restore options panel, select Overwrite the existing database. Do not select any check box under the Tail-Log backup section.
15. Specify the location for the data and log files. On the Files page, select Relocate all files to folder, and browse to the correct target system location in the Data file folder and Log file folder fields.
16. Do not choose any other options. Click OK to apply the options.
17. On the General page, verify the name of the restoring database appears in the To database list box.
After the database is restored, click the New Query button on the top left and execute the following query:
USE "DB_NAME"
GO
EXEC sp_change_users_login Auto_Fix, 'DB_USER' , NULL , 'DB_PWD'
For example:
USE "wcuser"
GO
EXEC sp_change_users_login Auto_Fix, 'wcuser' , NULL, 'wcpwd'
18. Configure the SQL Server instance to use ‘contained database authentication.’. Execute the following statement:
use master
GO
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE
GO
這是否有幫助?