1.背景概述

2.本次测试环境基本信息

3.测试步骤

3.1. 使用BCO进行压缩备份

3.2. 不使用压缩备份

3.3. 使用ACO中LOW级别进行压缩备份

3.4. 使用ACO中MEDIUM级别进行压缩备份

3.5. 使用ACO中HIGH级别进行压缩备份

4.各类备份方式对比分析

4.1. 生成备份文件大小差异

4.2. 备份时长差异

4.3. 备份CPU资源差异

4.4. 备份Memory资源差异

4.5. 备份IO资源差异

5.总结

1.背景概述

本文是对Oracle RMAN各类压缩算法的对比测试。
Oracle RMAN的各类压缩算法:
Oracle 提供Basic Compression Option(BCO)和Advanced Compression Option(ACO)两种选项,其中ACO又包含HIGH、MEDIUM、LOW三种压缩级别。

2.本次测试环境基本信息

测试环境:AIX 7.1 + Oracle 11.2.0.4
测试数据量:93G

SQL> select sum(bytes/1024/1024/1024) "GB" from dba_segments;

        GB
----------
93.4935303

RMAN当前配置选项:

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name jingyudb are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DATA/jingyudb/snapcf_jingyudb.f';

测试环境确认停止业务测试后,在准备期间发现数据库仍有大量job在运行,为了尽可能避免其对测试结果的影响,申请设置参数禁止job运行(注意测试完成后要恢复原始设置):

SQL> alter system set job_queue_processes=0;

System altered.

RMAN备份配置:

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;

3.测试步骤

3.1 使用BCO进行压缩备份

RMAN设置压缩备份的类型(默认就是这种压缩备份算法):

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

脚本名称:rman01-basic.sh

echo "=================================================" >> /orabak/rman/rman01-basic.log
echo "Begin backup at: `date`" >> /orabak/rman/rman01-basic.log
rman target / <<EOF >> /orabak/rman/rman01-basic.log
run {
backup
as compressed backupset
incremental level = 0
filesperset = 3
format='/orabak/rman/Test01-basic_%d_%U'
database
include current controlfile spfile ;
}
exit;
EOF
echo "End backup at: `date`" >> /orabak/rman/rman01-basic.log
echo "=================================================" >> /orabak/rman/rman01-basic.log
exit 0

脚本输出日志:rman01-basic.log

=================================================
Begin backup at: Tue Jun 2 15:08:03 CST 2020 Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 2 15:08:03 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates All rights reserved. connected to target database: jingyudb (DBID=3820045113) RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
Starting backup at 02-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1335 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=1807 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=2187 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=2 instance=jingyudb1 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/jingyudb/datafile/pt_data.1
input datafile file number=00003 name=+DATA/jingyudb/datafile/undotbs1.262.971441603
input datafile file number=00011 name=+DATA/jingyudb/datafile/pt_indx.2
channel ORA_DISK_1: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/jingyudb/datafile/pt_indx.1
input datafile file number=00005 name=+DATA/jingyudb/datafile/users.265.971441611
input datafile file number=00008 name=+DATA/jingyudb/datafile/pt_indx
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/jingyudb/datafile/pt_data
input datafile file number=00004 name=+DATA/jingyudb/datafile/undotbs2.264.971441609
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/jingyudb/datafile/pt_data.2
input datafile file number=00002 name=+DATA/jingyudb/datafile/sysaux.261.971441603
input datafile file number=00001 name=+DATA/jingyudb/datafile/system.260.971441599
channel ORA_DISK_4: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_2tv1ofmm_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:08:25
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_30v1og6f_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_31v1og6h_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_2uv1ofmm_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:09:52
channel ORA_DISK_4: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_2vv1ofmm_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:10:12
channel ORA_DISK_1: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test01-basic_jingyudb_2sv1ofmm_1_1 tag=TAG20200602T150805 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:13:23
Finished backup at 02-JUN-20 Starting Control File and SPFILE Autobackup at 02-JUN-20
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3820045113-20200602-05 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUN-20 RMAN> Recovery Manager complete.
End backup at: Tue Jun 2 15:21:30 CST 2020
=================================================

3.2 不使用压缩备份

