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:
mkdir -p /u01/nfs_orcl2
Em seguida, exportei o diretório no arquivo export localizado no diretório /etc com os seguintes valores abaixo:
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:
[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:
mkdir -p /u01/nfs_oradata_orcl2
Em seguida, configurei 3 arquivos:
- $ORACLE_HOME/dbs/oranfstab, com o seguinte valor:
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:
/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:
# # /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:
mount /u01/nfs_oradata_orcl2
Verificando se mountou corretamente:
[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:
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:
[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:
[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:
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:
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..