[英]Restore DB using a bak file. The backup set holds a backup of a database other than the existing database
I am attempting to restore a DB for example versionB using a.bak file of version A.我正在尝试使用版本 A 的 a.bak 文件来恢复例如版本 B 的数据库。
It seems like that is not the right thing to do because I am getting an error:这似乎不是正确的做法,因为我收到了一个错误:
TITLE: Microsoft SQL Server Management Studio TITLE: Microsoft SQL 服务器管理工作室
Restore of database 'B' failed.数据库“B”的还原失败。
(Microsoft.SqlServer.Management.RelationalEngineTasks) (Microsoft.SqlServer.Management.RelationalEngineTasks)ADDITIONAL INFORMATION:附加信息:
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'B' database. System.Data.SqlClient.SqlError:备份集包含一个数据库的备份,而不是现有的“B”数据库。 (Microsoft.SqlServer.SmoExtended) (Microsoft.SqlServer.SmoExtended)
To overwrite a database with a backup taken from a different database you must specify the WITH REPLACE option in the RESTORE command.要使用从不同数据库获取的备份覆盖数据库,您必须在 RESTORE 命令中指定WITH REPLACE选项。
REPLACE should be used rarely and only after careful consideration. REPLACE 应该很少使用,并且只有在仔细考虑之后才能使用。 Restore normally prevents accidentally overwriting a database with a different database.恢复通常可以防止意外地用不同的数据库覆盖数据库。 If the database specified in a RESTORE statement already exists on the current server and the specified database family GUID differs from the database family GUID recorded in the backup set, the database is not restored.如果 RESTORE 语句中指定的数据库已存在于当前服务器上,并且指定的数据库系列 GUID 与备份集中记录的数据库系列 GUID 不同,则不会还原数据库。 This is an important safeguard.这是一个重要的保障。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.