
Tablespace que utiliza data files criados com NFS, já ouviu falar? Caso contrário, agora irá pelo menos saber do que se trata. Uma vez que neste post eu estarei abortado a criação de uma tablespace utilizando um file system do tipo NFS . Para isso, criei 2 servidores com 1 banco de dados localizado em um deles:
- Ambiente 1: orcl.localdomain
- Ambiente 2: orcl2.localdomain orcl1
No ambiente 1 criei o seguinte diretório:
1 | mkdir -p /u01/nfs_orcl2 |
Em seguida, exportei o diretório no arquivo export localizado no diretório /etc com os seguintes valores abaixo:
1 2 | vi /etc/exports /u01/nfs_orcl2 *(rw,sync,all_squash,insecure,anonuid=501,anongid=501) |
É importante ressaltar que os valores de anonuid e anongid são respectivamente o UID e o GID do usuário owner do software de banco de dados do ambiente.
Após isso, reiniciei o serviço de NFS do ambiente:
1 2 3 4 5 6 7 8 9 10 | [root@orcl ~]# service nfs restart Shutting down NFS daemon: [ OK ] Shutting down NFS mountd: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] [root@orcl ~]# [ OK ] |
Nesta etapa é finalizada a configuração para o ambiente 1.
No ambiente 2, criei o seguinte diretório onde será montado o NFS file system exportado:
1 | mkdir -p /u01/nfs_oradata_orcl2 |
Em seguida, configurei 3 arquivos:
- $ORACLE_HOME/dbs/oranfstab, com o seguinte valor:
1 2 3 | server: orcl.localdomain path: 192.168.56.71 local: 192.168.56.72 |
- /etc/mtab adicionando o conteúdo (orcl.localdomain:/u01/nfs_orcl2 /u01/nfs_oradata_orcl2 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768) do NFS a ser montado:
1 2 3 4 5 6 7 8 9 10 11 12 | /dev/mapper/vg_orcl-lv_root / ext4 rw 0 0 proc /proc proc rw 0 0 sysfs /sys sysfs rw 0 0 devpts /dev/pts devpts rw,gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs rw,rootcontext="system_u:object_r:tmpfs_t:s0" 0 0 /dev/sda1 /boot ext4 rw 0 0 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0 sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0 Orcl /media/sf_Orcl vboxsf gid=492,rw 0 0 gvfs-fuse-daemon /home/oracle/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=oracle 0 0 /dev/sr0 /media/VBOXADDITIONS_5.1.10_112026 iso9660 ro,nosuid,nodev,uhelper=udisks,uid=501,gid=501,iocharset=utf8,mode=0400,dmode=0500 0 0 orcl.localdomain:/u01/nfs_orcl2 /u01/nfs_oradata_orcl2 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768</ strong > |
- /etc/fstab também conteúdo (orcl.localdomain:/u01/nfs_orcl2 /u01/nfs_oradata_orcl2 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768) do NFS a ser montado:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # /etc/fstab # Created by anaconda on Thu Jan 26 06:32:24 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/vg_orcl-lv_root / ext4 defaults 1 1 UUID=ad8625eb-dac7-4e66-897e-86d43466ff27 /boot ext4 defaults 1 2 /dev/mapper/vg_orcl-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 orcl.localdomain:/u01/nfs_orcl2 /u01/nfs_oradata_orcl2 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768</ strong > |
Montando o NFS:
1 | mount /u01/nfs_oradata_orcl2 |
Verificando se mountou corretamente:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [root@orcl2 ~]# mount /dev/mapper/vg_orcl-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) Orcl on /media/sf_Orcl type vboxsf (gid=492,rw) gvfs-fuse-daemon on /home/oracle/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=oracle) /dev/sr0 on /media/VBOXADDITIONS_5.1.10_112026 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=501,gid=501,iocharset=utf8,mode=0400,dmode=0500) orcl.localdomain:/u01/nfs_orcl2 on /u01/nfs_oradata_orcl2 type nfs (rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,addr=192.168.56.71) [root@orcl2 ~]# |
Efetuando um shudown na base de dados:
1 2 3 4 5 6 7 8 9 10 11 | Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. |
Ativando os serviços do DNFS para o banco de dados:
1 2 3 4 5 | [oracle@orcl2 bin]$ cd $ORACLE_HOME/rdbms/lib [oracle@orcl2 lib]$ make -f ins_rdbms.mk dnfs_on rm -f /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so; cp /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnfsodm11.so /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so [oracle@orcl2 lib]$rm -f /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so; [oracle@orcl2 lib]$cp /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnfsodm11.so /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so |
Inicializando a base de dados novamente:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [oracle@orcl2 lib]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 30 14:33:59 2017 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 467652608 bytes Fixed Size 2229424 bytes Variable Size 146803536 bytes Database Buffers 314572800 bytes Redo Buffers 4046848 bytes Database mounted. Database opened. |
Verifique o alert.log da respectiva base de dados para verificar se os serviços foram ativados:
1 2 3 4 5 6 7 8 9 10 | Oracle instance running with ODM: Oracle Direct NFS ODM Library Version 3.0 Mon Jan 30 14:26:09 2017 PMON started with pid=2, OS id=3051 Mon Jan 30 14:26:09 2017 PSP0 started with pid=3, OS id=3053 Mon Jan 30 14:26:10 2017 VKTM started with pid=4, OS id=3055 at elevated priority VKTM running at (1)millisec precision with DBRM quantum (100)ms Mon Jan 30 14:26:10 2017 GEN0 started with pid=5, OS id=3059 |
Prosseguindo com a criação da tablespace:
1 2 3 | SQL> CREATE TABLESPACE orcl2nfs2 DATAFILE '/u01/nfs_oradata_orcl2/orcl2nfs2.dbf' SIZE 1M; Tablespace created. |
Após a criação da tablespace utilizando o NFS montado, você poderá visualizar as informações sobre o mesmo nas views V$DNFS_FILES e V$DNFS_SERVERS.

Hi! I am Bruno, a Brazilian born and bred, and I am also a naturalized Swedish citizen. I am a former Oracle ACE and, to keep up with academic research, I am a Computer Scientist with an MSc in Data Science and another MSc in Software Engineering. I have over ten years of experience working with companies such as IBM, Epico Tech, and Playtech across three different countries (Brazil, Hungary, and Sweden), and I have joined projects remotely in many others. I am super excited to share my interests in Databases, Cybersecurity, Cloud, Data Science, Data Engineering, Big Data, AI, Programming, Software Engineering, and data in general.
(Continue reading)
Great article. I will be going through many of these issues as well..