异步IO之filesystemio_options参数
近日再跟一个老DBA聊天的时候,听说了一个关于异步IO的参数。于是带着些许的好奇,异步I/O也就意味着读写可同时进行。
于是回来查看了一下这个参数,实验了一下。
在未安装oracle的linux服务器查看
Last login: Fri Jun 5 16:09:07 2015 from 10.53.105.3
[root@master ~]# grep kio /proc/slabinfo
kioctx 0 0 384 10 1 : tunables 54 27 0 : slabdata 0 0 0
kiocb 0 0 256 15 1 : tunables 120 60 0 : slabdata 0 0 0
看到kiocb行显示为0,说明异步IO没有启动。
?
实验前,先到官方文档查一下:

ASYNCH: enable asynchronous I/O on file system files, which has no timing requirement for transmission.
在文件系统文件上启用异步I/O,在数据传送上没有计时要求。
DIRECTIO: enable direct I/O on file system files, which bypasses the buffer cache.
在文件系统文件上启用直接I/O,绕过buffer cache。
SETALL: enable both asynchronous and direct I/O on file system files.
在文件系统文件上启用异步和直接I/O。
NONE: disable both asynchronous and direct I/O on file system files.
在文件系统文件上禁用异步和直接I/O。
?
实验:oracle开启异步I/O
?
环境:oracle11.2.0.4 64bit
?
[root@xckydb ~]# grep kio /proc/slabinfo
kioctx 23 36 320 12 1 : tunables 54 27 8 : slabdata 3 3 0
kiocb 0 0 256 15 1 : tunables 120 60 8 : slabdata 0 0 0
SQL> show parameter file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options string none
ifile file
log_file_name_convert string
max_dump_file_size string unlimited
remote_login_passwordfile string EXCLUSIVE
session_max_open_files integer 10
spfile string /u01/app/oracle/product/11.2.0
/db_1/dbs/spfilexcky.ora
standby_file_management string MANUAL
tracefile_identifier string
utl_file_dir string
SQL> alter system set filesystemio_options=setall
2 ;
alter system set filesystemio_options=setall
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
报错了,这个参数不可以在线修改。这应该是个静态参数!我们设置参数文件,重启数据库。
SQL> alter system set filesystemio_options=setall scope=spfile;
System altered.
?
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
?
Total System Global Area 839282688 bytes
Fixed Size 2257880 bytes
Variable Size 507513896 bytes
Database Buffers 327155712 bytes
Redo Buffers 2355200 bytes
Database mounted.
Database opened.
SQL> show parameter filesystemio_options
?
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options string SETALL
设置已经生效了。
到linux系统下,查看异步IO情况。
[root@xckydb ~]# grep kio /proc/slabinfo
kioctx 24 36 320 12 1 : tunables 54 27 8 : slabdata 3 3 0
kiocb 12 60 256 15 1 : tunables 120 60 8 : slabdata 4 4 0
看到kiocb已经有数据值了,说明异步IO已经生效了。
?
但是,在生产集群环境下查看时,没有开启异步参数,而在linux系统层面查看时,异步IO是启动的。这么说的话,并不是跟上面的实验完全一致。
在某生成环境下查看,如下:
[root@xzxdb1 ~]# grep kio /proc/slabinfo
kioctx 210 280 384 10 1 : tunables 54 27 8 : slabdata 28 28 0
kiocb 15 30 256 15 1 : tunables 120 60 8 : slabdata 2 2 0
?
SQL> show parameter file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flash_cache_file string
db_recovery_file_dest string +OCR_ARCH
db_recovery_file_dest_size big integer 4407M
db_securefile string PERMITTED
dg_broker_config_file1 string /u01/app/oracle/product/11.2.0
/db_1/dbs/dr1xzxt.dat
dg_broker_config_file2 string /u01/app/oracle/product/11.2.0
/db_1/dbs/dr2xzxt.dat
file_mapping boolean FALSE
fileio_network_adapters string
filesystemio_options string none
可以看到这个集群生产环境下的filesystemio_options参数设置是none,但是