This article was transferred from Hougoo Blog
1. Concept
Differential increment: Is the data block that has changed since the backup ancestor and sibling backup, Delta is the default incremental backup method
Cumulative increment: is a block of all changes since the backup of the superior backup
Because the cumulative increment is a block of data that has been changed since the backup of the ancestor, the cumulative increment requires more backup time, while requiring a smaller recovery time, while the difference increment is reversed, which backs up the chunks of data that have changed since the sibling backup. Therefore, the backup time is reduced, but more recovery time is required. Incremental backups in Oracle 9 need to scan the entire database block to know what data blocks have changed, which is a costly and lengthy process, and because incremental backups form multiple different backup sets, making recovery more unreliable , so incremental backups are still not recommended in version 9, and in 10g, incremental backups have been greatly improved, eliminating the need to scan all data blocks to know which data blocks have changed (block tracking), which greatly improves backup efficiency. But these are at the expense of disk I/O, so in an OLTP transaction system, you have to measure whether you are willing to use I/O to ensure security and high availability. The 10g also supports incremental consolidation, and incremental backups can support 7-level increments.
Turn on block tracking (Database backup and Recovery Basics 4.4.4 improving Incremental Backup performance:change Tracking)
sql> ALTER DATABASE ENABLE BLOCK change TRACKING USING FILE '/app/oracle/product/oradata/fatdb/rman_chg.log ' reuse;
Database altered.
It is necessary to note that the 10g Oracle is only recommended to use level 0 and Levels 1 backup, 10g can also be used to the degree 2. This article only discusses the meaning of level 2, and it is not recommended.
First, take a look at Oracle's official explanation to download the online document database Backup and Recovery Basics 4.4-section Rman Incremental Backups:
A Level 1 Incremental backup can either of the following types:
A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0
A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0
Incremental backups is differential by default.
That is, differential is the change data from the last backup (either level 0 or Level 1) to date, which is the default value for Level 1. and cumulative is all the change data since the last level 0 backup, that is, if there are several incremental backups (level 1 of differential or cumulative) in the middle of level 0 to date, All changes are saved in this delta set.
Set to understand:
The level 1 of an incremental backup is changed from the last 0 or 1 to the present, and level 2 is the increment from the last backup, whether 0 or 1 or 2;
Level 1 of the cumulative backup is the cumulative change from the last 0 to the present, and level 2 is the cumulative increment from the last level 0 or level 1 to date (including the level 2 increment cumulative sum for the period)
Here's a specific example: if we make the following backup strategy for one weeks. If we are going back to Friday, then the difference increment only needs to use Sunday's 0 level, Wednesday Level 1, the 星期四、五 2 level can recover, the cumulative increment will need Sunday 0 level, Wednesday 1 level, the Friday 2 level can restore.
Several backup scripts are downloaded from the Web
Full Library Backup:
run{
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup full tag ' dbfull ' format '/u01/oradata/backup/full%u_%s_%p ' database
Include current controlfile;
SQL ' alter system archive log current ';
Backup filesperset 3 format '/u01/oradata/backup/arch%u_%s_%p '
Archivelog all delete input; #备份归档可选, can be backed up separately on a regular basis
Release channel C1;
Release channel C2;
Release channel C3;
}
Level 0 Backup:
run{
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup incremental Level 0 tag ' db0 ' format '/u01/oradata/backup/db0%u_%s_%p '
Database Skip ReadOnly;
SQL ' alter system archive log current ';
Backup filesperset 3 format '/u01/oradata/backup/arch%u_%s_%p '
Archivelog all delete input; #备份归档可选, can be backed up separately on a regular basis
Release channel C1;
Release channel C2;
Release channel C3;
}
Level 1 Backup:
run{
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup incremental Level 1 tag ' db1 ' format '/u01/oradata/backup/db1%u_%s_%p '
Database Skip ReadOnly;
SQL ' alter system archive log current ';
Backup filesperset 3 format '/u01/oradata/backup/arch%u_%s_%p '
Archivelog all delete input; #备份归档可选, can be backed up separately on a regular basis
Release channel C1;
Release channel C2;
Release channel C3;
}
"Go" in an Rman incremental backup with the concept of differential increments and cumulative increments