RMAN设置压缩备份的类型:无需设置。
脚本名称:rman02-nocomp.sh

echo "=================================================" >> /orabak/rman/rman02-nocomp.log
echo "Begin backup at: `date`" >> /orabak/rman/rman02-nocomp.log
rman target / <<EOF >> /orabak/rman/rman02-nocomp.log
run {
backup
incremental level = 0
filesperset = 3
format='/orabak/rman/Test02-nocomp_%d_%U'
database
include current controlfile spfile ;
}
exit;
EOF
echo "End backup at: `date`" >> /orabak/rman/rman02-nocomp.log
echo "=================================================" >> /orabak/rman/rman02-nocomp.log
exit 0

脚本输出日志:rman02-nocomp.log

=================================================
Begin backup at: Tue Jun 2 15:47:39 CST 2020 Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 2 15:47:39 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates All rights reserved. connected to target database: jingyudb (DBID=3820045113) RMAN> 2> 3> 4> 5> 6> 7> 8>
Starting backup at 02-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1807 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2187 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=2 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=193 instance=jingyudb1 device type=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/jingyudb/datafile/pt_data.1
input datafile file number=00003 name=+DATA/jingyudb/datafile/undotbs1.262.971441603
input datafile file number=00011 name=+DATA/jingyudb/datafile/pt_indx.2
channel ORA_DISK_1: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: starting incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/jingyudb/datafile/pt_indx.1
input datafile file number=00005 name=+DATA/jingyudb/datafile/users.265.971441611
input datafile file number=00008 name=+DATA/jingyudb/datafile/pt_indx
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: starting incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/jingyudb/datafile/pt_data
input datafile file number=00004 name=+DATA/jingyudb/datafile/undotbs2.264.971441609
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: starting incremental level 0 datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/jingyudb/datafile/pt_data.2
input datafile file number=00002 name=+DATA/jingyudb/datafile/sysaux.261.971441603
input datafile file number=00001 name=+DATA/jingyudb/datafile/system.260.971441599
channel ORA_DISK_4: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_34v1oi0u_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:07:08
channel ORA_DISK_2: starting incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_35v1oi0v_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:07:09
channel ORA_DISK_3: starting incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_36v1oi0v_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:07:09
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_1: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_33v1oi0u_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:07:36
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_37v1oieb_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test02-nocomp_jingyudb_38v1oiec_1_1 tag=TAG20200602T154742 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:26
Finished backup at 02-JUN-20 Starting Control File and SPFILE Autobackup at 02-JUN-20
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3820045113-20200602-06 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUN-20 RMAN> Recovery Manager complete.
End backup at: Tue Jun 2 15:55:22 CST 2020
=================================================

3.3 使用ACO中LOW级别进行压缩备份

RMAN设置压缩备份的类型(压缩算法设置为LOW,其他不变):

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE COMPRESSION ALGORITHM 'LOW' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ;

脚本名称:rman03-low.sh

echo "=================================================" >> /orabak/rman/rman03-low.log
echo "Begin backup at: `date`" >> /orabak/rman/rman03-low.log
rman target / <<EOF >> /orabak/rman/rman03-low.log
run {
backup
as compressed backupset
incremental level = 0
filesperset = 3
format='/orabak/rman/Test03-low_%d_%U'
database
include current controlfile spfile ;
}
exit;
EOF
echo "End backup at: `date`" >> /orabak/rman/rman03-low.log
echo "=================================================" >> /orabak/rman/rman03-low.log
exit 0

脚本输出日志:rman03-low.log

