RMAN依靠channel进行数据读写,其备份可分3个阶段
1
读数据,将数据从磁盘读入input I/O buffer
有4个因素影响RMAN读取速度
Input buffer:
受backup multiplexing的影响--Backup multiplexing is RMAN's ability to read several files in a backup simultaneously from different sources and then write them to a single backup piece.
其对应关系见下表
Data File Read Buffer Sizing Algorithm
|
Level of Multiplexing |
Input Disk Buffer Size |
|
Less than or equal to 4 |
The RMAN channel allocates 16 buffers of size 1 megabyte (MB) so that the total buffer size for all the input files is 16 MB. |
|
Greater than 4 but less than or equal to 8 |
The RMAN channel allocates a variable number of disk buffers of size 512 kilobytes (KB) so that the total buffer size for all the input files is less than 16 MB. |
|
Greater than 8 |
The RMAN channel allocates 4 disk buffers of 128 KB for each file, so that the total buffer size for each input file is 512 KB. |
对于ASM,input buffer数量等同于该磁盘组物理磁盘数;如果某磁盘组包含16个物理磁盘,则channel分配16个input buffer
DISK IO:
同步IO—进程一次只能执行一个任务
异步IO—进程不必等待IO返回便可执行其他任务
10R2默认支持异步IO
IO子进程:
对于不支持异步IO的OS,DB可通过IO Slave间接实现此功能,可通过静态参数dbwr_io_slaves设置dbwr可使用的IO子进程数;
Rate参数
在分配或配置channel时可指定,为每秒可读取最大字节数;
此参数限定rman channel可消耗的IO带宽,以便为其他程序预留资源;
2
复制数据
将数据从input buffer复制到output buffer,并进行validation/compression/encryption等额外处理
3
写数据
将数据从output buffer写入存储设备,分为磁带和磁盘两种,处理方式类似
磁带
Tape buffer—默认每个channel分配4个,buffer大小则因平台而已
IO Slave—由backup_tape_io_slaves参数决定:true—则tape buffer从SGA分配,false—buffer从PGA分配
IO—读写磁带只能采用同步IO ,也可通过tape slaves模拟异步IO
介质管理器—管理网络吞吐/传输速率/磁盘压缩/block size
磁盘
最主要的因素为buffer size,每个channel分配4个1M的buffer
其流程图大致如下
调优建议
1
去除channel的rate限制
2
如果使用同步IO,设置dbmr_io_slaves
3
设置large_pool_size
尤其在使用IO Slave时,如果无法申请到足够的SGA,可能遭遇如下错误
ksfqxcre: failure to allocate shared memory means sync I/O will be used whenever async I/O to file not supported natively
4
通过对照backup validate和backup运行时间,确定瓶颈源于读或写;
调优读
调整multiplexing级别
|
ASM |
Striped Disk |
Recommendation |
|
No |
Yes |
Increase the level of multiplexing. Determine which is the minimum, MAXOPENFILES or the number of files in each backup set, and then increase this value. In this way, you increase the rate at which RMAN fills tape buffers, which makes it more likely that buffers are sent to the media manager fast enough to maintain streaming. |
|
No |
No |
Increase the MAXOPENFILES setting on the channel. |
|
Yes |
Not applicable |
Set the MAXOPENFILES parameter on the channel to 1 or 2. |
调优复制/写
改用增量备份
使用高级压缩选项替代basic压缩算法
如果有足够CPU资源且采用binary压缩,考虑增加channel数量
如果备份集要加密,使用AES128算法,其消耗CPU最小
如果向ASM写备份,增加channel数量,最大与物理磁盘数持平
相关视图
V$session_longops
SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
V$backup_sync_io/v$backup_async_io
SELECT LONG_WAITS/IO_COUNT, FILENAME
FROM V$BACKUP_ASYNC_IO
WHERE LONG_WAITS/IO_COUNT > 0
ORDER BY LONG_WAITS/IO_COUNT DESC;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15480802/viewspace-762974/ ,如需转载,请注明出处,否则将追究法律责任。