Description of block change tracking in Oracle

Source: Internet
Author: User

 

Block changetracking is a feature launched in Oracle 10 Gb. The official website defines block change tracking as follows:

Adatabase option that causes Oracle to track data file Blocks Affected by eachdatabase update. the tracking information is stored in a block change trackingfile. when block change tracking is enabled, RMAN uses the record of changedblocks from the change tracking file to improve Incremental Backup performanceby only reading those blocks known to have changed, instead of reading datafiles in their entirety.

-- Block change tracking records the update information of each block in the data file. The tracking information is stored in the tracking file. When block change tracking is enabled, RMAN uses the information in trackingfile to read only the changed block information, instead of scanning the entire data file, which improves the performance of RMAN backup.

Description in 11gr2 document.

Http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmbckba.htm#BRADV8125

 

1. About Block change tracking

If block changetracking is enabled on a primary or standby database, then RMAN uses a blockchange tracking file to identify changed blocks for incrementalbackups. by reading this small bitmap file to determine which blocks changed, RMAN avoids having to scan every block in the data file that it is backing up.

-- Block change tracking file is a bitmap file.

 

Block changetracking is disabled by default. nevertheless, the benefits of avoiding fulldata file scans during Backup are considerable, especially if only a smallpercentage of data blocks are changed between backups. if your backup strategyinvolves incremental backups, then block change tracking is recommended. blockchange tracking does not change the commands used to perform incrementalbackups. the change tracking file requires no maintenance after initialconfiguration.

-- Block change tracking is disabled by default. If incrementalbackup is enabled, we recommend that you enable block change tracking. After enabling BCT, no other maintenance operations are required.

 

You can only enable block change tracking at a physical standby database if a license forthe Oracle Active Data guard option is enabled.

 

1.1 spacemanagement in the block change tracking File

The change tracking file maintains bitmaps that Mark changes in the datafiles betweenbackups. the database performs a bitmap switch before each backup. oracledatabase automatically manages space in the change tracking file to retainblock change data that covers the eight most recent backups. after the maximumof eight bitmaps is reached, the oldest bitmap is overwritten by the bitmapthat tracks the current changes.

-- During backup, change tracking maintains the bitmap information of the block marked as change. Oracle automatically manages the size of the change tracking file and retains only the information of the last eight blockchanges. If it exceeds 8 times, the previous block bitmap information will be overwritten by current change.

 

The first level0 Incremental Backup scans the entire data file. subsequent incremental backupsuse the block change tracking file to scan only the blocks that have beenmarked as changed since the last backup. an incremental backup can be optimizedonly when it is based on a parent backup that was made after the start of theoldest bitmap in the block change tracking file.

-- The first zero-level Incremental Backup scans the entire datafile. The subsequent Incremental Backup uses the block changetracking file information and only scans the block marked as change since the last backup.

 

Consider theeight-bitmap limit when developing your Incremental backup strategy. forexample, if you make a level 0 Database Backup followed by seven differentialincremental backups, then the block change tracking file now has des eightbitmaps. if you then make a cumulative level 1 Incremental backup, then rmancannot optimize the backup, because the bitmap corresponding to the parentlevel 0 backup is overwritten with the bitmap that tracks the current changes.

-- Consider the relationship between the eight limits of change tracking file and the backup policy. If we perform another 7 different incremental backups after the backup at level 0, block change tracking contains 8 bitmaps. If we are performing Incremental backup at level 1, the Incremental backup is not optimal at this time, and the entire data file will be scanned. Because our previous bitmap information of level 0 is overwritten by our current bitmap information, there is no reference.

Therefore, the RMAN backup policy should take into account the impact of this 8-time bitmap.

 

1.2 location of the block change tracking File

One block changetracking file is created for the whole database. by default, the changetracking file is created as an oraclemanaged file in the destination specified by thedb_create_file_dest initializationparameter. you can also place the change tracking file in any location that youchoose, by specifying its name when enabling block change tracking. oraclerecommends against using a raw device (that is, a disk without a file system) as a change tracking file.

