如果使用了多路径,安装GI及dbca建库时,需要输入/dev/mapper/mapatha等路径,但默认情况下由于权限问题,oracle无法找到这些路径。
如下是设置多路径权限的三种方法:


查看有哪些dm设备:
ll /dev/mapper
lrwxrwxrwx 1 root root 7 Jul 24 15:51 Fra01 -> ../dm-6
lrwxrwxrwx 1 root root 7 Jul 24 15:51 OCR01 -> ../dm-0
lrwxrwxrwx 1 root root 7 Jul 24 15:51 OCR02 -> ../dm-4
lrwxrwxrwx 1 root root 7 Jul 24 15:51 OCR03 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jul 24 15:51 data01 -> ../dm-7
lrwxrwxrwx 1 root root 7 Jul 24 15:51 data02 -> ../dm-3
lrwxrwxrwx 1 root root 7 Jul 24 15:51 redolog01 -> ../dm-5
lrwxrwxrwx 1 root root 7 Jul 24 15:51 redolog02 -> ../dm-2
--/dev/mapper下的设备无法修改属主、数组

ll /dev/dm*
brw-rw---- 1 root disk 252, 0 7月 24 13:45 /dev/dm-0
brw-rw---- 1 root disk 252, 1 7月 24 13:45 /dev/dm-1
brw-rw---- 1 root disk 252, 2 7月 24 13:45 /dev/dm-2
brw-rw---- 1 root disk 252, 3 7月 24 13:45 /dev/dm-3
brw-rw---- 1 root disk 252, 4 7月 24 13:45 /dev/dm-4
brw-rw---- 1 root disk 252, 5 7月 24 13:45 /dev/dm-5
brw-rw---- 1 root disk 252, 6 7月 24 13:45 /dev/dm-6
brw-rw---- 1 root disk 252, 7 7月 24 13:45 /dev/dm-7
--/dev/dm* 等设备可以修改属主、属组,可直接修改,但GI脚本运行时,又会修改成默认的属主属组:root.disk

 


方法1. 在/etc/udev/rules.d/中添加文件,格式如下:
vi /etc/udev/rules.d/99-asm.rules
KERNEL=="dm-0", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="dm-1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="dm-2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="dm-3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="dm-4", OWNER="grid", GROUP="asmadmin", MODE="0660"

或添加99-oracle-asmdevices.rules内容如下:
KERNEL=="dm-[0-7]", OWNER="oracle", GROUP="oinstall", MODE="660"

 


方法2. /etc/udev/rules.d下建文件,文件内容是:
ACTION!="add|change", GOTO="dm_end"
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
ENV{DM_NAME}=="mpath*", OWNER:="grid", GROUP:="oinstall", MODE:="660"
# Set permissions for a DM device named 'my_device' exactly
# ENV{DM_NAME}=="my_device", OWNER:="root", GROUP:="root", MODE:="660"
# MULTIPATH DEVICES
#
# Set permissions for all multipath devices
# ENV{DM_UUID}=="mpath-?*", OWNER:="root", GROUP:="root", MODE:="660"

# Set permissions for first two partitions created on a multipath device (and detected by kpartx)
# ENV{DM_UUID}=="part[1-2]-mpath-?*", OWNER:="root", GROUP:="root", MODE:="660"

LABEL="dm_end"


方法3. 裸设备 未测试
raw /dev/raw/raw1 /dev/mapper/data01
chown oracle:oinstall /dev/raw/raw*
chmod 777 /dev/raw/raw*


方法1、2有点像10g RAC时的配置文件:
cat /etc/udev/rules.d/99-raw.rules
KERNEL=="raw[1-2]*", OWNER="root", GROUP="oinstall", MODE="640"
KERNEL=="raw[3-5]*", OWNER="oracle", GROUP="oinstall", MODE="660"


设置完重启操作系统后,再次使用ll /dev/dm* 命令查看权限,可以看到权限已变成以上设置的权限,安装GI及dbca建库时,需要输入/dev/mapper/mapatha等路径就可以顺利安装了