sql 2005数据库备份文件,在感觉到sql server 2008中时,报如下错误。
Problem:
Error 3154: The backup set holds a backup of a database other than the existing 'xx' database.
解决方法,执行如下还原语句即可。
语句:
复制代码 代码示例:
USE master
RESTORE DATABASE CARGOMAX_SECURITY
FROM DISK = 'C:Program FilesMicrosoft SQL ServerMSSQL10.SQL2008MSSQLBackupcargo_security20090720.bak'
WITH MOVE 'CARGOMAX_SECURITY' TO 'F:WorkspaceWareholderProjectDBCARGOMAX_SECURITY.mdf',
MOVE 'CARGOMAX_SECURITY_log' TO 'F:WorkspaceWareholderProjectDBCARGOMAX_SECURITY_log.ldf',
STATS = 10, REPLACE
GO
笔者的例子:
复制代码 代码示例:
USE master
RESTORE DATABASE test_db
FROM DISK = 'f:data_storetest_db_2014112601.bak'
WITH MOVE 'test_db' TO 'F:DBtest_db.mdf',
MOVE 'test_db_log' TO 'F:DBtest_db_log.ldf',
STATS = 10, REPLACE
GO