[原]Oracle 11g Direct NFS Client 尝鲜
这个新特性就不多介绍了,单刀直入说如何配置吧。
挂载NFS到指定目录
这一步和平时挂在NFS没有区别,也不多说了,通常的命令是:
mount <NFS-SERVER-IP>:<EXPORT-LOCATION> <LOCAL-MOUNT-LOCATION> ### exmple ### mount 192.168.0.203:/nfs/vol01 /nfs/test03/vol01/
替换ODM
简单来说就是更改 $ORACLE_HOME/lib/libodm11.so 的指向:
[root@test01 ~]# su - oracle [oracle@test01 ~]$ cd $ORACLE_HOME/lib [oracle@test01 lib]$ ll *odm* -rw-r--r-- 1 oracle oradba 60487 Sep 4 21:46 libnfsodm11.so -rw-r--r-- 1 oracle oradba 7426 Sep 4 21:40 libodm11.a lrwxrwxrwx 1 oracle oradba 12 Nov 20 22:15 libodm11.so -> libodmd11.so -rw-r--r-- 1 oracle oradba 12315 Sep 4 21:46 libodmd11.so [oracle@test01 lib]$ rm -rf libodm11.so [oracle@test01 lib]$ ln -s libnfsodm11.so libodm11.so [oracle@test01 lib]$ ll *odm* -rw-r--r-- 1 oracle oradba 60487 Sep 4 21:46 libnfsodm11.so -rw-r--r-- 1 oracle oradba 7426 Sep 4 21:40 libodm11.a lrwxrwxrwx 1 oracle oradba 14 Nov 21 12:25 libodm11.so -> libnfsodm11.so -rw-r--r-- 1 oracle oradba 12315 Sep 4 21:46 libodmd11.so
设置Direct NFS Client
先思考一个问题:Oracle是如何知道哪个目录挂载了NFS呢?答案是以下这三个文件中的一个:
1。$ORACLE_HOME/dbs/oranfstab
2。/etc/oranfstab
3。/etc/mtab
注意,只有开始的两个文件可以设置高级属性。
oranfstab这个文件可设置的属性不多,“满配”也就是如下几行:
server: test03 + NFS Server Name local: 192.168.0.201 + local: 192.168.0.211 | NFS Client 可以用于连接的接口地址 local: 192.168.0.221 | local: 192.168.0.231 + path: 192.168.0.203 + path: 192.168.0.213 | NFS Server 可以用于连接的接口地址 path: 192.168.0.223 | path: 192.168.0.233 + dontroute + 出站信息是否经过OS进行转换 export: /nfs/vol01 mount: /nfs/test03/vol01 + export: /nfs/vol02 mount: /nfs/test03/vol02 | 参考OS挂载NFS的那些参数 export: /nfs/vol03 mount: /nfs/test03/vol03 +
如果有多台NFS Server可供挂载的话,重复上面几行就是了。本文中NFS Server 和 NFS Client都有4张千兆网卡可用于通信,所以都写进去了。
最后再设置一下NFS buffer,修改 /etc/filesystems 在最后加上这一段:
/nfs/test03/vol01: dev = "/nfs/test03/vol01" vfs = nfs nodename = test03 mount = true options = bg,soft,intr,rsize=32768,wsize=32768 account = false
主要的作用是修改 rsize 和 wsize 这两个参数。
现在可以看一下我们的成果了,我对数据库做了一个比较大的I/O操作(当然这些I/O是落在NFS的挂载点上面了)SQL如下:
create table tab01 ( id int, f01 varchar(50), f02 varchar(50), f03 varchar(50) ); insert /*+ append parallel(tab01 4) */ into tab01 select level id , lpad(level,30,'0') f01, rpad(level,30,'0') f02, 'killkill' f03 from dual connect by level<500000; -- 多次运行如下语句: insert /*+ append parallel(tab01 4) */ into tab01 select /*+ parallel(tab01 4) */ * from tab01 ; commit;
通过如下命令粗略地看到Direct NFS Client的工作情况:
[root@test01 ~]# netstat -anop | grep 192.168.0.2 tcp 0 0 192.168.0.201:1000 192.168.0.203:2049 ESTABLISHED - off (0.00/0/0) tcp 0 0 192.168.0.211:36055 192.168.0.213:2049 ESTABLISHED 24790/ora_p000_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:37732 192.168.0.233:2049 ESTABLISHED 24794/ora_p002_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:41525 192.168.0.223:2049 ESTABLISHED 24792/ora_p001_ORCL off (0.00/0/0) tcp 0 0 192.168.0.201:42341 192.168.0.203:2049 ESTABLISHED 24792/ora_p001_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:41739 192.168.0.233:2049 ESTABLISHED 23064/ora_ckpt_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:46069 192.168.0.223:2049 ESTABLISHED 23060/ora_dbw0_ORCL off (0.00/0/0) tcp 0 0 192.168.0.211:45719 192.168.0.213:2049 ESTABLISHED 23064/ora_ckpt_ORCL off (0.00/0/0) tcp 0 0 192.168.0.211:45685 192.168.0.213:2049 ESTABLISHED 23060/ora_dbw0_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:46316 192.168.0.223:2049 ESTABLISHED 24790/ora_p000_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:46570 192.168.0.233:2049 ESTABLISHED 24792/ora_p001_ORCL off (0.00/0/0) tcp 0 0 192.168.0.211:48340 192.168.0.213:2049 ESTABLISHED 24794/ora_p002_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:45238 192.168.0.233:2049 ESTABLISHED 23844/oracleORCL off (0.00/0/0) tcp 0 0 192.168.0.201:48218 192.168.0.203:2049 ESTABLISHED 24794/ora_p002_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:50140 192.168.0.223:2049 ESTABLISHED 23064/ora_ckpt_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:50059 192.168.0.223:2049 ESTABLISHED 23844/oracleORCL off (0.00/0/0) tcp 0 0 192.168.0.231:52108 192.168.0.233:2049 ESTABLISHED 24796/ora_p003_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:49971 192.168.0.233:2049 ESTABLISHED 24790/ora_p000_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:54444 192.168.0.223:2049 ESTABLISHED 24794/ora_p002_ORCL off (0.00/0/0) tcp 0 0 192.168.0.221:54356 192.168.0.223:2049 ESTABLISHED 24796/ora_p003_ORCL off (0.00/0/0) tcp 0 0 192.168.0.201:56182 192.168.0.203:2049 ESTABLISHED 24790/ora_p000_ORCL off (0.00/0/0) tcp 0 0 192.168.0.211:56334 192.168.0.213:2049 ESTABLISHED 23844/oracleORCL off (0.00/0/0) tcp 0 0 192.168.0.211:56139 192.168.0.213:2049 ESTABLISHED 24792/ora_p001_ORCL off (0.00/0/0) tcp 0 0 192.168.0.201:57118 192.168.0.203:2049 ESTABLISHED 23064/ora_ckpt_ORCL off (0.00/0/0) tcp 0 0 192.168.0.201:57151 192.168.0.203:2049 ESTABLISHED 23060/ora_dbw0_ORCL off (0.00/0/0) tcp 0 0 192.168.0.211:58852 192.168.0.213:2049 ESTABLISHED 24796/ora_p003_ORCL off (0.00/0/0) tcp 0 0 192.168.0.201:58599 192.168.0.203:2049 ESTABLISHED 23844/oracleORCL off (0.00/0/0) tcp 0 0 192.168.0.201:59647 192.168.0.203:2049 ESTABLISHED 24796/ora_p003_ORCL off (0.00/0/0) tcp 0 0 192.168.0.231:58527 192.168.0.233:2049 ESTABLISHED 23060/ora_dbw0_ORCL off (0.00/0/0)
可以看到本地的网卡和NFS Server的所有网卡都参与了通信。