Posted in 2017

dNFS Oracle 12.2

First let’s check my disks.

[root@nfs01 ~]# lsblk
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 19.5G 0 part
├─ol-root 252:0 0 17.5G 0 lvm /
└─ol-swap 252:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 30G 0 disk
└─sdb1 8:17 0 30G 0 part
└─vg_oracle-product 252:2 0 20G 0 lvm /u01
sdc 8:32 0 50G 0 disk
sr0 11:0 1 1024M 0 rom

As we see my sdc is not used, so we can partition it

[root@nfs01 ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x592b4f7f.

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Make a filesystem on this device

[root@nfs01 ~]# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=4, agsize=3276736 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0
data = bsize=4096 blocks=13106944, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=6399, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

Small preparations
[root@nfs01 ~]# mkdir /oraclenfs
[root@nfs01 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),982(vboxsf)
[root@nfs01 ~]# cat /etc/fstab
/dev/mapper/ol-root / xfs defaults 0 0
UUID=52f425c5-8649-49e7-a899-b68ff9d75451 /boot xfs defaults 0 0
/dev/mapper/ol-swap swap swap defaults 0 0
/dev/mapper/vg_oracle-product /u01 xfs defaults 0 0
/dev/sdc1 /oraclenfs xfs defaults 0 0
[root@nfs01 ~]# mount -a
[root@nfs01 ~]#
[root@nfs01 ~]#
[root@nfs01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ol-root 18G 8.6G 8.9G 50% /
devtmpfs 987M 0 987M 0% /dev
tmpfs 1002M 84K 1002M 1% /dev/shm
tmpfs 1002M 8.9M 993M 1% /run
tmpfs 1002M 0 1002M 0% /sys/fs/cgroup
/dev/mapper/vg_oracle-product 20G 4.2G 16G 21% /u01
/dev/sda1 497M 287M 211M 58% /boot 4.8T 2.3T 2.6T 47% /media/sf_12.2.0.1
tmpfs 201M 16K 201M 1% /run/user/42
tmpfs 201M 0 201M 0% /run/user/0
/dev/sdc1 50G 33M 50G 1% /oraclenfs
[root@nfs01 ~]# chown 54321:54321 /oraclenfs/
[root@nfs01 ~]# cat /etc/exports
/oraclenfs *(rw,sync,all_squash,insecure,anonuid=54321,anongid=54321)
[root@nfs01 ~]# chkconfig --level 345 nfs on
Note: Forwarding request to 'systemctl enable nfs.service'.
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/nfs-server.service.
[root@nfs01 ~]# service nfs start
Redirecting to /bin/systemctl start nfs.service
[root@nfs01 ~]# systemctl status nfs
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (exited) since Tue 2017-03-07 13:49:12 CET; 9s ago
Process: 2097 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 2096 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 2097 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nfs-server.service

Mar 07 13:49:12 systemd[1]: Starting NFS server and servic....
Mar 07 13:49:12 systemd[1]: Started NFS server and services.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ora01 ~]# mkdir -p /dnfs/oradata
[root@ora01 ~]# chown -R oracle:dba /dnfs/oradata/
[root@ora01 oradata]$ grep nfs /etc/fstab /dnfs/oradata nfs rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600 0 0
[oracle@ora01 oradata]$ cat /u01/app/oracle/product/
export: /oraclenfs mount: /dnfs/oradata

Relink the Oracle Home!
[oracle@ora01 ~]$ . oraenv
ORACLE_SID = [oracle] ?
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/
The Oracle base has been set to /u01/app/oracle
[oracle@ora01 ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@ora01 lib]$ make -f /u01/app/oracle/product/ dnfs_on ORACLE_HOME=/u01/app/oracle/product/

Now you can create a database with dbca, don’t forget to set filesystem_options=setall and you use dnfs. In the alert.log will be a message under this text displayed, this means you have it done successfully.

[oracle@ora01 trace]$ grep Direct alert_cdb1.log
Oracle instance running with ODM: Oracle Direct NFS ODM Library Version 4.0
Direct NFS: channel id [0] path [] to filer [] via local [] is UP