1.First we need to set up some NFS shares. In this case we will do this on the RAC1 node, but you can do the on a NAS or a third server if you have one available. On the RAC1 node create the following directories.
mkdir /shared_config
mkdir /shared_grid
mkdir /shared_home
mkdir /shared_data
Add the following lines to the "/etc/exports" file. 这个步骤控制着共享。只在主节点操作。
/shared_config *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_grid *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_home *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_data *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
2.Run the following command to export the NFS shares.
chkconfig nfs on
service nfs restart
On both RAC1 and RAC2 create the directories in which the Oracle software will be installed.
mkdir -p /software/app/11.2.0/grid
mkdir -p /software/app/oracle/product/11.2.0/db_1
mkdir -p /software/oradata
mkdir -p /software/shared_config
chown -R oracle:oinstall /software/app /software/app/oracle /software/oradata /software/shared_config
chmod -R 775 /software/app /software/app/oracle /software/oradata /software/shared_config
3.Add the following lines to the "/etc/fstab" file. #开机自动挂载
nas1:/shared_config /software/shared_config nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
nas1:/shared_grid /software/app/11.2.0/grid nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
nas1:/shared_home /software/app/oracle/product/11.2.0/db_1 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
nas1:/shared_data /software/oradata nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
4.Mount the NFS shares on both servers.
mount /software/shared_config
mount /software/app/11.2.0/grid
mount /software/app/oracle/product/11.2.0/db_1
mount /software/oradata
5.Make sure the permissions on the shared directories are correct.
chown -R oracle:oinstall /software/shared_config
chown -R oracle:oinstall /software/app/11.2.0/grid
chown -R oracle:oinstall /software/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /software/oradata
实际工作中的问题:RAC共享磁盘是利用的NFS
rac1: 192.168.3.21
rac2:192.168.3.26
[
oracle@rac1 ~]$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 142G 107G 29G 79% /
/dev/sda6 66G 48G 16G 76% /data
/dev/sda3 48G 20G 25G 45% /software
/dev/sda1 190M 14M 167M 8% /boot
tmpfs 16G 537M 16G 4% /dev/shm
/dev/mapper/mpath2 2.0T 2.0T 0G 100% /backup
/dev/mapper/oraclep1 1008G 661G 297G 70% /software/oradata01
rac1:/shared_grid 142G 107G 29G 79% /software/app/11.2.0/grid
rac1:/shared_home 142G 107G 29G 79% /software/app/oracle/product/11.2.0/db_1
rac1:/shared_config 142G 107G 29G 79% /software/shared_config
rac1:/shared_data 142G 107G 29G 79% /software/oradata
none 16G 128K 16G 1% /var/lib/xenstored
/dev/mapper/mpath3 2.0T 1.2T 645G 66% /software/oradata02
现在是/backup 这个目录已经满了 但是这个里面是要存逻辑备份的,
因为这个这个目录也是共享的,定时任务里的脚本路径好多都是写的/backup/expdp,所以要是不想一个一个去改脚本,最好的办法就是把一个新的文件系统挂在到/backup/expdp 这个目录下。下面是具体过程;
一:先把expdp重命名成expdp1 ,然后重新在/backup下建立expdp 目录。这步骤非常重要,因为如果你直接将一个新的文件系统挂在到/backup/expdp,就会导致原来/backup/expdp下面的内容就看不到了。
第二:把新加进的磁盘,创建成文件系统之后,
[
oracle@rac1 backup]$ mount /dev/mapper/mpath4 /backup/expdp
第三:然后把/backup/expdp1下所有内容mv到/backup/expdp下,这样就能满足不用修改脚本,空间也是足够的,以为这时候你虽然还是在/backup/expdp这个目录里写东西,但是底层文件系统已经改变。
但是这个时候还要让他共享。
[
oracle@rac1 backup]$ cat /etc/exports
#/software/oradata01 192.168.3.0/24(rw,sync,no_root_squash)
#/1TB 192.168.3.0/24(rw,sync,no_root_squash)
#/one 192.168.3.0/24(rw,sync,no_root_squash)
#/two 192.168.3.0/24(rw,sync,no_root_squash)
#/three 192.168.3.0/24(rw,sync,no_root_squash)
#/five 192.168.3.0/24(rw,sync,no_root_squash)
#/six 192.168.3.0/24(rw,sync,no_root_squash)
/shared_config *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_grid *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_home *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_data *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/software/oradata01 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/software/oradata02 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/backup 192.168.3.0/24(rw,sync,no_root_squash)
原来只是共享了/backup,
这时候你在 rac2只能看到有expdp这个目录,但是这下面没有任何内容。
[
oracle@rac2 ~]$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda2 76G 16G 57G 22% /
/dev/sda6 132G 87G 39G 69% /data
/dev/sda3 48G 23G 22G 52% /software
/dev/sda1 190M 20M 161M 11% /boot
tmpfs 16G 0 16G 0% /dev/shm
rac1:/shared_data 142G 107G 29G 79% /software/oradata
rac1:/shared_grid 142G 107G 29G 79% /software/app/11.2.0/grid
rac1:/software/oradata01
1008G 661G 297G 70% /software/oradata01
rac1:/shared_config 142G 107G 29G 79% /software/shared_config
rac1:/shared_home 142G 107G 29G 79% /software/app/oracle/product/11.2.0/db_1
none 16G 128K 16G 1% /var/lib/xenstored
rac1:/software/oradata02
2.0T 1.2T 645G 66% /software/oradata02
192.168.3.21:/backup 2.0T 1.3T 666G 66% /backup
怎样才可能让rac2也能看到内容呢? 如下所示:
1.首先在rac1操作: 将/backup/expdp也添加到共享文件中。
[
oracle@rac1 backup]$ vi /etc/exports
#/software/oradata01 192.168.3.0/24(rw,sync,no_root_squash)
#/1TB 192.168.3.0/24(rw,sync,no_root_squash)
#/one 192.168.3.0/24(rw,sync,no_root_squash)
#/two 192.168.3.0/24(rw,sync,no_root_squash)
#/three 192.168.3.0/24(rw,sync,no_root_squash)
#/five 192.168.3.0/24(rw,sync,no_root_squash)
#/six 192.168.3.0/24(rw,sync,no_root_squash)
/shared_config *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_grid *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_home *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/shared_data *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/software/oradata01 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/software/oradata02 *(rw,sync,no_wdelay,insecure_locks,no_root_squash)
/backup 192.168.3.0/24(rw,sync,no_root_squash)
/backup/expdp 192.168.3.0/24(rw,sync,no_root_squash)
2.重启nfs服务:
3,在rac2操作,重新挂载/backup
4,这时候就会发现能看到了。
-rw-r--r-- 1 oracle oinstall 2608 07-17 04:06 GLOBAL_DE_DE_150717-0405.log
-rw-r----- 1 oracle oinstall 471040 07-18 04:12 GLOBAL_DE_DE_150718-0411.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-18 04:12 GLOBAL_DE_DE_150718-0411.log
-rw-r----- 1 oracle oinstall 471040 07-19 04:10 GLOBAL_DE_DE_150719-0409.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-19 04:10 GLOBAL_DE_DE_150719-0409.log
-rw-r----- 1 oracle oinstall 471040 07-20 04:06 GLOBAL_DE_DE_150720-0404.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-20 04:06 GLOBAL_DE_DE_150720-0404.log
-rw-r----- 1 oracle oinstall 471040 07-21 04:16 GLOBAL_DE_DE_150721-0415.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-21 04:16 GLOBAL_DE_DE_150721-0415.log
-rw-r----- 1 oracle oinstall 471040 07-22 04:15 GLOBAL_DE_DE_150722-0413.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-22 04:15 GLOBAL_DE_DE_150722-0413.log
-rw-r----- 1 oracle oinstall 471040 07-23 04:07 GLOBAL_DE_DE_150723-0405.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-23 04:07 GLOBAL_DE_DE_150723-0405.log
-rw-r----- 1 oracle oinstall 471040 07-24 04:05 GLOBAL_DE_DE_150724-0404.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-24 04:05 GLOBAL_DE_DE_150724-0404.log
-rw-r----- 1 oracle oinstall 471040 07-25 04:12 GLOBAL_DE_DE_150725-0411.dmp
-rw-r--r-- 1 oracle oinstall 2608 07-25 04:12 GLOBAL_DE_DE_150725-0411.log
最好再设置成开机自动挂载:
[oracle@rac2 ~]$ cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
LABEL=/data /data ext3 defaults 1 2
LABEL=/software /software ext3 defaults 1 2
LABEL=/boot1 /boot ext3 defaults 1 2
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
LABEL=SWAP-sda5 swap swap defaults 0 0
# 192.168.3.21:/one /one nfs defaults 0 0
# 192.168.3.21:/1TB /1TB nfs defaults 0 0
# 192.168.3.21:/two /two nfs defaults 0 0
# 192.168.3.21:/three /three nfs defaults 0 0
# 192.168.3.21:/five /five nfs defaults 0 0
# 192.168.3.21:/six /six nfs defaults 0 0
rac1:/shared_config /software/shared_config nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
rac1:/shared_grid /software/app/11.2.0/grid nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
rac1:/shared_home /software/app/oracle/product/11.2.0/db_1 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
rac1:/shared_data /software/oradata nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
rac1:/software/oradata01 /software/oradata01 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0
192.168.3.21:/backup /backup nfs defaults 0 0 #这就开机自动挂载了
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29654823/viewspace-1769221/
,如需转载,请注明出处,否则将追究法律责任。