10G 中的RMAN 压缩功能

简介: 转自 http://www.eygle.com/archives/2005/03/oracle10gneeoai.html Oracle10g允许你和BACKUP命令伴随使用AS COMPRESSED BACKUPSET字句,对备份集进行压缩。

转自 http://www.eygle.com/archives/2005/03/oracle10gneeoai.html

Oracle10g允许你和BACKUP命令伴随使用AS COMPRESSED BACKUPSET字句,对备份集进行压缩。
这个压缩备份在恢复时无需解压缩,这一特性在以下条件下可能大为有益:
1.你的备份存储空间有限
2.通过网络备份而带宽有限
3.直接备份至磁带、CD,DVD介质而压缩不可用

你可以选择在备份命令里显示指定压缩选项:
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
--仅对1,5文件压缩备份
BACKUP AS COMPRESSED BACKUPSET DATAFILE 1,5;

也可以配置RMAN指定压缩选项:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;

但是压缩备份会消耗更多的资源以及时间。
我们看一下以下测试:

1.压缩备份

RMAN> backup full filesperset 11 database ; Starting backup at 29-MAR-05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=161 devtype=DISK channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00009 name=/data1/oradata/systemfile/bigtbs.dbf input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf input datafile fno=00006 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf input datafile fno=00004 name=/opt/oracle/oradata/eygle/users01.dbf input datafile fno=00007 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf input datafile fno=00010 name=/opt/oracle/oradata/eygle/dfmbrc.dbf input datafile fno=00008 name=/opt/oracle/oradata/eygle/trans01.dbf input datafile fno=00005 name=/data1/oradata/systemfile/eygle01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/ 2005_03_29/o1_mf_nnndf_TAG20050329T062814_14k1813y_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:08:35 channel ORA_DISK_1: starting compressed full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00011 name=/opt/oracle/oradata/eygle/t2k01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T062814_14k1r4fh_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 29-MAR-05 Starting Control File and SPFILE Autobackup at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/ 2005_03_29/o1_mf_s_554193419_14k1rdyr_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 29-MAR-05

注意压缩备耗时:00:08:35 + 00:00:07 = 8:42 = 522s

2.非压缩备份

RMAN> configure device type disk backup type to compressed backupset; old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters are successfully stored released channel: ORA_DISK_1 RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO backupset; old RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters: CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET PARALLELISM 1; new RMAN configuration parameters are successfully stored RMAN> backup full filesperset 11 database ; Starting backup at 29-MAR-05 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=161 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00009 name=/data1/oradata/systemfile/bigtbs.dbf input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf input datafile fno=00006 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf input datafile fno=00004 name=/opt/oracle/oradata/eygle/users01.dbf input datafile fno=00007 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf input datafile fno=00010 name=/opt/oracle/oradata/eygle/dfmbrc.dbf input datafile fno=00008 name=/opt/oracle/oradata/eygle/trans01.dbf input datafile fno=00005 name=/data1/oradata/systemfile/eygle01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T065513_14k2tmx7_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00011 name=/opt/oracle/oradata/eygle/t2k01.dbf channel ORA_DISK_1: starting piece 1 at 29-MAR-05 channel ORA_DISK_1: finished piece 1 at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/backupset/2005_03_29/ o1_mf_nnndf_TAG20050329T065513_14k2y7go_.bkp comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 29-MAR-05 Starting Control File and SPFILE Autobackup at 29-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/2005_03_29/ o1_mf_s_554194638_14k2yhwz_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 29-MAR-05 RMAN>

非压缩备份耗时: 00:01:55 + 00:00:07 = 2:02 = 122s
压缩备份使用的时间是非压缩方式的: 522 / 122 = 4.28 倍.

3.压缩比率

$ ls -l total 2585568 -rw-r----- 1 oracle dba 190103552 Mar 29 06:36 o1_mf_nnndf_TAG20050329T062814_14k1813y_.bkp -rw-r----- 1 oracle dba 1093632 Mar 29 06:36 o1_mf_nnndf_TAG20050329T062814_14k1r4fh_.bkp -rw-r----- 1 oracle dba 1130618880 Mar 29 06:57 o1_mf_nnndf_TAG20050329T065513_14k2tmx7_.bkp -rw-r----- 1 oracle dba 1302528 Mar 29 06:57 o1_mf_nnndf_TAG20050329T065513_14k2y7go_.bkp

压缩备份大小: 190103552 + 1093632 = 182.33984375 M
非压缩备份集: 1130618880 + 1302528 = 1079.484375 M

非压缩较压缩大小: 1079.484375/182.33984375 = 5.9 倍
压缩方式大大节省了空间。

4.CPU消耗
压缩备份时CPU消耗:

PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 15252 oracle 11 10 0 430M 353M cpu01 1:38 0 26.35% oracle

大约在26%左右。
而非压缩模式下CPU消耗:

PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 15252 oracle 11 52 0 445M 364M sleep 9:07 57 16.43% oracle

大约为16%
压缩模式较非压缩模式多消耗 10%左右的CPU
看来选择那种模式要依赖你的环境及需要,但是毕竟Oracle提供了更多的可选项给我们。
-------------------(完)
 
当然自己也测试了结果确实是盖哥说这样。但是我想备份一般在0:00这个时候一般的系统的负载是比较小的。所以我认为这个功能对空间的有限的客户来说不失为一个好功能。
相关文章
|
7月前
|
Oracle 关系型数据库
|
SQL Oracle 关系型数据库
|
Oracle 关系型数据库 OLAP
[20171123]rman备份与数据文件变化6.txt
[20171123]rman备份与数据文件变化6.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.
794 0
|
Oracle 关系型数据库 数据库管理
[20161101]rman备份与数据文件变化7.txt
[20161101]rman备份与数据文件变化7.txt --//想象一下,如果备份文件时间很长,而这个时候数据文件大小发生了变化,oracle的备份如何解决这个问题呢? --//去年已经测试了建立备份集的情况,一直想做一次image copy的测试,一直脱,主要原因自己不想做这个测试.
1189 0
|
Oracle 关系型数据库 数据库
[20171031]rman备份压缩模式.txt
[20171031]rman备份压缩模式.txt --//测试rman备份压缩模式,那种效果好,我记忆里选择medium在备份时间和备份文件大小综合考虑最佳. --//还是通过脚本测试: 1.
1242 0