Block Change Tracking setup and overhead
For everything you ever wanted to know about Block Change Tracking (BCT) and were afraid to ask, check out the awesome presentation from Alex Gorbechev
Here are some quick notes, mainly for my own reference, on BCT. BCT can be enabled while the database is up. Turning on BCT requires giving a tracking file location which can also be done while the database is up. Changing the BCT tracking file location after it has already been set requires bouncing the database. Finally, with BCT enabled we can look at the upper bound size for a database incremental backup. The actual size could be the same size as the upper bound or as small as 1/4 of the upper bound size as BCT only tracks groups of 4 blocks at a time for changes.
select status from v$block_change_tracking; --> DISABLED alter database enable block change tracking; --> ERROR at line 1: --> ORA-19773: must specify change tracking file name alter system set db_create_file_dest='/oradata/orcl/' scope=both; alter database enable block change tracking; select * from v$block_change_tracking; --> STATUS FILENAME BYTES --> ---------- -------------------------------------------------------- ---------- --> ENABLED /oradata/orcl/ORCL/changetracking/o1_mf_6ybbfdjv_.chg 11599872
-- from Alex Gorbechev ( I believe the 32 refers to 4 *8K blocks size so if your block size is different you'll have to change this ) SELECT (count(distinct b.fno||' '||bno) * 32)/1024 MB FROM x$krcbit b, (SELECT MIN(ver) min_ver, fno FROM (SELECT curr_vercnt ver, curr_highscn high, curr_lowscn low, fno FROM x$krcfde UNION ALL SELECT vercnt ver, high, low, fno FROM x$krcfbh ) WHERE (SELECT MAX(bd.checkpoint_change#) FROM v$backup_datafile bd WHERE bd.incremental_level <= 1) between low and high GROUP BY fno ) sub WHERE b.fno = sub.fno AND b.vercnt >= sub.min_ver / --> 960
Alex’s original query:
SELECT count(distinct bno) * 32 FROM x$krcbit b WHERE b.fno = 7 AND b.vercnt >= (SELECT MIN(ver) FROM (SELECT curr_vercnt ver, curr_highscn high, curr_lowscn low FROM x$krcfde WHERE fno = 7 UNION ALL SELECT vercnt ver, high, low FROM x$krcfbh WHERE fno = 7) WHERE (SELECT MAX(bd.checkpoint_change#) FROM v$backup_datafile bd WHERE bd.file# = 7 AND bd.incremental_level <= 1) between low and high);
Running incremental backups for a while it’s possible to collect historical ration between number of blocks read and number and size of the backup. This would as well account for compression.
Note that the query above is just an example and it has the following limitations:
- Chunk size is hard coded to 32K (could it vary on different platforms?)
- First block overhead is not accounted for
- No special case when required bitmap version is not available (purged) and the whole datafile must be read
- No case with backup optimization for level 0 (v$datafile_backup.used_optimization)
- No case when no data blocks in datafile is changed (no bitmap version but the first block must be backed up anyway)
- Only single datafile
- No accounting for unavailable base incremental backup
I’ve been wondering what kind of impact BCT has on databases and had the opportunity to talk to Vinay Srihari.*
Kyle: Vinay, what kind of impact does BCT have on the performance of an Oracle database?
Vinay: After it was introduced in 10gR1, BCT was put through TPCC-style OLTP benchmarks internally at Oracle. There was no measurable performance overhead on OLTP. However, it took a release to stabilize the feature and fix several fundamental bugs: 10.2.0.4 is all right, not so sure about 10.1.
There was some concern because BCT updates to the in-memory bitmap are done in the critical redo generation path by every foreground. The BCT logging turned out to be negligible in terms of CPU (instruction count) because redo generation was an order of magnitude more work. The main issue was bugs that caused the BCT background (CTWR) to get stuck or slow down, to the point where no more in-memory bitmap buffers were available and impacted foreground activity.
BCT for the Physical Standby was added in 11.1, as part of the Active Data Guard licensed option. There were some critical bugs with this feature that were fully resolved only in 11.2, although patches are available for 220.127.116.11.
I have seen BCT deployed successfully at customers with > 20MB/s (50 GB/hr), Oracle’s internal testing was ~50MB/s.
Bottom line, stability of the feature and not performance is the concern. On the primary: 10.2.0.4, 18.104.22.168, 11.2 are solid. On the standby: 22.214.171.124 (+ BCT patches), 126.96.36.199 (+ BCT patches), 188.8.131.52 are best.