Oracle在Linux下使用非同步IO配置

來源:互聯網
上載者:User

在測試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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.