Backup in RMAN can be compressed when they are being created. Using the following command one can compress backup to disk or tape. The commands used to backup database remain the same.
# Enable compression when creating backup to disk
RMAN> configure device type disk backup type to compressed backupset;
# Enable compression when creating backup to tape
RMAN> configure device type sbt backup type to compressed backupset;
# Backup the database shows the command remains the same
RMAN> run {
backup database;
}
Shows backup size when non-compressed backup versus compressed backup, the percentage of compression may vary.
-rw-r—– 1 oracle oinstall 1109958656 Jan 22 20:09 4rm2pb5i # Shows non-compression backup size
-rw-r—– 1 oracle oinstall 139124736 Jan 22 20:12 4tm2pbb5 # Shows compressed backup size
By looking at v$sesstat one can see the compression rate by comparing physical write total bytes for RMAN sessions
RMAN session where compression was enabled
SID NAME VALUE
———- —————————————————————- ———-
23 physical write total bytes 152788992
23 physical read total bytes 1368006656
RMAN session where compression was not enabled
SID NAME VALUE
———- —————————————————————- ———-
24 physical write total bytes 1124999168
24 physical read total bytes 1367990272
To disable backup for disk
RMAN> configure device type disk backup type to backupset;
To disable backup for tape
RMAN> configure device type sbt backup type to backupset;
What are the advantages and disadvantages of having the compression enabled?
The advantages are saving space on backup device and lesser use of network bandwidth and there is some overhead in CPU usage during RMAN compression.