且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Bak文件导入SQL Server Express

更新时间:2022-10-17 23:15:07

有分步说明(带有图片) )@ @ 还原数据库


  1. 单击开始,选择所有程序,然后单击 Microsoft SQL Server 2008 ,然后选择 SQL Server Management Studio

    这将弹出连接到服务器对话框。

    确保服务器名称 YourServerName ,并且该 Authentication 设置为 Windows身份验证

    单击 Connect 。 p>


  2. 在右侧,右键单击数据库,然后选择还原数据库

    这将打开还原数据库窗口


  3. 还原数据库屏幕上 ong>,选择 From Device单选按钮,然后单击 ... 框。

    这将弹出指定备份屏幕


  4. 指定备份屏幕上,单击添加

    这将调出查找备份文件


  5. 选择 DBBackup文件夹,然后选择您的备份文件。


  6. 还原数据库屏幕中,在选择要还原的备份集下:在数据旁边的还原框中和到数据库旁边的下拉列表中进行检查:选择DbName


  7. 您已完成。



I have a .bak file, and I want to use this file to recreate the database in a fresh install of SQL Server 2008 Management Studio.

Can someone point me in the right direction on how this can be done?

I have tried:

  1. right click on the Databases container within object explorer

  2. from context menu select Restore database

  3. Specify To Database as either a new or existing database

  4. Specify Source for restore as from device

  5. Select Backup media as File

  6. Click the Add button and browse to the location of the BAK file

but I am getting error that

Restore failed for Server 'MyServer-PC'. (Microsoft.SqlServer.SmoExtended)

ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'invent' database. (Microsoft.SqlServer.Smo)

There is a step by step explanation (with pictures) available @ Restore DataBase

  1. Click Start, select All Programs, click Microsoft SQL Server 2008 and select SQL Server Management Studio.
    This will bring up the Connect to Server dialog box.
    Ensure that the Server name YourServerName and that Authentication is set to Windows Authentication.
    Click Connect.

  2. On the right, right-click Databases and select Restore Database.
    This will bring up the Restore Database window.

  3. On the Restore Database screen, select the From Device radio button and click the "..." box.
    This will bring up the Specify Backup screen.

  4. On the Specify Backup screen, click Add.
    This will bring up the Locate Backup File.

  5. Select the DBBackup folder and chose your BackUp File(s).

  6. On the Restore Database screen, under Select the backup sets to restore: place a check in the Restore box, next to your data and in the drop-down next to To database: select DbName.

  7. You're done.