This blog post is part of the “RMAN Back to Basics” series, which can be found here.
Incremental Backup
An incremental backup only backup up those data blocks that have changed since the last backup.
Types of Incremental Backups
There are 2 types of Incremental Backups:
- Level 0 are a base for subsequent backups. Copies all blocks containing data similar to a full backup, with the only difference that full backups are never included in an incremental strategy. Level 0 can be backup sets or image copies.
- Level 1 are subsequent backups of a level 0, backing up by default all blocks changed after the most recent level 0 or 1, known as differential incremental backup. More on different types of level 1 backups is discuss in detail here.
Incremental Level 1 Demo
We take an incremental level 1 backup using my script 6_incremental_level_1.sh:
[oracle@dc1sbxdb001 demo]$ ./6_incremental_level_1.sh ----------------------- Step 1: Set environment ----------------------- Setting the Database Environment using oraenv... The Oracle base remains unchanged with value /u01/app/oracle ORACLE_SID: ZEDDBA ORACLE_HOME: /u01/app/oracle/product/12.2.0/dbhome_1 Press Enter to continue
The environment is set to my ZEDDBA database, then next the incremental backup (Level 1) is taken:
---------------------------------------- Step 2: Take Incremental Level 1 Backup ---------------------------------------- Cotent of 6_incremental_level_1.cmd file: BACKUP INCREMENTAL LEVEL 1 DATABASE TAG 'INCR LEVEL 1'; HOST 'read Press Enter to LIST BACKUP'; LIST BACKUP; Press Enter to continue Calling 'rman target / cmdfile=/media/sf_Software/scripts/demo/6_incremental_level_1.cmd' Recovery Manager: Release 12.2.0.1.0 - Production on Wed May 22 12:08:27 2019 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: ZEDDBA (DBID=3520942925) RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE TAG 'INCR LEVEL 1'; 2> HOST 'read Press Enter to LIST BACKUP'; 3> LIST BACKUP; 4> Starting backup at 22-MAY-19 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=153 device type=DISK channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_system_gftkr3fv_.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_sysaux_gftkr792_.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_undotbs1_gftkr944_.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_users_gftkr9fc_.dbf channel ORA_DISK_1: starting piece 1 at 22-MAY-19 channel ORA_DISK_1: finished piece 1 at 22-MAY-19 piece handle=/u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_22/o1_mf_nnnd1_INCR_LEVEL_1_ggbcfhbp_.bkp tag=INCR LEVEL 1 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 22-MAY-19 Starting Control File and SPFILE Autobackup at 22-MAY-19 piece handle=/u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_22/o1_mf_s_1008936514_ggbcflon_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 22-MAY-19 host command complete
We use host within RMAN just to wait for input before moving on for demo purposes. Next we list the backup within RMAN using ‘LIST BACKUP‘:
List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1 Full 498.93M DISK 00:00:08 16-MAY-19 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: FULL BACKUP Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_16/o1_mf_nnndf_FULL_BACKUP_gfv4k119_.bkp List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 Full 353825 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_system_gftkr3fv_.dbf 2 Full 353825 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_sysaux_gftkr792_.dbf 3 Full 353825 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_undotbs1_gftkr944_.dbf 4 Full 353825 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_users_gftkr9fc_.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 2 Full 8.31M DISK 00:00:00 16-MAY-19 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20190516T173912 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_16/o1_mf_s_1008437952_gfv4kjko_.bkp SPFILE Included: Modification time: 16-MAY-19 SPFILE db_unique_name: ZEDDBA Control File Included: Ckp SCN: 353836 Ckp time: 16-MAY-19 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 3 77.83M DISK 00:00:01 16-MAY-19 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: FULL BACKUP PLUS ARCHIVELOG Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_16/o1_mf_annnn_FULL_BACKUP_PLUS_ARC_gfv4y7m2_.bkp List of Archived Logs in backup set 3 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 13 332298 16-MAY-19 354044 16-MAY-19 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 498.94M DISK 00:00:06 16-MAY-19 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20190516T174603 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_16/o1_mf_nnndf_TAG20190516T174603_gfv4yco3_.bkp List of Datafiles in backup set 4 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 Full 354058 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_system_gftkr3fv_.dbf 2 Full 354058 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_sysaux_gftkr792_.dbf 3 Full 354058 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_undotbs1_gftkr944_.dbf 4 Full 354058 16-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_users_gftkr9fc_.dbf BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 5 3.50K DISK 00:00:00 16-MAY-19 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: FULL BACKUP PLUS ARCHIVELOG Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_16/o1_mf_annnn_FULL_BACKUP_PLUS_ARC_gfv4ym4v_.bkp List of Archived Logs in backup set 5 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 14 354044 16-MAY-19 354066 16-MAY-19 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 6 Full 8.31M DISK 00:00:00 16-MAY-19 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20190516T174612 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_16/o1_mf_s_1008438372_gfv4ynmv_.bkp SPFILE Included: Modification time: 16-MAY-19 SPFILE db_unique_name: ZEDDBA Control File Included: Ckp SCN: 354077 Ckp time: 16-MAY-19 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 7 Full 8.31M DISK 00:00:00 17-MAY-19 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20190517T165453 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_17/o1_mf_s_1008521693_gfxpbfs7_.bkp SPFILE Included: Modification time: 17-MAY-19 SPFILE db_unique_name: ZEDDBA Control File Included: Ckp SCN: 458035 Ckp time: 17-MAY-19 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 8 Incr 0 511.64M DISK 00:00:05 20-MAY-19 BP Key: 8 Status: AVAILABLE Compressed: NO Tag: INCR LEVEL 0 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_20/o1_mf_nnnd0_INCR_LEVEL_0_gg5njx01_.bkp List of Datafiles in backup set 8 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 0 Incr 571045 20-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_system_gftkr3fv_.dbf 2 0 Incr 571045 20-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_sysaux_gftkr792_.dbf 3 0 Incr 571045 20-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_undotbs1_gftkr944_.dbf 4 0 Incr 571045 20-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_users_gftkr9fc_.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 9 Full 8.31M DISK 00:00:00 20-MAY-19 BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20190520T171324 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_20/o1_mf_s_1008782004_gg5nk4cs_.bkp SPFILE Included: Modification time: 20-MAY-19 SPFILE db_unique_name: ZEDDBA Control File Included: Ckp SCN: 571056 Ckp time: 20-MAY-19 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 10 Incr 1 11.22M DISK 00:00:02 22-MAY-19 BP Key: 10 Status: AVAILABLE Compressed: NO Tag: INCR LEVEL 1 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_22/o1_mf_nnnd1_INCR_LEVEL_1_ggbcfhbp_.bkp List of Datafiles in backup set 10 File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name ---- -- ---- ---------- --------- ----------- ------ ---- 1 1 Incr 575174 22-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_system_gftkr3fv_.dbf 2 1 Incr 575174 22-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_sysaux_gftkr792_.dbf 3 1 Incr 575174 22-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_undotbs1_gftkr944_.dbf 4 1 Incr 575174 22-MAY-19 NO /u01/app/oracle/oradata/ZEDDBA/datafile/o1_mf_users_gftkr9fc_.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 11 Full 8.31M DISK 00:00:00 22-MAY-19 BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20190522T120834 Piece Name: /u01/app/oracle/fast_recovery_area/ZEDDBA/autobackup/2019_05_22/o1_mf_s_1008936514_ggbcflon_.bkp SPFILE Included: Modification time: 22-MAY-19 SPFILE db_unique_name: ZEDDBA Control File Included: Ckp SCN: 575181 Ckp time: 22-MAY-19 Recovery Manager complete. Press Enter to continue
Next we look at the file size of the backup piece and we can see the level 1 was just 12M compared to the level 0 which was 512M:
Files size on disk: /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_16: total 1.1G -rw-r-----. 1 oracle oinstall 499M May 16 17:39 o1_mf_nnndf_FULL_BACKUP_gfv4k119_.bkp -rw-r-----. 1 oracle oinstall 78M May 16 17:46 o1_mf_annnn_FULL_BACKUP_PLUS_ARC_gfv4y7m2_.bkp -rw-r-----. 1 oracle oinstall 499M May 16 17:46 o1_mf_nnndf_TAG20190516T174603_gfv4yco3_.bkp -rw-r-----. 1 oracle oinstall 4.0K May 16 17:46 o1_mf_annnn_FULL_BACKUP_PLUS_ARC_gfv4ym4v_.bkp /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_20: total 512M -rw-r-----. 1 oracle oinstall 512M May 20 17:13 o1_mf_nnnd0_INCR_LEVEL_0_gg5njx01_.bkp /u01/app/oracle/fast_recovery_area/ZEDDBA/backupset/2019_05_22: total 12M -rw-r-----. 1 oracle oinstall 12M May 22 12:08 o1_mf_nnnd1_INCR_LEVEL_1_ggbcfhbp_.bkp Press Enter to continue
Finally, we update the demo log table:
------------------------------------- Step 3: Updating and viewing demo log ------------------------------------- Calling 'sqlplus / as sysdba' To updated and view demo log 1 row created. Commit complete. WHEN COMMENTS ------------------------------ -------------------------------------------------- 16-MAY-19 05.31.24.000000 PM Enable Archive Log Mode 16-MAY-19 05.40.23.000000 PM Full Backup 16-MAY-19 05.46.17.000000 PM Full Backup plus Archive Logs 17-MAY-19 04.55.12.000000 PM Image Copy 20-MAY-19 05.13.44.000000 PM Incremental Level 0 22-MAY-19 12.09.17.000000 PM Incremental Level 1 6 rows selected. Press Enter to exit shell script [oracle@dc1sbxdb001 demo]$
Reference
- 8.8 About RMAN Incremental Backups
- Database Backup and Recovery User’s Guide
- Database Backup and Recovery Reference
Scripts
To download all 2 in one zip: 6_incremental_level_1.zip
The rest of the series
- Oracle Database File Placement Best Practice & Create Database Demo
- RMAN Full Backup & Demo
- RMAN Image Copy & Demo
- RMAN Incremental & Demo Part 1 (Level 0)
- RMAN Incremental & Demo Part 2 (Level 1)
- RMAN Incremental with Block Change Tracking & Demo
- RMAN Incremental Differential vs Cumulative & Demo
- RMAN Incremental Updating Backup & Demo Part 1
- RMAN Incremental Updating Backup & Demo Part 2
- Flashback
- RMAN Block Media Recovery
- RMAN Recover database with only FRA
- RMAN Obsolete
Please Note: Links to the blog posts will be released daily and updated here.
If you found this blog post useful, please like as well as follow me through my various Social Media avenues available on the sidebar and/or subscribe to this oracle blog via WordPress/e-mail.
Thanks
Zed DBA (Zahid Anwar)
Pingback: RMAN Back to Basics Series | Zed DBA's Oracle Blog
Pingback: Oracle Database File Placement Best Practice & Create Database Demo | Zed DBA's Oracle Blog
Pingback: RMAN Full Backup & Demo | Zed DBA's Oracle Blog
Pingback: RMAN Image Copy & Demo | Zed DBA's Oracle Blog
Pingback: RMAN Incremental & Demo Part 1 (Level 0) | Zed DBA's Oracle Blog
Pingback: RMAN Incremental with Block Change Tracking & Demo | Zed DBA's Oracle Blog
Pingback: RMAN Incremental Differential vs Cumulative & Demo | Zed DBA's Oracle Blog
Pingback: RMAN Incremental Updating Backup & Demo Part 1 | Zed DBA's Oracle Blog