Oracle rac配置asm共享磁盘
测试环境
本机测试环境centos 7 ,vmware workstation 15添加磁盘4个共享磁盘,搭建oracle19c rac
如果是虚拟机,要编辑vmx文件加入disk.EnableUUID =“TRUE” 否则无法查到磁盘的uuid,也就无法在配置文件中绑定。
单路径下配置的两种方法
1 uedv
分区初始化
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdb
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdd
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sde
udev映射
for i in b c d e ;
do
echo "KERNEL==\"sd?1\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d /dev/\$parent\", RESULT==\"`/usr/lib/udev/scsi_id -g -u -d /dev/sd\$i`\", SYMLINK+=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
将上面生成的内容添加到如下文件里面
vim /etc/udev/rules.d/99-oracle-asmdevices.rules
(也可不分区)
for i in b c d e ;
do
echo "KERNEL==\"sd?\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d /dev/\$name\", RESULT==\"`/usr/lib/udev/scsi_id -g -u -d /dev/sd\$i`\", SYMLINK+=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
--udevadm配置重载生效:
udevadm control --reload
udevadm trigger
或者
/sbin/udevadm trigger --type=devices --action=change
--确认udev绑定成功,已生成绑定后的设备:
ls -ltr /dev/asm-disk*
--再将/etc/udev/rules.d/99-oracle-asmdevices.rules拷贝到另一节点,并执行使其生效。
partprobe /dev/sdb
partprobe /dev/sdc
partprobe /dev/sdd
partprobe /dev/sde
或
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdb
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdd
echo -e "n\np\n1\n\n\nw" | fdisk /dev/sde
-udevadm配置重载生效:
udevadm control --reload
udevadm trigger
确认udev已绑定成功:
ll /dev/asm*
如果没生效,请检查两个磁盘uuid是否一致
2 asmlib创建
asmlib是oracle提供的软件,需要下载安装asm的三个rpm软件包
yum install kmod-oracleasm
rpm -ivh oracleasmlib-2.0.12-1.el6.x86_64.rpm
rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
oracleasm configure -i
oracleasm configure
oracleasm init
虚拟机2
注:如果已开启则重启
Root用户:
# oracleasm configure -I
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@rac2 ~]# oracleasm listdisks
[root@rac2 ~]# oracleasm init
init 6
多路径配置
lsblk
取得DM_UUID
/usr/lib/udev/scsi_id -g -u -d /dev/mapper/mpatha
cd /dev/mapper
for i in `ls mpath*`;
do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |grep -i dm_uuid)";
done
生成rules文件
vim /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa07e5eab800000005",SYMLINK+="asm_crs1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa07e613a500000006",SYMLINK+="asm_crs2",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa07e6234100000007",SYMLINK+="asm_crs3",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36e483261006449fa07e650a100000008",SYMLINK+="asm_data",OWNER="grid",GROUP="asmadmin",MODE="0660"
重新加载udev
udevadm control --reload-rules
udevadm trigger
查看磁盘
ll /dev/asm*
将rules文件复制到另外一节点,重新加载udev生效