- Specify AS COMPRESSED BACKUPSET with the BACKUP command.
- Use a one-time CONFIGURE command.
Here is an example of backing up with compression when issuing the BACKUP command:
RMAN> backup as compressed backupset database;
In this example, compression is configured for the disk device:
RMAN> configure device type disk backup type to compressed backupset;
If you need to clear the device-type compression, issue this command:
RMAN> configure device type disk clear;
I’ve found the default compression algorithm to be quite efficient. For a typical database the backups are usually approximately four to five times smaller than the regular backups. Of course, your compression results may vary, depending on your data.
Why not compress all backups? Compressed backups consume more CPU resources and take longer to create and restore from, but they result in less I/O, spread out over a longer period. If you have multiple CPUs, and the speed of making a backup isn’t an issue, then you should consider compressing your backups.
You can view the type of compression enabled, using the SHOW command:
RMAN> show compression algorithm;
Here is some sample output:
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
The basic compression algorithm doesn’t require an extra license from Oracle. If you’re using Oracle 11g Release 2 or higher, and if you have a license for the Advanced Compression option, then you have available three additional configurable levels of binary compression; for example,
RMAN> configure compression algorithm 'HIGH'; RMAN> configure compression algorithm 'MEDIUM'; RMAN> configure compression algorithm 'LOW';
In my experience the prior compression algorithms are very efficient, both in compression ratios and time taken to create backups.
You can query V$RMAN_COMPRESSION_ALGORITHM to view details regarding the compression algorithms available for your release of the database. To reset the current compression algorithm to the default of BASIC, use the CLEAR command:
RMAN> configure compression algorithm clear;