日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Oracle 块修改跟踪 (Block Change Tracking) 说明

發(fā)布時(shí)間:2025/3/21 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle 块修改跟踪 (Block Change Tracking) 说明 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Block ChangeTracking 是Oracle 10g里推出的特性。官網(wǎng)對(duì)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 會(huì)記錄data file里每個(gè)block的update 信息,這些tracking信息保存在tracking 文件里。 當(dāng)啟動(dòng)block change tracking 后,RMAN 使用trackingfile里的信息,只讀取改變的block信息,而不用在對(duì)整個(gè)data file進(jìn)行掃描,從而提高了RMAN 備份的性能。

??????

11gR2 文檔里的說明。

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

?

一.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 是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 默認(rèn)是禁用的,如果啟用了incrementalbackup,那么建議開啟block change tracking。 啟用BCT后,不需要其他的維護(hù)操作。

?

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.

--在備份期間,change tracking會(huì)維護(hù)已經(jīng)標(biāo)記為change 的block 的bitmap 信息。Oracle 會(huì)自動(dòng)管理change tracking file的大小,只保留最近最近8次blockchange 的信息。 超過8次, 那么最前面的block bitmap 信息會(huì)被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.

--第一個(gè)0級(jí)的增量備份掃描整個(gè)datafile。 隨后的增量備份使用block changetracking file的信息,只掃描自上次備份以來被標(biāo)記為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次限制與備份策略的關(guān)系。 如果我們?cè)?級(jí)備份之后又進(jìn)行了7次不同的增量備份,那么這時(shí)block change tracking 就包含了8個(gè)bitmaps信息。 如果我們?cè)谶M(jìn)行1級(jí)的增量備份,那么此時(shí)的增量就不是最優(yōu)的, 還會(huì)掃描整個(gè)data file。 因?yàn)槲覀冎?級(jí)的bitmap信息被我們當(dāng)前的bitmap 信息覆蓋掉了,這樣就沒有了參考的依據(jù)。

? 所以RMAN的備份策略要考慮到這個(gè)8次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.

?????? --block change tracking 文件是針對(duì)整個(gè)數(shù)據(jù)庫,默認(rèn)情況下,changetracking file 會(huì)作為Oracle managed file,在DB_CREATE_FILE_DEST指定的目錄下創(chuàng)建。 可以放到放到其他的目錄。 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 環(huán)境,change tracking file 必須放在共享設(shè)備上。

?

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 不支持對(duì)change tracking file 的備份與恢復(fù)。當(dāng)數(shù)據(jù)檢測(cè)到change tracking file 無效時(shí),就會(huì)reset changetracking file。 如果我們還原了數(shù)據(jù)庫,那么數(shù)據(jù)庫也會(huì)reset block change tracking,并從新進(jìn)行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.

--block change tracking file的大小和數(shù)據(jù)庫的大小及 enabledthreads of redo 的數(shù)量有關(guān)系,tracking file 的大小會(huì)根據(jù)數(shù)據(jù)庫大小的變化和變化。 和更新頻率沒有關(guān)系。

?

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.

--典型的,單實(shí)例下大約DB的1/30000的block 會(huì)把track。 如果是RAC 環(huán)境,在乘以threads。

?

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

--一下因素會(huì)導(dǎo)致file 超過估計(jì)值:

(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,如果數(shù)據(jù)庫接近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.

???????--每個(gè)datafile,在tracking file里最少需要分配320k的空間,所以如果有大量的小data file, change tracking file 也會(huì)相對(duì)較大。

?

?

二.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.

--數(shù)據(jù)庫在open 或者 mounted 狀態(tài)都可以啟用blockchange tracking.

?

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:

--如果該參數(shù)沒有設(shè)置,并且數(shù)據(jù)庫是open 狀態(tài),可可以修改該參數(shù):

?

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:

--也可以在創(chuàng)建時(shí)指定其他目錄:

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.

--可以使用v$block_change_tracking 視圖查看tracking 啟動(dòng)情況。

?

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

?

?

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.

--可以使用alter database rename 語句來修改changetracking file 文件的位置,該命令會(huì)更新控制文件里的信息,命令必須在mount 下執(zhí)行,會(huì)如果DB 不能shutdown,那么可以先disable,然后指定新的位置在啟動(dòng),但是這樣會(huì)丟失以前在tracking file里的數(shù)據(jù)。

?

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.

???????--在OS 級(jí)別移動(dòng)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;

?

?

小結(jié):

?????? 在使用RMAN 增量備份的情況下,啟動(dòng)block change tracking,在做增量備份時(shí)會(huì)縮短RMAN 備份的時(shí)間, 因?yàn)椴挥脪呙枵麄€(gè)data file。 但是block tracking 也會(huì)帶來其他的一些開銷。 所以要根據(jù)實(shí)際情況決定是否啟用block change tracking。

?轉(zhuǎn):http://zzk.cnblogs.com/s?t=b&w=block%20changge%20tracking

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的Oracle 块修改跟踪 (Block Change Tracking) 说明的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。