RMAN-BLOCK Change Tracking

The block change tracking feature for incremental backups improves backup

performance by recording changed blocks for each datafile.

About Block Change Tracking

If block change tracking is enabled on a primary or standby database, then RMAN

uses a block change tracking file to identify changed blocks for incremental backups.

By reading this small bitmap file to determine which blocks changed, RMAN avoids

having to scan every block in the datafile that it is backing up.

Block change tracking is disabled by default. Nevertheless, the benefits of avoiding full datafile scans during backup are considerable, especially if only a small percentage of data blocks are changed between backups. If your backup strategy involves incremental backups, then block change tracking is recommended. Block change

tracking in no way changes the commands used to perform incremental backups.

The change tracking file requires no maintenance after initial configuration.

You can only enable block change tracking at a physical standby database if a license

for the Oracle Active Data Guard option is enabled.

Space Management in the Block Change Tracking File The change tracking file maintains

bitmaps that mark changes in the datafiles between backups. The database performs a

bitmap switch before each backup. Oracle Database automatically manages space in

the change tracking file to retain block change data that covers the 8 most recent

backups. After the maximum of 8 bitmaps is reached, the oldest bitmap is overwritten

by the bitmap that tracks the current changes.

The first level 0 incremental backup scans the entire datafile. Subsequent incremental backups use the block change tracking file to scan only the blocks that have been marked as changed since the last backup. An incremental backup can be optimized only when it is based on a parent backup that was made after the start of the oldest bitmap in the block change tracking file.

Consider the 8-bitmap limit when developing your incremental backup strategy. For

example, if you make a level 0 database backup followed by 7 differential incremental

backups, then the block change tracking file now includes 8 bitmaps. If you then make

a cumulative level 1 incremental backup, then RMAN cannot optimize the backup

because the bitmap corresponding to the parent level 0 backup is overwritten with the

bitmap that tracks the current changes.

Location of the Block Change Tracking File One block change tracking file is created for the whole database. By default, the change tracking file is created as an Oracle managed file in the destination specified by the DB_CREATE_FILE_DEST initialization

parameter. You can also place the change tracking file in any location you choose, by

specifying its name when enabling block change tracking. Oracle recommends against

using a raw device (that is, a disk without a file system) as a change tracking file.

RMAN does not support backup and recovery of the change tracking file. The

database resets the change tracking file when it determines that the change tracking

file is invalid. If you restore and recover the whole database or a subset, then the

database resets the block change tracking file and starts tracking changes again. After you make a level 0 incremental backup, the next incremental backup is able to use change tracking data.

Size of the Block Change Tracking File The size of the block change tracking file is

proportional to the size of the database and the number of enabled threads of redo.

The size of the block change tracking file can increase and decrease as the database

changes. The size is not related to the frequency of updates to the database.

Typically, the space required for block change tracking for a single instance is

approximately 1/30,000 the size of the data blocks to be tracked. For an Oracle RAC

environment, it is 1/30,000 of the size of the database, times the number of enabled

threads.

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

To avoid the overhead of allocating space as your database grows, the block

change tracking file size starts at 10 MB. New space is allocated in 10 MB

increments. Thus, for any database up to approximately 300 GB, the file size is no

smaller than 10 MB, for up to approximately 600 GB the file size is no smaller than

20 MB, and so on.

For each datafile, a minimum of 320 KB of space is allocated in the block change

tracking file, regardless of the size of the datafile. Thus, if you have a large number of relatively small datafiles, the change tracking file is larger than for databases with a smaller number of larger datafiles containing the same data.

Enabling and Disabling Block Change Tracking

You can enable block change tracking when the database is either open or mounted.

This section assumes that you intend to create the block change tracking file as an

Oracle Managed File in the database area, which is where the database maintains

active database files such as datafiles, control files, and online redo log files.

To enable block change tracking:

1. Start SQL*Plus and connect to a target database with administrator privileges.