=================================================
Begin backup at: Tue Jun 2 13:28:37 CST 2020 Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 2 13:28:37 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates All rights reserved. connected to target database: jingyudb (DBID=3820045113) RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
Starting backup at 02-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1807 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2187 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=2 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=193 instance=jingyudb1 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/jingyudb/datafile/pt_data.1
input datafile file number=00003 name=+DATA/jingyudb/datafile/undotbs1.262.971441603
input datafile file number=00011 name=+DATA/jingyudb/datafile/pt_indx.2
channel ORA_DISK_1: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/jingyudb/datafile/pt_indx.1
input datafile file number=00005 name=+DATA/jingyudb/datafile/users.265.971441611
input datafile file number=00008 name=+DATA/jingyudb/datafile/pt_indx
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/jingyudb/datafile/pt_data
input datafile file number=00004 name=+DATA/jingyudb/datafile/undotbs2.264.971441609
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/jingyudb/datafile/pt_data.2
input datafile file number=00002 name=+DATA/jingyudb/datafile/sysaux.261.971441603
input datafile file number=00001 name=+DATA/jingyudb/datafile/system.260.971441599
channel ORA_DISK_4: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_28v1o9s8_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:03:45
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_2bv1oa39_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_2cv1oa3e_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_29v1o9s8_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:04:25
channel ORA_DISK_4: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_2av1o9s8_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:04:55
channel ORA_DISK_1: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test03-low_jingyudb_27v1o9s8_1_1 tag=TAG20200602T132839 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:05
Finished backup at 02-JUN-20 Starting Control File and SPFILE Autobackup at 02-JUN-20
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3820045113-20200602-02 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUN-20 RMAN> Recovery Manager complete.
End backup at: Tue Jun 2 13:33:46 CST 2020
=================================================

3.4 使用ACO中MEDIUM级别进行压缩备份

RMAN设置压缩备份的类型(压缩算法设置为MEDIUM,其他不变):

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ;

脚本名称:rman04-medium.sh

echo "=================================================" >> /orabak/rman/rman04-medium.log
echo "Begin backup at: `date`" >> /orabak/rman/rman04-medium.log
rman target / <<EOF >> /orabak/rman/rman04-medium.log
run {
backup
as compressed backupset
incremental level = 0
filesperset = 3
format='/orabak/rman/Test04-medium_%d_%U'
database
include current controlfile spfile ;
}
exit;
EOF
echo "End backup at: `date`" >> /orabak/rman/rman04-medium.log
echo "=================================================" >> /orabak/rman/rman04-medium.log
exit 0

脚本输出日志:rman04-medium.log

=================================================
Begin backup at: Tue Jun 2 13:40:22 CST 2020 Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 2 13:40:22 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates All rights reserved. connected to target database: jingyudb (DBID=3820045113) RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
Starting backup at 02-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1807 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2187 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=2 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=193 instance=jingyudb1 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/jingyudb/datafile/pt_data.1
input datafile file number=00003 name=+DATA/jingyudb/datafile/undotbs1.262.971441603
input datafile file number=00011 name=+DATA/jingyudb/datafile/pt_indx.2
channel ORA_DISK_1: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/jingyudb/datafile/pt_indx.1
input datafile file number=00005 name=+DATA/jingyudb/datafile/users.265.971441611
input datafile file number=00008 name=+DATA/jingyudb/datafile/pt_indx
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/jingyudb/datafile/pt_data
input datafile file number=00004 name=+DATA/jingyudb/datafile/undotbs2.264.971441609
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/jingyudb/datafile/pt_data.2
input datafile file number=00002 name=+DATA/jingyudb/datafile/sysaux.261.971441603
input datafile file number=00001 name=+DATA/jingyudb/datafile/system.260.971441599
channel ORA_DISK_4: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2fv1oai9_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:04:15
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2gv1oai9_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:04:15
channel ORA_DISK_3: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2jv1oaq8_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2iv1oaq8_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_4: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2hv1oai9_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:05:01
channel ORA_DISK_1: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test04-medium_jingyudb_2ev1oai9_1_1 tag=TAG20200602T134024 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:51
Finished backup at 02-JUN-20 Starting Control File and SPFILE Autobackup at 02-JUN-20
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3820045113-20200602-03 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUN-20 RMAN> Recovery Manager complete.
End backup at: Tue Jun 2 13:46:18 CST 2020
=================================================

3.5 使用ACO中HIGH级别进行压缩备份

RMAN设置压缩备份的类型(压缩算法设置为HIGH,其他不变):

CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE COMPRESSION ALGORITHM 'HIGH' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ;

脚本名称:rman05-high.sh

