Oracle11g新特性:RMAN压缩备份
Oracle10g的rman已经可以执行压缩备份,采用的压缩算法是bzip2。
Oracle10g允许你和BACKUP命令伴随使用AS COMPRESSED BACKUPSET字句,对备份集进行压缩。
你可以选择在备份命令里显示指定压缩选项:
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;
但是压缩备份会消耗更多的资源以及时间。
Oracle11g引入了一种新的压缩算法zlib。zlib的压缩率不如bzip2,但是压缩速度则要快不少。本文通过一个实验来对这两种压缩算法进行比较。
[oracle@localhost oracle]$ rman target /
Recovery Manager: Release 11.1.0.6.0 – Production on Thu Sep 6 15:47:43 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: NING (DBID=1218842970)
先执行普通全库备份
RMAN> backup full database
2> format=’/oracle/nocomp%u.ora’;
Starting backup at 06-SEP-07
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oracle/oradata/ning/undotbs01.dbf
input datafile file number=00001 name=/oracle/oradata/ning/system01.dbf
input datafile file number=00002 name=/oracle/oradata/ning/sysaux01.dbf
input datafile file number=00004 name=/oracle/oradata/ning/users01.dbf
input datafile file number=00005 name=/oracle/oradata/ning/test01.dbf
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/nocomp09ir94u3.ora tag=TAG20070906T154819 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/nocomp0air9500.ora tag=TAG20070906T154819 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 06-SEP-07
默认情况下,Oracle11g还是采用的bzip2压缩算法
RMAN> show all;
RMAN configuration parameters for database with db_unique_name NING are:
…
CONFIGURE COMPRESSION ALGORITHM ‘BZIP2′;
…
以bzip2压缩算法执行第二次全库备份
RMAN> backup as compressed backupset full database
2> format=’/oracle/bzip2comp%u.ora’;
Starting backup at 06-SEP-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oracle/oradata/ning/undotbs01.dbf
input datafile file number=00001 name=/oracle/oradata/ning/system01.dbf
input datafile file number=00002 name=/oracle/oradata/ning/sysaux01.dbf
input datafile file number=00004 name=/oracle/oradata/ning/users01.dbf
input datafile file number=00005 name=/oracle/oradata/ning/test01.dbf
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/bzip2comp0bir953r.ora tag=TAG20070906T155122 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/bzip2comp0cir9552.ora tag=TAG20070906T155122 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 06-SEP-07
然后修改默认压缩算法,使用zlib算法
RMAN> configure compression algorithm ‘ZLIB’;
old RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM ‘BZIP2′;
new RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM ‘ZLIB’;
new RMAN configuration parameters are successfully stored
使用zlib压缩算法备份全库
RMAN> backup as compressed backupset full database
2> format=’/oracle/zlibcomp%u.ora’;
Starting backup at 06-SEP-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/oracle/oradata/ning/undotbs01.dbf
input datafile file number=00001 name=/oracle/oradata/ning/system01.dbf
input datafile file number=00002 name=/oracle/oradata/ning/sysaux01.dbf
input datafile file number=00004 name=/oracle/oradata/ning/users01.dbf
input datafile file number=00005 name=/oracle/oradata/ning/test01.dbf
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/zlibcomp0dir958h.ora tag=TAG20070906T155353 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 06-SEP-07
channel ORA_DISK_1: finished piece 1 at 06-SEP-07
piece handle=/oracle/zlibcomp0eir959e.ora tag=TAG20070906T155353 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-SEP-07
下面是备份集的大小
[oracle@localhost oracle]$ ls -l | grep comp
-rw-r—– 1 oracle oinstall 53755904 Sep 6 15:51 bzip2comp0bir953r.ora
-rw-r—– 1 oracle oinstall 1114112 Sep 6 15:52 bzip2comp0cir9552.ora
-rw-r—– 1 oracle oinstall 332972032 Sep 6 15:49 nocomp09ir94u3.ora
-rw-r—– 1 oracle oinstall 9830400 Sep 6 15:49 nocomp0air9500.ora
-rw-r—– 1 oracle oinstall 59514880 Sep 6 15:54 zlibcomp0dir958h.ora
-rw-r—– 1 oracle oinstall 1146880 Sep 6 15:54 zlibcomp0eir959e.ora
现在来对这三种备份进行比较(忽略controlfile和spfile备份集)
不压缩: 文件大小332972032 备份时间00:00:56
BZIP2压缩:文件大小53755904 备份时间00:00:35
ZLIB压缩: 文件大小59514880 备份时间00:00:25
可以看到,两种压缩算法中,bzip2的压缩率比zlib高大概10.7%,但是压缩速度则比zlib慢大概28.6%。这样就可以根据不同的需求来选择不同的压缩算法。
转载。。。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25850100/viewspace-714942/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25850100/viewspace-714942/