在rman增量备份中,有差异增量和累积增量的概念
星期 | 差异增量 | 累积增量 |
星期天 | 0级 | 0级 |
星期一 | 2级 | 2级 |
星期二 | 2级 | 2级 |
星期三 | 1级 | 1级 |
星期四 | 2级 | 2级 |
星期五 | 2级 | 2级 |
星期六 | 2级 | 2级 |
星期天 | 0级 | 0级 |
|
|
|
Block ChangeTracking 是Oracle 10g里推出的特性。官网对Block change tracking 的定义如下:
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
--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.
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会维护已经标记为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 信息覆盖掉了,这样就没有了参考的依据。
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
Note:
In an Oracle RACenvironment, the change tracking file must be located on shared storageaccessible from all nodes in the cluster.
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。
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的大小和数据库的大小及 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.
二.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
--数据库在open 或者 mounted 状态都可以启用blockchange tracking.
2.1 To enable block change tracking:
(1)Start SQL*Plus and connect to atarget database with administrator privileges.
(2) Ensure
SQL> showparameter db_create_file_dest
NAME
----------------------------------------------- ------------------------------
db_create_file_dest
If the parameteris not set, and if the database is open, then you can set the parameter withthe following form of the
--如果该参数没有设置,并且数据库是open 状态,可可以修改该参数:
SQL> alter system setdb_create_file_dest = '/u01/bct/' scope=both sid='*';
System altered.
SQL> show parameter db_create_file_dest
NAME
----------------------------------------------- ------------------------------
db_create_file_dest
SQL>
(3) Enable block change tracking.
Execute the following
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
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
SQL>alter database disable block change tracking;
2.3 Checking Whether Change Tracking is Enabled
You can query
--可以使用v$block_change_tracking 视图查看tracking 启动情况。
To determine whetherchange tracking is enabled:
Enter the following query in SQL*Plus(sample output included):
SQL> col status
SQL> col filename format a60
SQL> select status, filename fromv$block_change_tracking;
STATUS
--------------------------------------------------------------------
ENABLED
2.4 Changingthe Location of the Block Change Tracking File
To move the change tracking file, use the
-- 可以使用alter database rename 语句来修改changetracking file 文件的位置,该命令会更新控制文件里的信息,命令必须在mount 下执行,会如果DB 不能shutdown,那么可以先disable,然后指定新的位置在启动,但是这样会丢失以前在tracking file里的数据。
To change the location of the change tracking file:
(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.
(5)Mount the database and move thechange tracking file to a location that has more space. For example:
SQL>alter database rename file
This statement changes the location of the change tracking file while preserving its contents.
(6)Open the database:
SQL> alter database open;
小结: