We will continue with RMAN backup practice.
You can do the incremental backup either online or offline and in either Archivelog mode or Noarchivelog mode.+
The Block Change Tracking File:
By default, when doing incremental backup, any datafile that has changed in any way will be backed up.
RMAN provides the ability to just backup the changed database blocks. To enable block change tracking runn the
alter database enable block change. The result of this command will be creation of the block change tracking file.
SQL> alter database enable block change tracking using file '/oracle/bctf/btest11g_block_change.fil';
Database altered.
you can revert this setting by using
SQL> alter database disable block change tracking;
Database altered.
The file can hold maximum of 8 backups.
You can check, if tracking is enabled:
SQL> select status from v$block_change_tracking;
STATUS
----------
ENABLED
The Base Backup:
When doing incremental backup, first thing you need is the incremental base backup.
Incremental backups have levels addigned to them. A base backup will allways have value 0, and you must have this backup to be able to do incremental backups.
[oracle@btest ~]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:16:38 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 0 format='/backup/database/level0_%d_%U.bkp' tag='incremental level 0' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/backup/database/level0_BTEST_1un2560v_1_1.bkp tag=INCREMENTAL LEVEL 0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:47
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-00 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1731 Incr 0 423.47M DISK 00:01:37 31-JAN-12
BP Key: 1732 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 0
Piece Name: /backup/database/level0_BTEST_1un2560v_1_1.bkp
List of Datafiles in backup set 1731
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 625126 31-JAN-12 /oracle/oradata/system01.dbf
2 0 Incr 625126 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 0 Incr 625126 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 0 Incr 625126 31-JAN-12 /oracle/oradata/users01.dbf
Differential vs. cumulative Incremental Backups:
Differential backup:
This is default ype of the backup. With a differential backup, RMAN backups up all blocks that have changed since the last level 1 backup or since last level 0 backup if the backup is first incrementla backup after level 0 backup.
[oracle@btest database]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:24:45 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 1 format='incrmental1_%d_%U.bkp' tag='incremental level 1' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device
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=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/oracle/product/11.2/db_1/dbs/incrmental1_BTEST_20n256e8_1_1.bkp tag=INCREMENTAL LEVEL 1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-01 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1731 Incr 0 423.47M DISK 00:01:37 31-JAN-12
BP Key: 1732 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 0
Piece Name: /backup/database/level0_BTEST_1un2560v_1_1.bkp
List of Datafiles in backup set 1731
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 625126 31-JAN-12 /oracle/oradata/system01.dbf
2 0 Incr 625126 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 0 Incr 625126 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 0 Incr 625126 31-JAN-12 /oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1765 Incr 1 80.00K DISK 00:00:01 31-JAN-12
BP Key: 1768 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 1
Piece Name: /oracle/product/11.2/db_1/dbs/incrmental1_BTEST_20n256e8_1_1.bkp
List of Datafiles in backup set 1765
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 1 Incr 625360 31-JAN-12 /oracle/oradata/system01.dbf
2 1 Incr 625360 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 1 Incr 625360 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 1 Incr 625360 31-JAN-12 /oracle/oradata/users01.dbf
Cumulative Backups:
Using this option causes backup set to back up changed blocks since the last level 0 backup, ignoring any previous level 1 backups.
[oracle@btest database]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:36:28 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 1 cumulative format='/backup/database/%d_level_1_cum_%U.bkp' tag='incr. level 1 cumulative' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device
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=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/backup/database/BTEST_level_1_cum_26n2574k_1_1.bkp tag=INCR. LEVEL 1 CUMULATIVE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-04 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12
The Block Change Tracking File:
By default, when doing incremental backup, any datafile that has changed in any way will be backed up.
RMAN provides the ability to just backup the changed database blocks. To enable block change tracking runn the
alter database enable block change. The result of this command will be creation of the block change tracking file.
SQL> alter database enable block change tracking using file '/oracle/bctf/btest11g_block_change.fil';
Database altered.
you can revert this setting by using
SQL> alter database disable block change tracking;
Database altered.
The file can hold maximum of 8 backups.
You can check, if tracking is enabled:
SQL> select status from v$block_change_tracking;
STATUS
----------
ENABLED
The Base Backup:
When doing incremental backup, first thing you need is the incremental base backup.
Incremental backups have levels addigned to them. A base backup will allways have value 0, and you must have this backup to be able to do incremental backups.
[oracle@btest ~]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:16:38 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 0 format='/backup/database/level0_%d_%U.bkp' tag='incremental level 0' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/backup/database/level0_BTEST_1un2560v_1_1.bkp tag=INCREMENTAL LEVEL 0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:47
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-00 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1731 Incr 0 423.47M DISK 00:01:37 31-JAN-12
BP Key: 1732 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 0
Piece Name: /backup/database/level0_BTEST_1un2560v_1_1.bkp
List of Datafiles in backup set 1731
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 625126 31-JAN-12 /oracle/oradata/system01.dbf
2 0 Incr 625126 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 0 Incr 625126 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 0 Incr 625126 31-JAN-12 /oracle/oradata/users01.dbf
Differential vs. cumulative Incremental Backups:
Differential backup:
This is default ype of the backup. With a differential backup, RMAN backups up all blocks that have changed since the last level 1 backup or since last level 0 backup if the backup is first incrementla backup after level 0 backup.
[oracle@btest database]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:24:45 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 1 format='incrmental1_%d_%U.bkp' tag='incremental level 1' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device
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=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/oracle/product/11.2/db_1/dbs/incrmental1_BTEST_20n256e8_1_1.bkp tag=INCREMENTAL LEVEL 1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-01 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1731 Incr 0 423.47M DISK 00:01:37 31-JAN-12
BP Key: 1732 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 0
Piece Name: /backup/database/level0_BTEST_1un2560v_1_1.bkp
List of Datafiles in backup set 1731
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 625126 31-JAN-12 /oracle/oradata/system01.dbf
2 0 Incr 625126 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 0 Incr 625126 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 0 Incr 625126 31-JAN-12 /oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1765 Incr 1 80.00K DISK 00:00:01 31-JAN-12
BP Key: 1768 Status: AVAILABLE Compressed: NO Tag: INCREMENTAL LEVEL 1
Piece Name: /oracle/product/11.2/db_1/dbs/incrmental1_BTEST_20n256e8_1_1.bkp
List of Datafiles in backup set 1765
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 1 Incr 625360 31-JAN-12 /oracle/oradata/system01.dbf
2 1 Incr 625360 31-JAN-12 /oracle/oradata/sysaux01.dbf
3 1 Incr 625360 31-JAN-12 /oracle/oradata/undotbs1.dbf
4 1 Incr 625360 31-JAN-12 /oracle/oradata/users01.dbf
Cumulative Backups:
Using this option causes backup set to back up changed blocks since the last level 0 backup, ignoring any previous level 1 backups.
[oracle@btest database]$ rman target bkpuser/testOra1 catalog rcat/testOra1@rcat
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Jan 31 13:36:28 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BTEST (DBID=4236471253)
connected to recovery catalog database
RMAN> backup incremental level 1 cumulative format='/backup/database/%d_level_1_cum_%U.bkp' tag='incr. level 1 cumulative' database;
Starting backup at 31-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device
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=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-JAN-12
channel ORA_DISK_1: finished piece 1 at 31-JAN-12
piece handle=/backup/database/BTEST_level_1_cum_26n2574k_1_1.bkp tag=INCR. LEVEL 1 CUMULATIVE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-JAN-12
Starting Control File and SPFILE Autobackup at 31-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120131-04 comment=NONE
Finished Control File and SPFILE Autobackup at 31-JAN-12