iT邦幫忙

0

MS SQL 差異/完整備份還原問題

公司SQL Server是排程週日做資料庫A、B、C的完整備份、
週一到六做差異備份,自動刪除超過一週檔案
問題1、若我在週四要還原到週三,我是先還原週日的完整備份,再還原週三的差異備份就好
或者是要,先還原完整備份,再依序還原一->二->三的差異備份?
因我看網路上有兩種教學,有點搞不清楚...

問題2、若我在週三 為了修改數據,先對資料庫A做一個手動完整備份
後續幾天的資料庫A 排程差異備份,是會備份週三的手動備份後的差異嗎?
我之前都修改完後,過兩、三天沒問題就直接砍了手動備份,謝謝

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

6
Ray
iT邦大神 1 級 ‧ 2015-07-19 12:09:08
最佳解答

一般備份有三種類型: Full(完整), Differential(差異), Incremental(增量)
後兩者都是只備份某一次 Full 之後的變更, 但其不同點在於:

  1. Differential 是比對備份當下跟當上一次 Full 之間的變更
  2. Incremental 是比對備份當下跟上次 Full 之後的最後一次 Incremental 變更

由於 Microsoft SQL 提供的是 Differential 備份類型, 所以你只需要還原 Full 和指定日期的 Differential 就可以了. 這裡有詳細的解釋:
Differential Backups (SQL Server)
關鍵段落在此:

A differential backup captures only the data that has changed since that full backup.

Therefore restoring from a differential backup will necessarily take more steps and time than restoring from a full backup because two backup files are required.

At restore time, before you restore a differential backup, you must restore its base. Then, restore only the most recent differential backup to bring the database forward to the time when that differential backup was created. Typically, you would restore the most recent full backup followed by the most recent differential backup that is based on that full backup.

vicentli iT邦研究生 4 級 ‧ 2015-07-19 12:37:45 檢舉

iT邦幫忙MVPraytracy提到:
Differential

所以看起來,我為修改資料庫前,手動作單一資料庫的完整備份也是要留存下來的囉
謝謝

Ray iT邦大神 1 級 ‧ 2015-07-19 13:07:58 檢舉

vicentli提到:
手動作單一資料庫的完整備份也是要留存下來的囉

是的, 因為一旦做了 Full 之後, 先前做的 Differential 通通都失效, 要從最後一次的 Full 重新計算起.

我要發表回答

立即登入回答