利用RMAN的cate限制RMAN备份速度
Mar192013
最近有个客户反映,在他们晚上数据库备份的时候,前台反映数据库特别慢,业务无法进行,看了下客户的AWR信息,发现该时段都是I/O相关的等待事件,经和客户沟通,他们没小时都要生成一次报表,这些SQL处理的数据量比重太大,基本都是全表扫描, 而且没有限制RMAN的备份速度,RMAN占用了大量的磁盘I/O,从客户的备份日志里可以看到,365G的数据,一共备份了1小时40分钟,平均每秒60M的速度。
[Normal] From: BSM@acap3 "DB_mod1_a" Time: 2013-3-14 3:00:05 OB2BAR application on "moddb1" successfully started. ... ... [Normal] From: BSM@acap3 "DB_mod1_a" Time: 2013-3-14 4:46:12 Backup Statistics: ... ... Mbytes Total ................. 365358 MB
客户无法更改1小时产生一次报表的业务需求,也不考虑报表库分离,只能在降低RMAN备份速度减少I/O争用上入手了。
客户的备份脚本中开了5个通道,而磁带机只分配给数据库服务器两个drive,那么同时只有2个通道在工作,那么只需要将每个通道限制写出速度在20M,RMAN的备份速度就限制在40M/秒了,以下是在我的测试环境实验的脚本,客户的脚本不能公开。
run { allocate channel 'dev_0' type disk rate 20m; allocate channel 'dev_1' type disk rate 20m; backup database; sql 'alter system archive log current'; backup archivelog all delete input; }
默认情况下,RMAN会占用所有I/O资源,这样对一个7*24的生产环境来说,即使在晚上备份,也会影响到业务,那么就需要使用rate合理限制RMAN的备份速度,以减少I/O争用对系统的影响,下面是ORACLE 10gR2的官方文档对rate的介绍:
By default, RMAN uses all available I/O bandwidth to read/write to disk. You can limit the I/O resources consumed by a backup job with the RATE option of the ALLOCATE CHANNEL or CONFIGURE CHANNEL commands. The RATE option specifies the maximum number of bytes for each second that RMAN reads on the channel. For example, you can configure automatic channels to limit each channel to read 1 MB a second: CONFIGURE DEVICE TYPE sbt PARALLELISM 2; CONFIGURE DEFAULT DEVICE TYPE TO sbt; CONFIGURE CHANNEL DEVICE TYPE sbt RATE 1M; In effect, the RATE option throttles RMAN so that a backup job does not consume excessive I/O bandwidth on the computer.