Sie sind auf Seite 1von 2

Page 1 of 2

How do I find out how many (or %) of blocks changed between RMAN backups? [ID
866166.1]

Modified 05-OCT-2009 Type SAMPLE CODE Status PUBLISHED

In this Document
Purpose
Configuring the Sample Code
Running the Sample Code
Caution
Sample Code

Applies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.5 to 11.2.0.0


Information in this document applies to any platform.

Purpose

Customers often request queries to tell how many blocks changed between backups, to better understand
database usage. You query the v$backup_datafile view as shown, to determine how effective the change tracking
data is in minimizing the incremental backup I/O (the pct_read_for_backup column). A high percentage for the
pct_read_for_backup column indicates that RMAN reads most blocks in the data file during an incremental
backup. To reduce this ratio you decrease the time between incremental backups.

Configuring the Sample Code

N/A

Running the Sample Code

Run queries in SQL*Plus

Caution

This sample code is provided for educational purposes only and not supported by Oracle Support Services. It has
been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be
sure to test it in your environment before relying on it.

Proofread this sample code before using it! Due to the differences in the way text editors, e-mail packages and
operating systems handle text formatting (spaces, tabs and carriage returns), this sample code may not be in an
executable state when you first receive it. Check over the sample code to ensure that errors of this type are
corrected.

Sample Code

The following query will show % of blocks read for BCT incremental:

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=SAMPLE... 11/09/2010
Page 2 of 2

SELECT file#,

TRUNC(AVG(datafile_blocks)) blocks_in_file,

TRUNC(AVG(blocks_read)) blocks_read,

TRUNC(AVG(blocks)) blocks_backed_up,

TRUNC(AVG(blocks_read/datafile_blocks)*100)

pct_read_for_backup

FROM v$backup_datafile

WHERE used_change_tracking='YES'

AND incremental_level > 0


GROUP BY file#;

Also, you can find out the difference in # of blocks read with a level 0, level 1 without BCT, and level 1 with BCT:

select file#,blocks_read, blocks,creation_time, used_change_tracking from


v$backup_datafile where incremental_level=0 order by 5,1;

select file#,blocks_read, blocks,creation_time, used_change_tracking from


v$backup_datafile where incremental_level=1 and used_change_tracking='NO' order by 5,1;

select file#,blocks_read, blocks,creation_time, used_change_tracking from


v$backup_datafile where incremental_level=1 and used_change_tracking='YES' order by 5,1;

Related

Products

Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition

Keywords

CONFIGURATION; DATA FILE; V$BACKUP_DATAFILE; BLOCK CHANGE TRACKING; RMAN BACKUP


RECOVERY I O; RECOVERY MANAGER

Back to top

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=SAMPLE... 11/09/2010