Oracle RMAN各类压缩算法对比测试

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

This entry was posted in Oracle备份恢复 and tagged , , , . Bookmark the permalink.