2. Make sure that the DB_CREATE_FILE_DEST initialization parameter is set.

SHOW PARAMETER DB_CREATE_FILE_DEST

If the parameter is not set, and if the database is open, then you can set the

parameter with the following form of the ALTER SYSTEM statement:

ALTER SYSTEM SET DB_CREATE_FILE_DEST = ‘/disk1/bct/’ SCOPE=BOTH SID=’*';

3. Enable block change tracking.

Execute the following ALTER DATABASE statement:

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;

You can also create the change tracking file in a location you choose yourself by

using the following form of SQL statement:

ALTER DATABASE ENABLE BLOCK CHANGE TRACKING

USING FILE ‘/mydir/rman_change_track.f’ REUSE;

The REUSE option tells Oracle Database to overwrite any existing block change

tracking file with the specified name.

Disabling Block Change Tracking

This section assumes that the block change tracking 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 change tracking:

1. Start SQL*Plus and connect to a target database with administrator privileges.

2. Ensure that the target database is mounted or open.

3. Disable block change tracking.

Execute the following ALTER DATABASE statement:

ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

Checking Whether Change Tracking is Enabled

You can query the V$BLOCK_CHANGE_TRACKING view to determine whether change

tracking is enabled, and if it is, the filename of the block change tracking file.

To determine whether change tracking is enabled:

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

COL STATUS FORMAT A8

COL FILENAME FORMAT A60

SELECT STATUS, FILENAME

FROM V$BLOCK_CHANGE_TRACKING;

STATUS FILENAME

——– ————————————————————

ENABLED /disk1/bct/RDBMS/changetracking/o1_mf_2f71np5j_.chg

Changing the Location of the Block Change Tracking File

To move the change tracking file, use the ALTER DATABASE RENAME FILE

statement. The database must be mounted. The statement updates the control file to

refer to the new location and preserves the 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 lose the contents of the existing block change tracking file.

To change the location of the change tracking file:

1. Start SQL*Plus and connect to a target database.

2. If necessary, determine the current name of the change tracking file:

SQL> SELECT FILENAME FROM V$BLOCK_CHANGE_TRACKING;

3. If possible, shut down the database.

For example:

SQL> SHUTDOWN IMMEDIATE

If you shut down the database, then skip to the next step. If you choose not to shut

down the database, then execute the following SQL statements and skip all

remaining steps:

SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;

SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE ‘new_location’;

In this case you lose the contents of the block change tracking file. Until the next

time you complete a level 0 incremental backup, RMAN must scan the entire file.

4. Using host operating system commands, move the change tracking file to its new

location.

5. Mount the database and move the change tracking file to a location that has more

space. For example:

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;

时间: 2024-10-02 20:08:11

RMAN-BLOCK Change Tracking的相关文章

Oracle增量备份和快速备份(块改变跟踪Block Change Tracking)

Oracle增量备份和快速备份(块改变跟踪Block Change Tracking) 下面小麦苗给出全库备份的脚本: 点击(此处)折叠或打开 [oracle@rhel6lhr ~]$ crontab -l 2 12 * * 1 /home/oracle/lhr/rman/rman_backup_full.sh [oracle@rhel6lhr ~]$ more /home/oracle/lhr/rman/rman_backup_full.sh export ORACLE_SID=orclasm

SQL Server 2008:CDC和Change Tracking

经常会有需求记录用户表中由DML操作(Insert/Updae/Delete)引起的数据变化,在SQL Server 2008 以前的版本中,要实现这样的功能只能通过Trigger或者数据比对(例如SCD处理),而且必须针对每个用户 表开发.SQL Server 2008中新增了两种记录数据变化的功能,本文就Change Data Capture(CDC)和 Change Tracking的特性做简要对比. Change Data Capture CDC通过对事务日志的异步读取,记录DML操作的

SQL Server审计功能入门:更改跟踪(Change Tracking)

