RMAN compression
RMAN
Compression:
Various
Compression Types:
There
are 3 three types of compression by default:
1. Null compression
·
Usages
only till Oracle version 10.1 by default
·
RMAN
skips the block that have never been used when backing up datafiles into backup
sets.
·
E.g.
let’s tablespace having once datafile of size 100MB and out of 100 MB only 50
is used. Then RMAN will backup only 50 MB.
2. Unused block compression
·
Oracle
version 10.2 forward, uses ‘Null’ and ‘unused block’ compression.
·
More
compact backups of datafiles by skipping datafile blocks that are not currently
used to store data.
·
In
previous release, RMAN only supported NULL compression, which skipped space in
datafiles that had never been allocated.
Example
§
User01
– 100MB out of 100MB, 50 MB is used by user tables.
Then
user dropped a table belonging to that tablespace which was of 25MB, with the
new unused block compression on 25MB of the files is backed up.
§
In
this case if null compression is used then it would have backed up 50MB because
null compression will consider the blocks that are formatted/ever used.
·
Unused
block compression is done, if all the conditions met:
ü
The
compatible initialization parameter is set to 10.2
ü
There
are currently no restore points defined for the database
ü
The
datafile is locally managed
ü
The
datafile is being backed up to a backup set as part of a full backup or a
level 0 incremental backup
ü
The
backup set is being created on DISK or backup is done to tape using “OSB”
(oracle secure backup)
Note:
o
Unused
block compression is NOT used if backup done to tape using a THIRD PARTY BACKUP
SOFTWARE
o
Unused
block compression is ONLY used in Enterprise Edition.
3. Binary compression
Binary compression can be done by
specifying “AS COMPRESSED” clause in
backup command, this compression is called as binary compression.
This binary compression algorithm
can greatly reduce the space required for disk backup storage. It is typically
2x to 4x and greater for text-intensive database.
The command to take the compressed backup:
RMAN> backup as compressed backupset database;
Ø
There
is some CPU overhead associated with compressing backup sets. If the database being
backup up is running at or near its maximum load, may find the overhead from
using AS COMPRESSED BACKUPSET unacceptable. In most other circumstances,
compressing backupsets saves enough disk space to be worth the CPU overhead.
Ø
There
is no special command to restore database from compressed backupsets, the
restore command will be same as with uncompressed backups.
Ø
The
restore from the compresses backupset will take more time than uncompressed
backupsets.
Ø
In
addition to existing binary compression of backup in ORACLE 10G, RMAN 11G
executable offers a wider range of compression levels with the Advanced Compress
Option (ACO). The default compression algorithm setting is BASIC and does not
require the Advanced Compression Option.
Ø
If
, however , enabled the Oracle Database 11g Release 2 Advanced Compression
Option , can choose from the following
compression levels:
o
LOW:
Least compression. Performance of database and backup is good. Advanced
Compression License required.
o
HIGH:
Highest Compression. Performance of database and backup is low. Advanced
Compression License required.
o
MEDIUM:
Recommended. Good Combination of Ratio and Performance. Advanced Compression
License required.
RMAN compress the backupset
contents before writing to disk. No extra decompression steps are required
during recovery for rman compressed backup:
To configure the compression algorithm:
RMAN> CONFIGURE COMPRESSEION
ALGORITHM <’<alg_name>’;
SQL>
select ALGORITHM_NAME,
ALGORITHM_DESCRIPTION, ALGORITHM_COMPATIBILITY from
V$RMAN_COMPRESSION_ALGORITHM;
ALGORITHM_NAME
|
ALGORITHM_DESCRIPTION
|
ALGORITHM_COMPATIB
|
BZIP2
|
good compression
ratio
|
9.2.0.0.0
|
BASIC
|
good compression
ratio
|
9.2.0.0.0
|
LOW
|
maximum possible compression
speed
|
11.2.0.0.0
|
ZLIB
|
balance between speed and compression
ratio
|
11.0.0.0.0
|
MEDIUM
|
balance between speed and compression
ratio
|
11.0.0.0.0
|
HIGH
|
maximum possible compression
ratio
|
11.2.0.0.0
|
RMAN Compressed Backup Command
Oracle 10g
RMAN> BACKUP AS COMPRESSED
BACKUPSET DATABASE PLUS ARCHIVELOG;
Oracle 11g/12c
Without
Advanced Compression
RMAN > CONFIGURE COMPRESSION
ALGORITHM 'BASIC';
RMAN> BACKUP AS COMPRESSED
BACKUPSET DATABASE PLUS ARCHIVELOG;
With
Advanced Compression
RMAN > CONFIGURE COMPRESSION
ALGORITHM 'HIGH';
RMAN> BACKUP AS COMPRESSED
BACKUPSET DATABASE PLUS ARCHIVELOG;
As mentioned earlier, with Advanced
Compression can be 'HIGH', 'MEDIUM', 'LOW'.
Pre-compression
Block Processing
It helps in finding the block
suitable for binary compression. Consolidates free space in each block and
setting that free space into binary zeroes.
The OPTIMIZE FOR LOAD option controls pre-compression processing.
By specifying the default, OPTIMIZE
FOR TRUE, we ensure that RMAN optimizes CPU usage and avoids pre-compression
block processing.
By OPTIMIZE FOR LOAD FALSE, RMAN uses additional CPU resources to
perform pre-compression block processing.
Undo
Block Compression/Optimization
Starting 11g, RMAN performs undo
block optimization. In backup undo optimization, RMAN excludes undo not needed
for recovery a backup, that is, for transactions that have been committed. Undo
optimization is only possible if:
·
This
is backup set backup
·
Full
or incremental level 0
·
Not
a validate
·
Backup
piece version is 11.0 or above
· User
has not disabled undo optimization with hidden parameter: _undo_block_compression=FALSE
·
Backup
is going to DISK or OSB tape
·
No
Guaranteed Restore Point (The check is enabled from 11.2 onward)
Comments
Post a Comment