echo "=================================================" >> /orabak/rman/rman05-high.log
echo "Begin backup at: `date`" >> /orabak/rman/rman05-high.log
rman target / <<EOF >> /orabak/rman/rman05-high.log
run {
backup
as compressed backupset
incremental level = 0
filesperset = 3
format='/orabak/rman/Test05-high_%d_%U'
database
include current controlfile spfile ;
}
exit;
EOF
echo "End backup at: `date`" >> /orabak/rman/rman05-high.log
echo "=================================================" >> /orabak/rman/rman05-high.log
exit 0 脚本输出日志:rman05-high.log
=================================================
Begin backup at: Tue Jun 2 13:49:57 CST 2020 Recovery Manager: Release 11.2.0.4.0 - Production on Tue Jun 2 13:49:57 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates All rights reserved. connected to target database: jingyudb (DBID=3820045113) RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
Starting backup at 02-JUN-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1807 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=2187 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=2 instance=jingyudb1 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=193 instance=jingyudb1 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/jingyudb/datafile/pt_data.1
input datafile file number=00003 name=+DATA/jingyudb/datafile/undotbs1.262.971441603
input datafile file number=00011 name=+DATA/jingyudb/datafile/pt_indx.2
channel ORA_DISK_1: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/jingyudb/datafile/pt_indx.1
input datafile file number=00005 name=+DATA/jingyudb/datafile/users.265.971441611
input datafile file number=00008 name=+DATA/jingyudb/datafile/pt_indx
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_3: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/jingyudb/datafile/pt_data
input datafile file number=00004 name=+DATA/jingyudb/datafile/undotbs2.264.971441609
channel ORA_DISK_3: starting piece 1 at 02-JUN-20
channel ORA_DISK_4: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/jingyudb/datafile/pt_data.2
input datafile file number=00002 name=+DATA/jingyudb/datafile/sysaux.261.971441603
input datafile file number=00001 name=+DATA/jingyudb/datafile/system.260.971441599
channel ORA_DISK_4: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2mv1ob48_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:24:25
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2pv1oci1_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: starting piece 1 at 02-JUN-20
channel ORA_DISK_2: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2qv1oci3_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_3: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2nv1ob48_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:46:52
channel ORA_DISK_4: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2ov1ob48_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:53:13
channel ORA_DISK_1: finished piece 1 at 02-JUN-20
piece handle=/orabak/rman/Test05-high_jingyudb_2lv1ob47_1_1 tag=TAG20200602T134959 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:58:23
Finished backup at 02-JUN-20 Starting Control File and SPFILE Autobackup at 02-JUN-20
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-3820045113-20200602-04 comment=NONE
Finished Control File and SPFILE Autobackup at 02-JUN-20 RMAN> Recovery Manager complete.
End backup at: Tue Jun 2 14:48:24 CST 2020
=================================================

4.各类备份方式对比分析

根据实际测试的结果,对比各类备份方式的差异。

4.1 生成备份文件大小差异

$ du -sg Test01-basic*|awk '{a+=$1}END{print a}'
17.31
$ du -sg Test02-nocomp*|awk '{a+=$1}END{print a}'
90.21
$ du -sg Test03-low*|awk '{a+=$1}END{print a}'
20.58
$ du -sg Test04-medium*|awk '{a+=$1}END{print a}'
16.67
$ du -sg Test05-high*|awk '{a+=$1}END{print a}'
10.49

从本次测试结果来看,当前环境下,各类备份方式生成备份文件大小:

不使用压缩(90.21G) > ACO-low(20.58G) > BCO-basic(17.31G) > ACO-medium(16.67G) > ACO-high(10.49G)。

4.2 备份时长差异

$BCO-basic(13分27秒)
Begin backup at: Tue Jun 2 15:08:03 CST 2020
End backup at: Tue Jun 2 15:21:30 CST 2020 $不使用压缩(7分43秒)
Begin backup at: Tue Jun 2 15:47:39 CST 2020
End backup at: Tue Jun 2 15:55:22 CST 2020 $ACO-low(5分9秒)
Begin backup at: Tue Jun 2 13:28:37 CST 2020
End backup at: Tue Jun 2 13:33:46 CST 2020 $ACO-medium(5分56秒)
Begin backup at: Tue Jun 2 13:40:22 CST 2020
End backup at: Tue Jun 2 13:46:18 CST 2020 $ACO-high(58分27秒)
Begin backup at: Tue Jun 2 13:49:57 CST 2020
End backup at: Tue Jun 2 14:48:24 CST 2020