原文:SQL Server审计功能入门:更改跟踪(Change Tracking) 介绍        更改跟踪是一种轻量型解决方案,它为应用程序提供了一种有效的更改跟踪机制.常规的,自定义变更跟踪和读取跟踪数据,会使用触发器,存储过程和记录变更的用户表等, 还需要保证访问一致和相关清理工作. 使用CT会减少额外工作量和保证访问一致性. 启用CT的表上必须得有主键,所有版本适用.为了保证更改信息的有效性,官方建议结合快照隔离使用. CT只能提供:                     哪些行/

ADO.NET Entity Framework深入分析, Part 7 – Change Tracking

ObjectStateManager – 对象状态管理器 我们已经知道如何增加.更新和删除实体记录,并将更改数据库记录.Entity Framework 通过Object Context 控制的ObjectStateManager 对象来跟踪变更,ObjectStateManager 将跟踪所有对实体对象的变更,在调用SaveChanges() 方法时,执行相应的T-SQL脚本. ObjectStateManager比LINQ to SQL中DataContext 的变更跟踪功能更先进.下面,我

Oracle RMAN备份(五)增量备份

九. 增量备份 通过增量备份,RMAN 允许用户只备份上次增量备份以来被修改过的数据块. 增量备份具有以下有点: (1)更少的使用磁盘或磁带 (2)降低网络宽带要求 (3)节约备份时间 可以在联机或脱机模式,Archivelog 模式或者noarchivelog 模式中执行增量备份. 一旦选择了增量备份策略,就会在效益方面的问题. 如果显着减少了整个备份操作的时间,在恢复操作方面就会投入更多的时间. 这是因为如果使用增量备份策略,Oracle 就需要使用更多的备份集来恢复数据库,恢复所需要的时间

RMAN之RMAN增量备份

我们可以用RMAN进行数据库.表空间和数据文件的增量备份. 如果数据库运行在归档模式,在数据库OPEN状态我们可以进行增量备份:如果数据库处于非归档方式,在数据库CLOSE状态我们也可以进行增量备份.增量备份只备份上次备份以来变化过的数据块. 每个数据块都包含一个system change number (SCN),记录着该数据块的最后改变.在进行增量备份的时候,RMAN将没给数据块的SCN和父级增量备份的CHECKPOINT SCN进行比较,如果该数据块的SCN大于等于父级的CHECKPOIN

RMAN 系列(四) ---- RMAN 备份(引用)

原文转自:http://blog.csdn.net/tianlesoftware/article/details/5687938 一. RMAN 备份的一些优点 1. RMAN 会检测和报告损坏的数据块. 2. 不需要将表空间置入热备份模式,RMAN 就可以连接备份数据库. 热备份期间会额外的生成重做日志. 3. RMAN 会自动跟踪新的数据文件和表空间,这样就不再需要在脚本中添加新的表空间和数据文件. 4. RMAN 只备份使用过的数据库(直至最高使用标记(High wate mark)),这

RMAN 备份详解

--====================== -- RMAN 备份详解 --======================   一.数据库备份与RMAN备份的概念         1.数据库完全备份:按归档模式分为归档和非归档         归档模式             打开状态,属于非一致性备份             关闭状态,可以分为一致性和非一致性         非归档模式             打开状态,非一致性备份无效             关闭状态,一致性备份,非一致

备份恢复5——rman增量累积备份+catalog和nocatalog

一.Nocatalog  Nocatalog方式 就是用control file作为catalog,每一次备份都要往控制文件里面写好多备份信息,控制文件里面会有越来越多的备份信息.因 此,当使用rman nocatalog方式备份时,备份controlfile是非常重要的.   由于nocatalog时利用controlfile存放备份信息,建议将Oracle参数文件中的CONTROL_FILE_RECORD_KEEP_TIME值加大(缺省为7天), 参数在$ORACLE_HOME/dbs/in