-- The block change tracking file is for the entire database. By default, changetracking file is used as the Oracle managed file and is created under the directory specified by db_create_file_dest. You can put it in another directory. Rawdevice is not recommended for Oracle to store change tracking file.

 

Note:

In an oracle racenvironment, the change tracking file must be located on shared storageaccessible from all nodes in the cluster.

-- In the RAC environment, change tracking file must be placed on the shared device.

 

RMAN does notsupport backup and recovery of the change tracking file. the database resetsthe change tracking file when it determines that the change tracking file isinvalid. if you restore and recover the whole database or a subset, then thedatabase resets the block change tracking file and starts tracking changesagain. after you make a level 0 Incremental backup, the next incremental backupcan use change tracking data.

-- RMAN does not support backup and recovery of change tracking file. When the data detects that the change tracking file is invalid, the system will reset the changetracking file. If we restore the database, the database will also reset block change tracking and perform new tracking.

 

1.3 size of the block change tracking File

The size of the block change tracking file is proportional to thesize of the database and the number of enabled threads of redo. the size of theblock change tracking file can increase and decrease as the database changes. the size is not related to the frequency of updates to the database.

-- The size of the block change tracking file is related to the size of the database and the number of enabledthreads of redo. The size of the tracking file varies depending on the size of the database. It is irrelevant to the update frequency.

 

Typically, thespace required for block change tracking for a single instance is approximately1/30,000 the size of the data blocks to be tracked. for an oracle racenvironment, It is 1/30, 000 of the size of the database, times the number ofenabled threads.

-- In typical cases, track is applied to approximately 1/30000 of DB blocks under a single instance. In the RAC environment, multiply by threads.

 

The followingfactors that may cause the file to be larger than this estimate suggests:

-- The following cause the file to exceed the estimated value:

(1) To avoid theoverhead of allocating space as your database grows, the block change trackingfile size starts at 10 megabytes. new Space is allocated in 10 MB increments. thus, for any database up to approximately 300 gigabytes, the file size is nosmaller than 10 MB, for up to approximately 600 gigabytes the file size is nosmaller than 20 megabytes, and so on.

-- To prevent tracking file from occupying too much space, the initial value is 10 m, and then 10 m is added each time. If the database is close to 300g, the trackingfile cannot be less than 10 m. If it is close to 600g, it cannot be less than 20 mb.

 

(2) For each datafile, a minimum of 320 kilobytes of space is allocated in the block changetracking file, regardless of the size of the data file. thus, if you have aLarge number of relatively small data files, the change tracking file is largerthan for databases with a smaller number of larger data files containing thesame data.

-- Each datafile must be allocated at least K space in the tracking file. Therefore, if a large number of small data files exist, the change tracking file will also be relatively large.

 

 

2. enablingand disabling block change tracking

You can enable block change tracking whenthe database is either open or mounted. this section assumes that you intend tocreate the block change tracking file as an oracle managed file in the databasearea, which is where the database maintains active database files such asdata files, control files, and online redo log files. see "overviewof the fast recovery area" to learn about the database area and fastrecovery area.

-- Blockchange tracking can be enabled for databases in the open or mounted status.

 

2.1 To enable block change tracking:

(1) start SQL * Plus and connect to atarget database with administrator privileges.

(2) ensure thatthe db_create_file_dest initialization parameter is set.

 

SQL> showparameter db_create_file_dest

Name type value

-----------------------------------------------------------------------------

Db_create_file_dest string

 

If the parameteris not set, and if the database is open, then you can set the parameter withthe following form of the altersystem statement:

-- If this parameter is not set and the database is open, you can modify this parameter:

 

SQL> alter system setdb_create_file_dest = '/u01/BCT/' scope = both SID = '*';

System altered.

 

SQL> show parameter db_create_file_dest

Name type value

-----------------------------------------------------------------------------

Db_create_file_dest string/u01/BCT/

SQL>

 

(3) Enable block change tracking.

Execute the following alter database statement:

SQL> alter database enable block changetracking;

Database altered.

 

You can alsocreate the change tracking file in a location that you choose yourself by usingthe following form of SQL statement:

-- You can also specify other directories during creation:

SQL> alter database enable block change tracking using File '/mydir/rman_change_track.f' reuse;

