f Restore 有設定replication的sql server 資料庫 ~ 迪貝之家

Pages

Restore 有設定replication的sql server 資料庫

如果你的資料庫設定了複寫
restore的時候,應該會出現下列的錯誤
日期,來源,嚴重性,訊息
02/25/2020 10:24:43,spid55,未知,The database 'urdb' is marked OFFLINE and is in a state that does not allow recovery to be run.
02/25/2020 10:24:37,spid55,未知,Starting up database 'urdb'.
02/25/2020 10:24:34,備份,未知,Database 'urdb' was restored<c/> however an error was encountered while replication was being restored/removed. The database has been left offline. See the topic MSSQL_ENG003165 in SQL Server Books Online.
02/25/2020 10:48:48,spid20s,未知,Recovery completed for database urdb (database ID 5) in 30 second(s) (analysis 8853 ms<c/> redo 20646 ms<c/> undo 634 ms.) This is an informational message only. No user action is required.
02/25/2020 10:48:48,spid20s,未知,Recovery is writing a checkpoint in database 'urdb' (5). This is an informational message only. No user action is required.
02/25/2020 10:48:48,spid20s,未知,0 transactions rolled back in database 'urdb' (5). This is an informational message only. No user action is required.
02/25/2020 10:48:47,spid60,未知,CHECKDB for database 'urdb' finished without errors on 2017-01-29 01:14:16.367 (local time). This is an informational message only; no user action is required.
02/25/2020 10:48:47,spid60,未知,36 transactions rolled forward in database 'urdb' (5). This is an informational message only. No user action is required.
02/25/2020 10:48:45,spid60,未知,Recovery of database 'urdb' (5) is 95% complete (approximately 1 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:44,spid60,未知,Recovery of database 'urdb' (5) is 88% complete (approximately 3 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:42,spid60,未知,Recovery of database 'urdb' (5) is 82% complete (approximately 5 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:41,spid60,未知,Recovery of database 'urdb' (5) is 75% complete (approximately 7 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:39,spid60,未知,Recovery of database 'urdb' (5) is 68% complete (approximately 9 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:37,spid60,未知,Recovery of database 'urdb' (5) is 62% complete (approximately 11 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:36,spid60,未知,Recovery of database 'urdb' (5) is 55% complete (approximately 14 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:34,spid60,未知,Recovery of database 'urdb' (5) is 49% complete (approximately 16 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:32,spid60,未知,Recovery of database 'urdb' (5) is 43% complete (approximately 18 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:28,spid60,未知,Recovery of database 'urdb' (5) is 40% complete (approximately 15 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:27,spid60,未知,Recovery of database 'urdb' (5) is 27% complete (approximately 25 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:27,spid60,未知,Recovery of database 'urdb' (5) is 10% complete (approximately 75 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:27,spid60,未知,Recovery of database 'urdb' (5) is 2% complete (approximately 428 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:27,spid60,未知,Recovery of database 'urdb' (5) is 0% complete (approximately 954 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:27,spid60,未知,Recovery of database 'urdb' (5) is 0% complete (approximately 2266 seconds remain). Phase 1 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:18,spid60,未知,Recovery of database 'urdb' (5) is 0% complete (approximately 2286 seconds remain). Phase 1 of 3. This is an informational message only. No user action is required.
02/25/2020 10:48:10,spid60,未知,Starting up database 'urdb'.
02/25/2020 10:48:10,spid60,未知,Setting database option ONLINE to ON for database urdb.
02/25/2020 10:47:04,spid55,未知,Setting database option MULTI_USER to ON for database urdb.
一定要移除掉replication 的設定
才能把資料庫再帶起來
use master
alter database urdb SET multi_user
b. 移除掉所有的replication 設定 :
exec sp_removedbreplication 'urdb'
移除掉設定後,你建置replication的時候,還是會出錯
從我幾次建置測試環境的過程中
就是要下這三個指令後, 複寫的建置才不會出錯 :
use urdb
exec sp_repldone @xactid = NULL, @xact_seqno = NULL, @numtrans = 0, @time = 0, @reset = 1
exec sp_replflush
exec sp_changedbowner sa