在Oracle 11g中dbms_resource_manager PL/SQL包提供了calibrate_io过程可以用来对Oracle数据库的IO子系统进行IO能力测试,
在使用前,先要满足以下条件:
The user must be granted the SYSDBA privilege
timed_statistics must be set to TRUE
Asynchronous I/O must be enabled When using file systems, asynchronous I/O can be enabled by setting the FILESYSTEMIO_OPTIONS initialization parameter to SETALL. Ensure that asynchronous I/O is enabled for data files by running the following query: COL NAME FORMAT A50 SELECT NAME,ASYNCH_IO FROM V$DATAFILE F,V$IOSTAT_FILE I WHERE F.FILE#=I.FILE_NO AND FILETYPE_NAME='Data File';
其使用方法如下:
SQL> SET SERVEROUTPUT ON SQL> DECLARE lat INTEGER; iops INTEGER; mbps INTEGER; BEGIN -- DBMS_RESOURCE_MANAGER.CALIBRATE_IO (, , iops, mbps, lat); DBMS_RESOURCE_MANAGER.CALIBRATE_IO (2, 10, iops, mbps, lat); DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops); DBMS_OUTPUT.PUT_LINE ('latency = ' || lat); dbms_output.put_line('max_mbps = ' || mbps); end; / max_iops = 135540 max_mbps = 2593 latency = 0 PL/SQL procedure successfully completed.
上面的输出信息中的max_iops,说明IO子系统的每秒IO请求次数,latency,说明IO子系统的延迟是 ms。max_mbps,说明每少的最大处理能力是 MB。
在dbms_resource_manager.calibrate_io执行时可以查看其状态
SQL> select * from V$IO_CALIBRATION_STATUS; STATUS CALIBRATION_TIME ------------- ----------------------------- IN PROGRESS
在dbms_resource_manager.calibrate_io执行完后可以查看其结果
SQL> select * from DBA_RSRC_IO_CALIBRATE; START_TIME END_TIME MAX_IOPS MAX_MBPS MAX_PMBPS LATENCY NUM_PHYSICAL_DISKS ---------------------------------- -------------------------------- ---------- ---------- ---------- ---------- ------------------ 11-OCT-16 04.53.17.202399 PM 11-OCT-16 05.02.21.056682 PM 2643 388 39 8 2
这个功能相对于Oracle提供的Orion工具来说使用更简单,但它必须创建数据库并且在11g及以后版本才能使用。
参考文档:
http://docs.oracle.com/cd/E18283_01/server.112/e16638/iodesign.htm#insertedID3