Heim >Datenbank >MySQL-Tutorial >Oracle在Linux下使用异步IO配置

Oracle在Linux下使用异步IO配置

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:01:05974Durchsuche

在测试Oracle的时候,很想测试下使用异步IO的性能。但是异步IO是需要专门配置的,否则的话,容易遇到很著名的ldquo;ORA-01578:

在测试Oracle的时候,很想测试下使用异步IO的性能。但是异步IO是需要专门配置的,否则的话,容易遇到很著名的“ORA-01578: ORACLE data block corrupted (file # 202, block # 257)”的问题。

那么什么是异步IO呢,异步IO有什么好处?

一般说来,异步I/O是和同步I/O相比较来说的,如果是同步I/O,当一个I/O操作执行时,应用程序必须等待,直到此I/O执行完. 相反,异步I/O操作在后台运行,I/O操作和应用程序可以同时运行,提高了系统性能; 使用异步I/O会提高I/O流量,如果应用是对裸设备进行操作,这种优势更加明显, 因此象数据库,文件服务器等应用往往会利用异步I/O,使得多个I/O操作同时执行.

Oracle在默认情况是不使用异步IO的。可查看参数filesystemio_options(默认值为none),有四种选项

■ 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.

Oracle : 11.2.0.0.0

Linux:debian  2.6.18-6-amd64

具体步骤如下:


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

# aptitude search libaio
i   libaio-dev                                     - Linux kernel AIO access library - development files                                                    
i   libaio1                                           - Linux kernel AIO access library - shared library 

# aptitude install  libaio1 libaio-dev


2、在系统级支持异步I/O


Oracle建议将aio-max-nr的值设置为1048576或更高。

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


3、在数据库级启用异步I/O

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

SQL>alter system set filesystemio_options=setall scope=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


4、检查异步I/O是否在使用

    用以下命令即可检查异步IO是否在使用,,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

linux

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn