平时工作中常碰到需要限制rman备份速度的情况,下面就相关问题进行测试:
1 使用rman自带的功能进行限速
缺省情况下,RMAN使用所有可用带宽对磁盘执行读写。
用户可以借助参数rate来限制RMAN任务对I/O资源的消耗。
在allocate channel、configure channel命令中指定参数rate,来指定每个channel每秒最大可以使用的I/O。
例如,配置最大值为1MB:
configure device type DISK parallelism 3;
configure default device type to DISK;
configure channel device type DISK rate 1m;
一共分配了三个通道,每秒最大可以写3mb的数据。
相关的bug情况:
Bug 17015970 RMAN backup using RATE parameter is very slow 影响12c之下版本
Bug 18153219 - RMAN: Parameter "RATE" is not honored during backup (Doc ID 18153219.8)
测试:
正常情况的rman备份情况:
RMAN> backup database format '/home/oracle/test%U.bak';
Starting backup at 25-MAY-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/software/system.256.1084042585
input datafile file number=00002 name=/software/sysaux.257.1084042585
input datafile file number=00003 name=/software/undotbs1.258.1084042585
input datafile file number=00005 name=/software/example.265.1084042679
input datafile file number=00006 name=/software/undotbs2.266.1084042817
input datafile file number=00008 name=/software/jt_sjgc.272.1092405397
input datafile file number=00009 name=/software/jt_netcargps.273.1092405397
input datafile file number=00010 name=/software/jt_busgps.274.1092405399
input datafile file number=00011 name=/software/jt_taxigps.275.1092405399
input datafile file number=00004 name=/software/users.259.1084042585
input datafile file number=00007 name=/software/test.271.1084444975
input datafile file number=00012 name=/software/audit_data.276.1133477037
input datafile file number=00013 name=/software/zc.256.1162077921
channel ORA_DISK_1: starting piece 1 at 25-MAY-24
速度情况:
avg-cpu: %user %nice %system %iowait %steal %idle
7.14 0.00 91.84 0.00 0.00 1.02
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 909.00 699.00 296176.00 357376.00 812.88 2.79 1.96 2.16 1.70 0.54 87.00
sdb 0.00 0.00 0.00 1.00 0.00 4.00 8.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-0 0.00 0.00 909.00 0.00 296176.00 0.00 651.65 1.96 2.16 2.16 0.00 0.57 51.60
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-2 0.00 0.00 0.00 699.00 0.00 357376.00 1022.54 1.19 1.70 0.00 1.70 1.11 77.30
avg-cpu: %user %nice %system %iowait %steal %idle
5.73 0.00 92.71 0.00 0.00 1.56
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 634.00 688.00 310248.00 351760.00 1001.52 2.55 2.22 2.68 1.81 0.66 87.50
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-0 0.00 0.00 634.00 1.00 310248.00 16.00 977.21 1.70 2.68 2.68 1.00 0.88 56.00
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-2 0.00 0.00 0.00 687.00 0.00 351744.00 1024.00 1.25 1.82 0.00 1.82 1.07 73.50
avg-cpu: %user %nice %system %iowait %steal %idle
2.06 0.00 25.26 36.60 0.00 36.08
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 196.00 165.00 84604.00 84480.00 936.75 78.15 2.57 3.10 1.95 2.66 96.20
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-0 0.00 0.00 212.00 0.00 89780.00 0.00 846.98 12.04 2.86 2.86 0.00 4.26 90.40
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-2 0.00 0.00 0.00 256.00 0.00 131072.00 1024.00 66.34 1.26 0.00 1.26 3.52 90.10
限制rman 备份速度后速度情况:
限速:
RMAN> configure channel device type disk rate 200k ;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK RATE 200 K;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1
开始备份:
RMAN> backup database format '/home/oracle/test%U.bak';
Starting backup at 25-MAY-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=154 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=00001 name=/software/system.256.1084042585
input datafile file number=00002 name=/software/sysaux.257.1084042585
input datafile file number=00003 name=/software/undotbs1.258.1084042585
input datafile file number=00005 name=/software/example.265.1084042679
input datafile file number=00006 name=/software/undotbs2.266.1084042817
input datafile file number=00008 name=/software/jt_sjgc.272.1092405397
input datafile file number=00009 name=/software/jt_netcargps.273.1092405397
input datafile file number=00010 name=/software/jt_busgps.274.1092405399
input datafile file number=00011 name=/software/jt_taxigps.275.1092405399
input datafile file number=00004 name=/software/users.259.1084042585
input datafile file number=00007 name=/software/test.271.1084444975
input datafile file number=00012 name=/software/audit_data.276.1133477037
input datafile file number=00013 name=/software/zc.256.1162077921
channel ORA_DISK_1: starting piece 1 at 25-MAY-24
速度情况:
avg-cpu: %user %nice %system %iowait %steal %idle
0.51 0.00 0.00 0.00 0.00 99.49
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 1.00 0.00 16.00 32.00 0.00 0.00 0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 1.00 0.00 4.00 8.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-0 0.00 0.00 0.00 1.00 0.00 16.00 32.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.00 0.00 0.00 100.00
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 2.00 0.00 8.00 8.00 0.00 0.00 0.00 0.00 0.00 0.00
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
sdc 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-0 0.00 0.00 0.00 2.00 0.00 8.00 8.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
dm-2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00