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資料庫資料恢復
- SQL SERVER BACKUP DATABASE 加快備份速度方法SQLServerDatabase
- client backup was not attempted because backup window closed 錯誤解決一例client
- SQL Server Backup & RestoreSQLServerREST
- 如何恢復Hyper Backup備份的資料
- 資料庫資料恢復—附加資料庫錯誤823的SQL Server資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】磁碟空間不足導致sql server錯誤的資料恢復資料庫資料恢復SQLServer
- T-SQL Verify Database BackupSQLDatabase
- SQL Server資料庫出現邏輯錯誤的資料恢復SQLServer資料庫資料恢復
- Backup And Recovery User's Guide-使用資料恢復指導診斷和修復錯誤-修復失敗GUIIDE資料恢復
- oracle rman backup命令檢查資料庫錯誤Oracle資料庫
- 使用dbms_backup_restore進行資料庫恢復REST資料庫
- sql server資料庫附加錯誤的解決過程SQLServer資料庫
- rman backup database 出現 ORA-01422錯誤Database
- Backup And Recovery User's Guide-從RMAN開始-使用資料恢復指導診斷和修復錯誤GUIIDE資料恢復
- oracle full database backupOracleDatabase
- Rman backup standby databaseDatabase
- Cold Database backup scriptDatabase
- Backup And Recovery User's Guide-介質恢復問題解決GUIIDE
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- sql server資料庫錯誤資料恢復(資料庫連線失效,無法附加查詢)SQLServer資料庫資料恢復
- Backup And Recovery User's Guide-使用SET AUTORECOVERY進行自動恢復GUIIDE
- A Guide for SQL Server Backup Application VendorsGUIIDESQLServerAPP
- SQLBackupAndFTP12.0 failed to backup database with full backup typeSQLFTPAIDatabase
- Backup And Recovery User's Guide-介質恢復問題解決-執行試驗恢復GUIIDE
- SQL SERVER Msg 7357錯誤解決SQLServer
- 應對RMAN-06026錯誤,使用dbms_backup_restore進行恢復REST
- Backup And Recovery User's Guide-執行完全資料庫恢復-關於完全資料庫恢復GUIIDE資料庫
- Cold backup and restore the entire databaseRESTDatabase
- rman backup database force 功能Database
- db2備份恢復(backup restore)DB2REST
- DBMS_BACKUP_RESTORE.DBMS_BACKUP_RESTORE用於特殊情況下的恢復REST
- PostgreSQL DBA(30) - Backup&Recovery#3(資料檔案損壞恢復)SQL
- Backup And Recovery User's Guide-執行完全資料庫恢復GUIIDE資料庫
- SQL Server 系統資料庫恢復SQLServer資料庫
- 伺服器sql server 資料恢復伺服器SQLServer資料恢復
- 理解備份集backup set與備份片backup piece
- Sql server資料庫記錄修改追蹤和恢復的解決方案SQLServer資料庫