差异备份大约等于完全备份[IN SIZE]

时间:2017-05-16 08:59:21

标签: sql-server database backup metadata database-backups

我目前正在使用 SQL Server 2005 来处理我的应用程序中的数据/记录,并且通常使用默认(完整)模式进行数据库备份。最近,我将其备份模式切换到差分,以消除过多的大小/时间,理想情况下完全备份操作。

但是,我震惊地看到新创建的差异备份的大小仅比 100-150 MB 小于完全备份,这意味着每当需要进行数据库恢复时,它将通过恢复两者来增加工作量(完全和差异的相同大小的备份,几乎是时间的两倍。我不明白在差异备份启动之前究竟考虑了什么。

如果我说,我有一个包含1000条记录的3个表,并且在完成备份后,今天只添加/更新了150条记录。那么差异备份如何确定准备备份的内容呢?我不认为SQL内部会在表上放置where子句并仅过滤掉更新的记录吗?不知道这些事情可能会在元数据层面得到决定但是怎么样?

根据备份脚本的考虑,它是完美的。见下文。

BACKUP DATABASE [MyDatabase] TO DISK =''C:\ DB \ MyDatabaseDiffertialBackup.diff''WITH DIFFERENTIAL,INIT

1 个答案:

答案 0 :(得分:0)

You need to first understand SQL backup types and recovery models. For an efficient point in time recovery, a proper backup plan should consist of:-

  1. Full backup (this can be done on a weekly basis or in every 3-4 days).
  2. Differential or Incremental backup (can be done on a daily basis).
  3. Log Backup (every 15 minutes).

You should have at least one full backup in a week (mostly during off load hours when the load on the database in minimal), followed by daily incremental backups and log backups. In case if database restoration is needed, all you need to do is restore the latest full backup, followed by the latest differential backup, followed by the latest transaction log backup. Relying on only differential backup for DB restoration is not a best practice.

Again the change in metadata for differential backup is decided on the basis of the previous full backup being taken. A differential backup is not independent and it must be based on the latest full backup of the data. That means there should have a full backup as a base. A differential backup contains only the data that has changed since the differential base.

相关问题