Block ChangeTracking 是Oracle 10g裡推出的特性。官網對Block change tracking 的定義如下:
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 會記錄data file裡每個block的update 資訊,這些tracking資訊儲存在tracking 檔案裡。 當啟動block change tracking 後,RMAN 使用trackingfile裡的資訊,隻讀取改變的block資訊,而不用在對整個data file進行掃描,進而提高了RMAN 備份的性能。
11gR2 文檔裡的說明。
<a href="http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmbckba.htm#BRADV8125">http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/rcmbckba.htm#BRADV8125</a>
<a></a>
--block change tracking file 是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 預設是禁用的,如果啟用了incrementalbackup,那麼建議開啟block change tracking。 啟用BCT後,不需要其他的維護操作。
You can only enable block change tracking at a physical standby database if a license forthe Oracle Active Data Guard option is enabled.
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.
--在備份期間,change tracking會維護已經标記為change 的block 的bitmap 資訊。Oracle 會自動管理change tracking file的大小,隻保留最近最近8次blockchange 的資訊。 超過8次, 那麼最前面的block bitmap 資訊會被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.
--第一個0級的增量備份掃描整個datafile。 随後的增量備份使用block changetracking file的資訊,隻掃描自上次備份以來被标記為change 的block。
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 includes 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.
--要考慮change tracking file 的8次限制與備份政策的關系。 如果我們在0級備份之後又進行了7次不同的增量備份,那麼這時block change tracking 就包含了8個bitmaps資訊。 如果我們在進行1級的增量備份,那麼此時的增量就不是最優的, 還會掃描整個data file。 因為我們之前0級的bitmap資訊被我們目前的bitmap 資訊覆寫掉了,這樣就沒有了參考的依據。
是以RMAN的備份政策要考慮到這個8次bitmap 的影響。
--block change tracking 檔案是針對整個資料庫,預設情況下,changetracking file 會作為Oracle managed file,在DB_CREATE_FILE_DEST指定的目錄下建立。 可以放到放到其他的目錄。 Oracle 不建議使用rawdevice 來存放change tracking file.
Note:
In an Oracle RACenvironment, the change tracking file must be located on shared storageaccessible from all nodes in the cluster.
--如果是RAC 環境,change tracking file 必須放在共享裝置上。
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 不支援對change tracking file 的備份與恢複。當資料檢測到change tracking file 無效時,就會reset changetracking file。 如果我們還原了資料庫,那麼資料庫也會reset block change tracking,并從新進行tracking。
--block change tracking file的大小和資料庫的大小及 enabledthreads of redo 的數量有關系,tracking file 的大小會根據資料庫大小的變化和變化。 和更新頻率沒有關系。
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.
--典型的,單執行個體下大約DB的1/30000的block 會把track。 如果是RAC 環境,在乘以threads。
The followingfactors that may cause the file to be larger than this estimate suggests:
--一下因素會導緻file 超過估計值:
(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.
--為了避免tracking file 占用太多的空間, 初始值是10M,然後每次增加10M,如果資料庫接近300G,那麼trackingfile 不能小于10M,如果接近600G,不能小于20M。
(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.
--每個datafile,在tracking file裡最少需要配置設定320k的空間,是以如果有大量的小data file, change tracking file 也會相對較大。
--資料庫在open 或者 mounted 狀态都可以啟用blockchange tracking.
(1)Start SQL*Plus and connect to atarget database with administrator privileges.
SQL> showparameter db_create_file_dest
NAME TYPE VALUE
----------------------------------------------- ------------------------------
db_create_file_dest string
--如果該參數沒有設定,并且資料庫是open 狀态,可可以修改該參數:
SQL> alter system setdb_create_file_dest = '/u01/bct/' scope=both sid='*';
System altered.
SQL> show parameter db_create_file_dest
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:
--也可以在建立時指定其他目錄:
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.
To disable block changetracking:
(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;
--可以使用v$block_change_tracking 視圖檢視tracking 啟動情況。
To determine whetherchange tracking is enabled:
Enter the following query in SQL*Plus(sample output included):
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
--可以使用alter database rename 語句來修改changetracking file 檔案的位置,該指令會更新控制檔案裡的資訊,指令必須在mount 下執行,會如果DB 不能shutdown,那麼可以先disable,然後指定新的位置在啟動,但是這樣會丢失以前在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.
--在OS 級别移動tracking file到新的目錄。
(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' to
'/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;
在使用RMAN 增量備份的情況下,啟動block change tracking,在做增量備份時會縮短RMAN 備份的時間, 因為不用掃描整個data file。 但是block tracking 也會帶來其他的一些開銷。 是以要根據實際情況決定是否啟用block change tracking。
轉:http://zzk.cnblogs.com/s?t=b&w=block%20changge%20tracking
文章可以轉載,必須以連結形式标明出處。
本文轉自 張沖andy 部落格園部落格,原文連結:http://www.cnblogs.com/andy6/p/5914268.html ,如需轉載請自行聯系原作者