The `nocache` tool tries to minimize the effect an application has on
the Linux file system cache. This is done by intercepting the `open`
and `close` system calls and calling `posix_fadvise` with the
`POSIX_FADV_DONTNEED` parameter. Because the library remembers which
pages (ie., 4K-blocks of the file) were already in file system cache
when the file was opened, these will not be marked as "don't need",
because other applications might need that, although they are not
actively used (think: hot standby).
Use case: backup processes that should not interfere with the present
state of the cache.
6.简朴测试:
SCOTT@book01p> select rowid,dept.* from dept;
ROWID DEPTNO DNAME LOC
------------------ ---------- ------------------------------ -------------
AAASmfAAMAAAACDAAA 10 ACCOUNTING NEW YORK
AAASmfAAMAAAACDAAB 20 RESEARCH DALLAS
AAASmfAAMAAAACDAAC 30 SALES CHICAGO
AAASmfAAMAAAACDAAD 40 OPERATIONS BOSTON
SCOTT@book01p> @ rowid AAASmfAAMAAAACDAAA
DATA_OBJECT_ID FILE BLOCK ROW ROWID_DBA DBA TEXT
-------------- ---------- ---------- ---------- -------------------- -------------------- --------------------------------------------------
76191 12 131 0 0x3000083 12,131 alter system dump datafile 12 block 131 ;
--//rowid=AAASmfAAMAAAACDAAA,在dba=12,131。
SCOTT@book01p> select * from dept where rowid='AAASmfAAMAAAACDAAA';
DEPTNO DNAME LOC
---------- ------------------------------ -------------
10 ACCOUNTING NEW YORK
SYS@book> alter system flush BUFFER_CACHE;
System altered.
SYS@book> alter system flush BUFFER_CACHE;
System altered.
SYS@book01p> alter system flush BUFFER_CACHE;
System altered.
SYS@book01p> alter system flush BUFFER_CACHE;
System altered.
$ cachestats -v /u01/oradata/BOOK/book01p/users01.dbf | head -6
/u01/oradata/BOOK/book01p/users01.dbf pages in cache: 112/128962 (0.1%) [filesize=515848.0K, pagesize=4K]
--//FILESYTEMIO_OPTIONS can be set to one of the following values:
--//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。
--//测试filesystemio_options=DIRECTIO的情况:
SYS@book> alter system set filesystemio_options=DIRECTIO scope=spfile;
System altered.