我试图恢复我的数据库的SQL Server备份文件,但它抛出一个错误如下:

备份集保存现有数据库以外的数据库的备份

我的数据库是SQL Server 2008,备份文件是2005年的。

会有什么问题呢?


当前回答

首先创建一个同名的空白数据库。然后选择恢复选项

在左侧窗格的选项下,不要忘记选择

覆盖现有数据库 保留复制设置

就是这样

其他回答

我确定这个问题与文件和文件夹权限有关。

同样重要的是,要确保您的数据库名称与您试图恢复的备份中的数据库名称相匹配。如果不匹配,则会得到相同的错误。

这帮助我从系统驱动器导入备份文件

Create a database with the same name(preferably) as your .bak file database name Right click the database > Tasks > Restore > Database Under "Source for restore" select "From Device" Select the .bak file selecting the path from the system Select the check box for the database in the list box below Under "Select a Page" on the right Select "Options" Select the checkbox labeled "Preserve the replication settings(WITH KEEP_REPLICATION) Select the checkbox for Overwrite the existing database(WITH REPLACE) Now Go back to the General page and click OK to restore the database...

我也有同样的问题,但在PS上。我把它留在这里,以防有人试图做同样的事情

Restore-SqlDatabase -ServerInstance "<your instance name>" -Database "<your db name>" -BackupFile "<backup file route>.bak" -ReplaceDatabase

记住使用Set-ExecutionPolicy Unrestricted -Force和import import-module sqlps。完成后,不要忘记将执行策略设置为受限。

我也一样。我的解决方案是:

右键单击数据库。 选择任务,选择恢复数据库。 单击左侧的选项。 检查第一个选项覆盖现有数据库(WITH REPLACE)。 转到常规,选择源和目标数据库。 单击OK,就是这样