Oracle11g新特性:RMAN压缩备份
上一篇:鲜果,web2.0? 下一篇:Oracle11g新特性:虚拟列virtual column

Oracle11g新特性:RMAN压缩备份

Oracle10g的rman已经可以执行压缩备份,采用的压缩算法是bzip2。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%。这样就可以根据不同的需求来选择不同的压缩算法。

本文网址:http://www.ningoo.net/html/2007/oracle11g_new_feature_rman_compression_backup.html

订阅到Google | 收藏到Del.icio.us | 推荐到鲜果

相关文章 随机文章

本文Tags: , , , ,

评论暂缺


(Required)
(Required, will not be published)