1、首先用root用户安装以下必要的rpm包

# rpm -Uvh libaio-0.3.106-3.2.x86_64.rpm
# rpm -Uvh libaio-devel-0.3.106-3.2.x86_64.rpm

2、在系统级支持异步I/O
  与[Note 225751.1]介绍的在RHEL3里面设置异步IO不同,不需要设置aio-max-size,而且'/proc/sys/fs'路径下也没有这个文件。因为从2.6 kernel开始,已经取消了对IO size的限制[Note 549075.1]。另外根据[Note 471846.1],Oracle建议将aio-max-nr的值设置为1048576或更高。

#echo > /proc/sys/fs/aio-max-nr 1048576

3、在数据库级启用异步I/O
  首先修改数据库参数。与[Note 225751.1]在RHEL 3里面设置异步IO不同,Oracle10gR2默认是打开了对异步IO的支持的,不需要重新编译数据库软件。在'$ORACLE_HOME/rdbms/lib'路径下,也没有'skgaioi.o'这个文件。在某些情况下,Oracle无法将IO行为或事件报告给操作系统[Note 365416.1],因此需要做以下操作。

这里开始换成oracle用户

SQL>alter system set disk_asynch_io=TRUE scope=spfile;

SQL>alter system setfilesystemio_options=asynchscope=spfile;

SQL>shutdown immediate
$ cd $ORACLE_HOME/rdbms/lib
$ ln -s /usr/lib/libaio.so.1 skgaio.o
$ make PL_ORALIBS=-laio -f ins_rdbms.mk async_on
SQL>startup

在Oracle10gR2中AIO默认已经是开启的了。可以通过ldd或者nm来检查oracle是否已经启用了AIO支持,有输出代表已经启用。

[oraprod@db01 ~]$/usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /usr/lib64/libaio.so.1 (0x00002aaaac4a9000)
[oraprod@db01 ~]$/usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
w io_getevents@@LIBAIO_0.4

4、检查异步I/O是否在使用
   根据[Note 370579.1],可以通过查看slabinfo统计信息查看操作系统中AIO是否运行,slab是Linux的内存分配器,AIO相关的内存结构已经分配,kiocb值的第二列和第三列非0即是已使用。与kernel 2.4.x不同,没有显示kiobuf,因为从kernel 2.5.43开始,kiobuf已经从内核中被移除。

$cat /proc/slabinfo | grep kio
kioctx 64 110 384 10 1 : tunables 54 27 8 : slabdata 11 11 0
kiocb 13 315 256 15 1 : tunables 120 60 8 : slabdata 21 21 44

我的实验过程:
[Oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Dec 17 10:37:10 2010
Copyright (c) 1982, 2005, Oracle.All rights reserved.

[oracle@localhost ~]$ /usr/bin/nm $ORACLE_HOME/bin/oracle | grep io_getevent
w io_getevents@@LIBAIO_0.4
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ /usr/bin/ldd $ORACLE_HOME/bin/oracle | grep libaio
libaio.so.1 => /usr/lib/libaio.so.1 (0x00507000)
[oracle@localhost ~]$ cat /proc/slabinfo | grep kio
kioctx1415256151 : tunables120600 : slabdata110
kiocb00128311 : tunables120600 : slabdata000
## 没有启用:
SQL> show parameter disk_asynch_io

NAMETYPE
------------------------------------ ----------------------
VALUE
------------------------------
disk_asynch_ioboolean
TRUE

SQL> sho parameter filesystemio_options

NAMETYPE
------------------------------------ ----------------------
VALUE
------------------------------
filesystemio_optionsstring
none
SQL>
SQL>
SQL> alter system set filesystemio_options = setallscope=both;
alter system set filesystemio_options = setallscope=both
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL>
SQL>alter system set filesystemio_options = setallscope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area285212672 bytes
Fixed Size1218992 bytes
Variable Size88082000 bytes
Database Buffers192937984 bytes
Redo Buffers2973696 bytes
Database mounted.
Database opened.
[root@localhost ~]# cat /proc/slabinfo | grep kio
kioctx1315256151 : tunables120600 : slabdata110
kiocb731128311 : tunables120600 : slabdata110

http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ch23_os.htm#sthref749

9.1.1.1Asynchronous I/O
With synchronous I/O, when an I/O request is submitted to the operating system, the writing process blocks until the write is confirmed as complete. It can then continue processing. With asynchronous I/O, processing continues while the I/O request is submitted and processed. Use asynchronous I/O when possible to avoid bottlenecks.

Some platforms support asynchronous I/O by default, others need special configuration, and some only support asynchronous I/O for certain underlying file system types.

9.1.1.2FILESYSTEMIO_OPTIONS Initialization Parameter
You can use theFILESYSTEMIO_OPTIONSinitialization parameter to enable or disable asynchronous I/O or direct I/O on file system files. This parameter is platform-specific and has a default value that is best for a particular platform. It can be dynamically changed to update the default setting.

FILESYTEMIO_OPTIONScan be set to one of the following values:

ASYNCH:enable asynchronous I/O on file system files, which has no timing requirement for transmission.

DIRECTIO:enable direct I/O on file system files, which bypasses the buffer cache.

SETALL:enable both asynchronous and direct I/O on file system files.

NONE:disable both asynchronous and direct I/O on file system files.

转自http://www.linuxidc.com/Linux/2012-08/67929p2.htm

最新文章

  1. NetMQ(一):zeromq简介
  2. MVC应用程序的生命周期图
  3. Yii2目录结构
  4. Oracle 查看表空间剩余与创建空间语法
  5. canvas画时钟
  6. 【C#学习笔记】函数调用
  7. Python流程控制语句(Control Flow)
  8. 获取局域网ip
  9. winform combobox控件绑定 分类: WinForm 2014-04-17 14:34 118人阅读 评论(0) 收藏
  10. PHP 调用微信JS-SDK 开发详解 [网摘]
  11. grep、egrep、fgrep的用法与特性详解
  12. Android Service 基础
  13. 解决 Popup 位置不随窗口移动更新的问题
  14. Android app内存管理的16点建议
  15. 基于TensorFlow的深度学习系列教程 1——Hello World!
  16. spring cloud 创建一个简单Eureka Server
  17. Spring Cloud与Spring Boot版本匹配关系
  18. python 中的流程控制语句
  19. 服务请求比较慢SYN flooding
  20. How can I move a MySQL database from one server to another?

热门文章

  1. Pie(二分POJ3122)
  2. 【20160924】GOCVHelper 图像增强部分(5)
  3. 花40分钟写一个-CBIR引擎-代码公开
  4. JAVA基础知识之多线程——线程的生命周期(状态)
  5. UVa 11624,两次BFS
  6. 更新yum源
  7. 通过PowerShell查询本机IP地址
  8. #在lua中的运用
  9. C语言中的库是什么
  10. BZOJ 1855 股票交易(单调队列优化DP)