#DFNS表空间技术
#首先配置nfs
#安装数据库的服务器地址
192.168.18.101
#版本信息
[root@oracle ~]# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description: Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
Release: 5.4
Codename: Carthage
#另一台地址(可以看做客户端)
192.168.18.111
#版本信息
[root@localhost oradata]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
配置192.168.18.101
mkdir /u01/app/oranfs
#root用户执行
vi /etc/exports
/u01/app/oranfs 192.168.18.0/255.255.255.0(rw)
#启动nfs
[root@oracle ~]# service portmap start
Starting portmap: [ OK ]
[root@oracle ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
设置开启服务启动
chkconfig nfs on
[root@oracle ~]# chkconfig nfs --list
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
服务器端查看共享目录
[root@oracle ~]# exportfs
/u01/app/oranfs
192.168.18.0/255.255.255.0
[root@oracle ~]# showmount -e
Export list for oracle.cuug.com:
/u01/app/oranfs 192.168.18.0/255.255.255.0
######################################################################
配置客户端 192.168.18.111
启动nfs
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap
[root@localhost ~]# showmount -e 192.168.18.101
Export list for 192.168.18.101:
/u01/app/oranfs 192.168.18.0/255.255.255.0
mkdir -p /u02/app/oradata
#把服务器目录挂载到客户机
mount 192.168.18.101:/u01/app/oranfs /u02/app/oradata
#192.168.18.111
[root@localhost oradata]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 1.5G 17G 9% /
devtmpfs 904M 0 904M 0% /dev
tmpfs 913M 0 913M 0% /dev/shm
tmpfs 913M 8.7M 904M 1% /run
tmpfs 913M 0 913M 0% /sys/fs/cgroup
/dev/sda1 297M 113M 185M 38% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/sr0 3.8G 3.8G 0 100% /mnt/dev
192.168.18.101:/u01/app/oranfs 25G 5.8G 18G 26% /u02/app/oradata
#192.168.18.101
[root@oracle ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.4G 6.9G 26% /
/dev/sda3 25G 5.8G 18G 26% /u01
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/hdc 3.8G 3.8G 0 100% /mnt/dev
可以看到/u01大小为25G.配置成功
测试一下,在Oracle服务器端新建一个文件,看客户机是否有
192.168.18.101
[root@oracle ~]# cd /u01/app/oranfs/
[root@oracle oranfs]# ll
total 0
[root@oracle oranfs]# touch lsn
192.168.18.111
[root@localhost ~]# cd /u02/app/oradata/
[root@localhost oradata]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 9 2018 lsn
######################################################################
开始配置DFNS
关闭数据库实例
[root@oracle ~]# vi /etc/oranfstab
server:MydataServer
local:192.168.18.101
path:192.168.18.111
export: /u01/app/oranfs mount: /u02/app/oradata
#enable 启用
[oracle@oracle ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@oracle 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
#在192.168.18.101创建一个表空间
SYS@PROD>create tablespace lfn_nfs datafile '/u01/app/oranfs/lfn_nfs.dbf' size 10M;
Tablespace created.
#在192.168.18.111上可以看到创建的数据文件
[root@localhost oradata]# ll
total 10264
-rw-r-----. 1 501 501 10493952 Oct 9 2018 lfn_nfs.dbf
-rw-r--r--. 1 root root 0 Oct 9 2018 lsn
系统默认已经安装了nfs服务,如果没有安装。配置yum安装就好