大多数操作系统支持异步I/O。
备份到磁盘,异步I/O是一个优势,因为一个服务器进程同时可以执行多个I/O操作;同步I/O必须等上一个I/O操作完成才可以执行下一个I/O操作。
初始化参数disk_asynch_io控制oracle异步I/O操作行为。如果操作系统支持异步I/O,oracle建议设置该参数为true。
如果操作系统不支持异步I/O,可以设置dbwr_io_slaves参数为非零值来调优I/O性能。(如果设置为非零值,会增加数据库进程的数量,需要增加processes的值)
如果使用的是磁带备份,查看视图v$backup_sync_io中的列effective_bytes_per_second。如果该值比磁带设备的最大吞吐小,表明磁带设备不是streaming(连续写) 。
此外,对于磁带设备,可以比较backup validate命令和实际备份任务的时间,如果时间明显比实际备份任务时间小,表明磁带的写能力很可能是瓶颈。
可以通过以下两个试图,监控异步I/O和同步I/O:
·v$backup_async_io:查看备份或者还原操作的异步I/O
·v$backup_symc_io:查看备份或者还原的同步I/O性能。
在这两个试图中,effective_bytes_per_second列的含义:Read/write rate for device during backup or restore.
备份或还原操作中,异步I/O的监控信息:
SQL> SELECT sid, serial, filename, type, elapsed_time, effective_bytes_per_second
FROM v$backup_async_io
WHERE close_time > sysdate-; SID SERIAL FILENAME TYPE ELAPSED_TIME EFFECTIVE_BYTES_PER_SECOND
---------- ---------- ------------------------------------------------------------ --------- ------------ --------------------------
AGGREGATE
/u11/app/oracle/oradata/ora11/system01.dbf INPUT
/u11/app/oracle/oradata/ora11/sysaux01.dbf INPUT
/u11/app/oracle/oradata/ora11/example01.dbf INPUT
/u11/app/oracle/oradata/ora11/UNDOTBS02.dbf INPUT
/u11/app/oracle/oradata/ora11/yb01.dbf INPUT
/u11/app/oracle/oradata/ora11/users01.dbf INPUT
/u11/app/oracle/oradata/ora11/yb02.dbf INPUT
/u11/app/oracle/fra/ORA11/backupset/2015_07_01/o1_mf_nnndf_T OUTPUT
AG20150701T122458_bs6twvbn_.bkp AGGREGATE
/u11/app/oracle/product/11.2./dbhome_1/dbs/snapcf_ora11.f INPUT
/u11/app/oracle/fra/ORA11/autobackup/2015_07_01/o1_mf_s_8839 OUTPUT
16783_bs6tzjr5_.bkp rows selected. SQL> SELECT filename, sid, serial, close_time, long_waits/io_count as ratio
FROM v$backup_async_io
WHERE type != 'AGGREGATE'
AND SID = &SID
AND SERIAL = &SERIAL
ORDER BY ratio desc;
Enter value for sid:
old : AND SID = &SID
new : AND SID =
Enter value for serial:
old : AND SERIAL = &SERIAL
new : AND SERIAL = FILENAME SID SERIAL CLOSE_TIM RATIO
------------------------------------------------------------ ---------- ---------- --------- ----------
/u11/app/oracle/fra/ORA11/backupset/2015_07_01/o1_mf_nnndf_T -JUL- .
AG20150701T122458_bs6twvbn_.bkp /u11/app/oracle/fra/ORA11/autobackup/2015_07_01/o1_mf_s_8839 -JUL- .
16783_bs6tzjr5_.bkp /u11/app/oracle/oradata/ora11/example01.dbf -JUL-
/u11/app/oracle/oradata/ora11/UNDOTBS02.dbf -JUL-
/u11/app/oracle/oradata/ora11/users01.dbf -JUL-
/u11/app/oracle/oradata/ora11/yb02.dbf -JUL-
/u11/app/oracle/product/11.2./dbhome_1/dbs/snapcf_ora11.f -JUL-
/u11/app/oracle/oradata/ora11/sysaux01.dbf -JUL-
/u11/app/oracle/oradata/ora11/system01.dbf -JUL-
/u11/app/oracle/oradata/ora11/yb01.dbf -JUL- rows selected. SQL>