SQL SERVER恢復資料錯誤解決:The backup set holds a backup of a database other than the existing
http://dba.stackexchange.com/questions/44967/error-3154-while-restoring-a-backup-using-with-replace
You should use WITH
REPLACE
and in general avoid using the point-and-click thingies in Management Studio - they're inflexible and often have bugs.
This worked for me:
USE [master];
GO
CREATE DATABASE test;
GO
CREATE DATABASE test2;
GO
BACKUP DATABASE test TO DISK = 'c:\temp\test.bak' WITH INIT, COMPRESSION;
GO
RESTORE DATABASE test2
FROM DISK = 'c:\temp\test.bak'
WITH REPLACE,
MOVE 'test' TO 'c:\temp\test2.mdf',
MOVE 'test_log' TO 'c:\temp\test2.ldf';
Also you should make sure when you backup databases you use WITH
INIT
and/or don't point the device at a file that already contains a backup (since it might not be the same database you're backing up now - especially if you reuse names like test
...).
1) Use WITH
REPLACE
while using the RESTORE
command.
2) DROP
the
older database which is conflicting and restore again using RESTORE
command.
There is no problem with the SQL Server version. As Aaron pointed out, I am also able to restore the database from 2008 to 2012 and same versions as well.
http://blog.sqlauthority.com/2013/11/23/sql-server-fix-error-3154-the-backup-set-holds-a-backup-of-a-database-other-than-the-existing-database-ssms/
http://blog.csdn.net/j2eevic/article/details/7408432
方法一:
--返回由備份集內包含的資料庫和日誌檔案列表組成的結果集。
--主要獲得邏輯檔名
USE master
RESTORE FILELISTONLY
FROM DISK = 'g:\back.Bak'
Go
--**********************************
/*
利用bak恢復資料庫,強制還原(REPLACE)
STATS = 10 每完成10%顯示一條記錄
DBTest和DBTest_log是上面g:\back.Bak裡的邏輯檔案
*/
USE master
RESTORE DATABASE DB
FROM DISK = 'g:\back.Bak'
WITH MOVE 'DBTest' TO 'E:\Program Files\Microsoft SQL Server2005\Data\DB.mdf',
MOVE 'DBTest_log' TO 'E:\Program Files\Microsoft SQL Server2005\Data\DB_log.ldf',
STATS = 10, REPLACE
GO
-------------------------------------
/*
備份資料DB 到.bak檔案。然後利用此bak檔案恢復一個新的資料庫DBTest。
*/
USE master
BACKUP DATABASE DB
TO DISK = 'g:\DBBack0930.bak'
RESTORE FILELISTONLY
FROM DISK = 'g:\DBBack0930.bak'
RESTORE DATABASE DBTest
FROM DISK = 'g:\DBBack0930.bak'
WITH MOVE 'DBTest' TO 'E:\Program Files\Microsoft SQL Server2005\Data\DBTest.mdf',
MOVE 'DBTest_log' TO 'E:\Program Files\Microsoft SQL Server2005\Data\DBTest_log.ldf'
GO
---******************************
方法二
需要注意兩點:
在【選項】介面裡
1.選擇“覆蓋現有資料庫”
2.修改【將資料庫檔案還原為】區域裡的【還原為】的位置,和要恢復的資料庫的實際位置保持一致
相關文章
- SQL Server資料庫恢復,SQL Server資料恢復,SQL Server資料誤刪除恢復工具SQLRescueSQLServer資料庫資料恢復
- 如何恢復Hyper Backup備份的資料
- SQLBackupAndFTP12.0 failed to backup database with full backup typeSQLFTPAIDatabase
- 資料庫資料恢復—附加資料庫錯誤823的SQL Server資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】磁碟空間不足導致sql server錯誤的資料恢復資料庫資料恢復SQLServer
- SQL Server資料庫出現邏輯錯誤的資料恢復SQLServer資料庫資料恢復
- recover database using backup controlfile理解Database
- DBMS_BACKUP_RESTORE.DBMS_BACKUP_RESTORE用於特殊情況下的恢復REST
- db2備份恢復(backup restore)DB2REST
- PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.16.00.00 in TARGET database isSQLPackageRESTDatabase
- sql server資料庫附加錯誤的解決過程SQLServer資料庫
- Crunchy PostgreSQL database backup via pgo commandSQLDatabaseGo
- PostgreSQL DBA(30) - Backup&Recovery#3(資料檔案損壞恢復)SQL
- sql server資料庫錯誤資料恢復(資料庫連線失效,無法附加查詢)SQLServer資料庫資料恢復
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- centos 重啟掛載錯誤 failed to mount /backupCentOSAI
- 伺服器sql server 資料恢復伺服器SQLServer資料恢復
- 帝國CMS匯入恢復資料MySQL server has gone away錯誤的解決辦法MySqlServerGo
- 如何從Active Backup for Business備份中恢復檔案
- SQL Server DACPAC資料庫部署錯誤SQLServer資料庫
- 理解RMAN backup database plus archivelog delete all input命令DatabaseHivedelete
- 【資料庫資料恢復】sql server資料庫連線失效的資料恢復案例資料庫資料恢復SQLServer
- 解決 SQL Server 安裝失敗均,報錯“等待資料庫引擎恢復控制代碼失敗”SQLServer資料庫
- 【資料庫資料恢復】SQL server資料庫被加密怎麼辦?如何恢復?資料庫資料恢復SQLServer加密
- Sybase SQL Anywhere(ASA)資料庫恢復,ASA資料恢復,資料誤刪除恢復工具ReadASADBSQL資料庫資料恢復
- 【資料庫資料恢復】SQL Server資料庫磁碟空間不足的資料恢復案例資料庫資料恢復SQLServer
- SQL Server資料庫恢復常見問題SQLServer資料庫
- DBMS_BACKUP_RESTORE用於特殊情況下的恢復(轉)REST
- 【資料庫資料恢復】透過資料頁恢復Sql Server資料庫資料的過程資料庫資料恢復SQLServer
- 資料庫資料恢復-SQL SERVER資料庫MDF (NDF)或LDF損壞如何恢復資料?資料庫資料恢復SQLServer
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- PostgreSQL DBA(29) - Backup&Recovery#2(日期格式導致的錯誤)SQL
- 資料庫資料恢復-SQL SERVER資料庫檔案大小變為“0”的資料恢復方案資料庫資料恢復SQLServer
- [AlwaysOn] 建立SQL Server高可用性組T-SQL語法:BACKUP_PRIORITY引數SQLServer
- md_backup
- 【資料庫資料恢復】MS SQL資料庫附加資料庫出錯怎麼恢復資料?資料庫資料恢復SQL
- Sql Server資料庫檔案丟失的恢復方法SQLServer資料庫
- 伺服器SQL server資料庫被加密恢復方案伺服器SQLServer資料庫加密
- 伺服器資料恢復-ESX SERVER資料恢復案例伺服器資料恢復Server