从本次测试结果来看,当前环境下,各类备份方式备份时长差异:ACO-high(58分27秒) > BCO-basic(13分27秒) > 不使用压缩(7分43秒) > ACO-medium(5分56秒) > ACO-low(5分9秒)。

4.3 备份CPU资源差异

使用OSW采集到的数据进行分析,只需关注 13:00 - 16:00 这个时间区间内的情况。

java -Duser.language=en -Duser.country=us -jar oswbba.jar -i /Users/jingyuzhao/Documents/oswbb/archive/ -b Jun 2 13:00:00 2020 -e Jun 2 16:00:00 2020





综上,可以看到CPU主要都是User消耗的:在使用ACO-low备份期间(13:28:37 - 13:33:46),CPU使用率为10%左右;在使用ACO-medium备份期间(13:40:22 - 13:46:18),CPU使用率为37%左右;在使用ACO-high备份期间(13:49:57 - 14:48:24),CPU使用率为40%左右;在使用BCO-basic压缩备份期间(15:08:03 - 15:21:30),CPU使用率为40%左右;在不使用压缩备份期间(15:47:39 - 15:55:22),CPU使用率为1%左右。

4.4 备份Memory资源差异



综上,可以看到Memory的free实际在几次备份看不出明显差异,从swap使用来看也同样没有明显差异(上下浮动不到100MB)。从现有的内存监控数据来看,各类备份看不出对内存有明显的差异。

4.5 备份IO资源差异





综上,可以看到IO主要集中在hdisk0、hdisk1、hdisk2三块盘:在使用ACO-low备份期间(13:28:37 - 13:33:46),IO使用率为100%左右;在使用ACO-medium备份期间(13:40:22 - 13:46:18),IO使用率为100%左右;在使用ACO-high备份期间(13:49:57 - 14:48:24),IO使用率平均在15%左右;在使用BCO-basic压缩备份期间(15:08:03 - 15:21:30),IO使用率为50%左右;在不使用压缩备份期间(15:47:39 - 15:55:22),IO使用率为100%左右。

5.总结

本文档对5种类型的备份方式分别进行了实际测试和对比分析,下面将相关结论总结为下表:

备份时间 压缩类型 备份时长 备份文件大小 CPU使用 Memory IO
13:28:37 - 13:33:46 ACO-low 5分9秒 20.58GB 10% 不明显 100%
13:40:22 - 13:46:18 ACO-medium 5分56秒 16.67GB 37% 不明显 100%
13:49:57 - 14:48:24 ACO-high 58分27秒 10.49GB 40% 不明显 15%
15:08:03 - 15:21:30 BCO-basic 13分27秒 17.31GB 40% 不明显 50%
15:47:39 - 15:55:22 不使用压缩 7分43秒 90.21GB 1% 不明显 100%

整体来看,如果没有特殊的需求,BCO的basic已经可以满足需求;如果确认选用ACO,可以看到ACO-low级别CPU使用率最低,备份文件要比BCO-basic偏大;ACO-medium级别在CPU使用率、备份时长、备份文件大小都要比BCO-basic有所提升;而ACO-high级别的备份,虽然备份文件是最小的,但消耗时间过长,要谨慎使用。

另外需要特别说明的是,Oracle官方也在文档中明确提到,不同压缩级别的性能具体表现如何,取决于实际环境,所以本文测试结论只局限于该测试环境和数据情况,如果其他环境需要选择,还需要针对性进行测试。

