run {
recover copy of database with tag 'incr_update';
backup incremental level 1 for recover of copy with tag 'incr_update'
database;
}
The RECOVER COPY command updates each datafile image copy with the previous level 1 incremental. If it doesn't find an image copy to update or level 1 to apply, the command generates a message but doesn't generate an error.
The BACKUP command creates level 1 incremental backup. If level 0 image copy doesn't exist, it creates one with specified tag.
The first run of the script creates level 0 image copy backup. The second run of the script creates level 1 differential incremental backup. On the 3rd run and all subsequent runs, there is a image copy updated with previous level 1 incremental and a new level 1 incremental. If the above script is scheduled to run each night, the following files will be available for a point-in-time recovery.
1. An image copy of database one day earlier.
2. An incremental backup of last night.
3. Archive logs to reach the desired SCN.
To improve incremental backup performance, enable change tracking to record changed blocks in each datafile in a file.
To enable change tracking. This will create the change tracking file in DB_CREATE_FILE_DEST.
SQL> alter database enable block change tracking;
To create the change tracking file in specific location.
SQL> alter database enable block change tracking using file '/u03/oradata/bct.dbf' reuse
To disable change tracking.
SQL> alter database disable block change tracking;
To determine whether block change tracking is used.
SQL> select completion_time, file#, datafile_blocks, block_read, blocks, used_change_tracking from v$backup_datafile order by 1,2;