ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 10G 中的RMAN 压缩功能

10G 中的RMAN 压缩功能

原创 Linux操作系统 作者:gaopengtttt 时间:2008-11-12 10:10:28 0 删除 编辑

转自 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这个时候一般的系统的负载是比较小的。所以我认为这个功能对空间的有限的客户来说不失为一个好功能。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7728585/viewspace-490925/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
wxh gp_22389860 <<深入理解MySQL主从原理专栏>> 发布 可加WX了解

注册时间:2008-10-13

  • 博文量
    698
  • 访问量
    2969331