Oracle RMAN各类压缩算法对比测试的更多相关文章

  1. Oracle RMAN 备份一例

    Oracle RMAN备份一例: Solaris 10 + Oracle 11.2.0.3 Shell:csh,安装有bash,脚本调用bash 备份策略:周日0级备份,周一~周六1级备份,每6小时备 ...

  2. Oracle—RMAN备份(三)

    一.增量备份的相关概念 1. 在前面说明了RMAN的完整备份,完整备份是备份所用使用过的块,不备份没有使用的过的块:增量备份只备份自上次备份以来更改过的块. 2.即使RMAN的默认操作是在增量备份时扫 ...

  3. Oracle—RMAN备份(一)

    一.RMAN备份相关概念 1.RMAN备份中表空间不需要处于backup模式下,它备份数据文件,归档日志文件,控制文件,spfile和备份集片,但不备份联机重做日志文件,临时文件和口令文件. 2.备份 ...

  4. Oracle—RMAN备份(二)

    在Oracle  RMAN备份(一)中,对各种文件在RMAN中备份进行了说明, 一.备份集的复制 在RMAN 备份中,可以备份其自己的备份,即备份一个文件放在多个目录下,oralce支持最多备份四个. ...

  5. oracle rman异机恢复

      Oracle源主机 Oracle目标主机 主机平台 CentOS6.2(final) CentOs6.2(FInal) 主机名 vick rman IP地址 192.168.1.11 192.16 ...

  6. ORACLE RMAN介绍

    本地连接: $ rman target /  or $ rman target / nocatalog 远程连接: $ rman target sys/sys@sky RMAN命令执行方式: 1.单条 ...

  7. [Oracle][RMAN] Use RMAN to Migrate database from CentOS_5-11201-SingleDB to OracleLinux_5-11204-SingleDB

    リンク:How to Move/Restore DB to New Host and File System using RMAN (Doc ID 1338193.1)https://docs.ora ...

  8. [Oracle][RMAN]关于Oracle RMAN里面的Merged Incremental Backups的Tag分离机能

    关于Oracle RMAN里面的Merged Incremental Backups的机能,RMAN使用的比较多的DBA们可能会有所了解. 基本上,每次都实行同样的Backup命令即可完成BACK. ...

  9. ORACLE RMAN备份及还原(转)

    RMAN可以进行增量备份:数据库,表空间,数据文件 只有使用过的block可以被备份成backup set 表空间与数据文件对应关系:dba_data_files / v$datafile_heade ...

随机推荐

  1. 【雕爷学编程】Arduino动手做(53)---土壤湿度传感器

    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种的.鉴于本人手头积累了一些传感器和模块,依照实践(动手试试)出真知的理念,以学习和交流为目的,这里准备 ...

  2. 二、YARN

    一.YARN 介绍 yarn 是下一代 MapReduce,即 MRv2,是在第一代 MapReduce 基础上演变而来的,主要是为了解决原始 Hadoop 扩展性较差,不支持多计算框架而提出的,通俗 ...

  3. python机器学习(三)分类算法-朴素贝叶斯

    一.概率基础 概率定义:概率定义为一件事情发生的可能性,例如,随机抛硬币,正面朝上的概率. 联合概率:包含多个条件,且所有条件同时成立的概率,记作:

  4. 浅谈JQuery

    一.什么是JQuery? JQuery是第三方开发的执行DOM操作的极简化的函数库. 执行DOM操作:JQuery还是在执行DOM操作 1.学习JQuery还是在学习DOM 2.五件事:增删改查 事件 ...

  5. 05 返回静态文件的多线程web框架

    05 返回静态文件的多线程web框架 服务器server端python程序(多线程版): import socket from threading import Thread,currentThrea ...

  6. mvc 页面上循环datatable

    @using System.Data; @{ Layout = null; } @{ DataTable DataServiceStaff = ViewBag.ServiceStaff as Data ...

  7. Spring 依赖注入(DI)简介

    依赖注入的英文表示为dependency injection,缩写为DI. Spring框架的核心功能之一就是通过依赖注入的方式来管理Bean之间的依赖关系. 当编写一个复杂的 Java 应用程序时, ...

  8. CF948D Perfect Security

    题目链接:http://codeforces.com/contest/948/problem/D 知识点: Trie 题目大意: 给出两个长度为 \(N(1 \le N \le 300000)\) 的 ...

  9. 汉字统计(hdu2030)

    输入格式:一个整型,再循环带有空格的字符串 思考:用scanf_s()函数输入整型,然后一个大循环,再用gets_s()函数输入带空格的字符串. 注意:scanf_s()函数多加了%c,&d, ...

  10. Java——分布式

    分布式编程技术的基本思想:客户计算机产生一个请求,然后将这个请求通过网络发送到服务器.服务器处理这个请求,并发送回一个针对该客户端的响应,供客户端进行分析.客户端和服务端之间用代理进行通讯,客户端调用 ...