The reuse optiontells Oracle database to overwrite any existing block change tracking file withthe specified name.

 

2.2 disablingblock change tracking

This section assumes that the block changetracking feature is currently enabled. When you disable block change tracking, the database removes the block change tracking file from the operating system.

 

To disable block changetracking:

(1) start SQL * Plus and connect to atarget database with administrator privileges.

(2) ensure that the target database ismounted or open.

(3) Disable block change tracking.

Execute thefollowing alter database statement:

SQL> alter database disable block change tracking;

 

2.3 checking whether change tracking is enabled

You can query the V $ block_change_tracking viewto determine whether change tracking is enabled, and if it is, the file name ofthe block change tracking file.

-- You can use the V $ block_change_tracking view to view the startup status of tracking.

 

To determine whetherchange tracking is Enabled:

Enter the following query in SQL * Plus (sample output sorted DED ):

 

SQL> Col status format A8

SQL> Col filename format A60

SQL> select status, filename fromv $ block_change_tracking;

Status filename

--------------------------------------------------------------------

Enabled/u01/BCT/xezf/changetracking/o1_mf_7dnc623t _. chg

 

 

2.4 changingthe location of the block change tracking File

To move the change tracking file, use the alterdatabase rename file statement. the database must be mounted. thestatement updates the control file to refer to the new location and preservesthe contents of the change tracking file. if you cannot shut down the database, then you can disable and enable block change tracking. in this case, you losethe contents of the existing block change tracking file.

-- You can use the alter database rename statement to modify the location of the changetracking file. This command updates the information in the control file. The command must be executed under Mount. If the DB cannot be shutdown, you can first disable and then specify a new position to start, but this will lose the data in the previous tracking file.

 

To change the location of the change tracking file:

(1) start SQL * Plus and connect to atarget database.

(2) If necessary, determine the currentname of the change tracking file:

SQL> select filename from V $ block_change_tracking;

(3) If possible, shut down thedatabase. For example:

SQL> shutdown immediate

 

If you shut downthe database, then skip to the next step. If you choose not to shut down thedatabase, then execute the following SQL statements and skip all remainingsteps:

SQL> alter database disable block changetracking;

SQL> alter database enable block changetracking using file 'new _ location ';

 

In this case youlose the contents of the block change tracking file. Until the next time youcomplete a level 0 Incremental backup, rman must scan the entire file.

 

(4) using host operating systemcommands, move the change tracking file to its new location.

-- Move the tracking file to the new directory at the OS level.

(5) mount the database and move thechange tracking file to a location that has more space. For example:

SQL> alter database rename File

'/Disk1/BCT/rdbms/changetracking/o1_mf_2f71np5j _. chg'

'/Disk2/BCT/rdbms/changetracking/o1_mf_2f71np5j _. chg ';

 

This statement changes the location of the change tracking file while preserving its contents.

 

(6) Open the database:

SQL> alter database open;

 

 

Summary:

When RMAN Incremental backup is used, start block change tracking to shorten the RMAN backup time because the entire data file does not need to be scanned. However, block tracking also brings about other overhead. Therefore, you must determine whether to enable block change tracking based on the actual situation.

 

 

 

 

 

 

Bytes -------------------------------------------------------------------------------------------------------

All rights reserved. reprinted articles are allowed, but source addresses must be indicated by links. Otherwise, the documents will be held legally responsible!

Blog: http://blog.csdn.net/tianlesoftware

WEAVER: http://weibo.com/tianlesoftware

Email: tianlesoftware@gmail.com

Skype: tianlesoftware

 

------- Add a group to describe the relationship between Oracle tablespace and data files in the remarks section. Otherwise, reject the application ----

Dba1 group: 62697716 (full); dba2 group: 62697977 (full) dba3 group: 62697850 (full)

Super DBA group: 63306533 (full); dba4 group: 83829929 (full) dba5 group: 142216823 (full)

Dba6 group: 158654907 (full) dba7 group: 69087192 (full) dba8 group: 172855474

DBA super group 2: 151508914 dba9 group: 102954821 chat group: 40132017 (full)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.