在<Why ASMLIB and why not?>我们介绍了使用ASMLIB作为一种专门为Oracle Automatic Storage Management特性设计的内核支持库(kernel support library)的优缺点,同时建议使用成熟的UDEV方案来替代ASMLIB。
这里我们就给出配置UDEV的具体步骤,还是比较简单的:
1.确认在所有RAC节点上已经安装了必要的UDEV包 [root@rh2 ~]# rpm -qa|grep udev udev-095-14.21.el5 2.通过scsi_id获取设备的块设备的唯一标识名,假设系统上已有LUN sdc-sdp for i in c d e f g h i j k l m n o p ; do echo "sd$i" "`scsi_id -g -u -s /block/sd$i` "; done sdc 1IET_00010001 sdd 1IET_00010002 sde 1IET_00010003 sdf 1IET_00010004 sdg 1IET_00010005 sdh 1IET_00010006 sdi 1IET_00010007 sdj 1IET_00010008 sdk 1IET_00010009 sdl 1IET_0001000a sdm 1IET_0001000b sdn 1IET_0001000c sdo 1IET_0001000d sdp 1IET_0001000e 以上列出于块设备名对应的唯一标识名 3.创建必要的UDEV配置文件, 首先切换到配置文件目录 [root@rh2 ~]# cd /etc/udev/rules.d 定义必要的规则配置文件 [root@rh2 rules.d]# touch 99-oracle-asmdevices.rules [root@rh2 rules.d]# cat 99-oracle-asmdevices.rules KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010001", NAME="ocr1", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010002", NAME="ocr2", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010003", NAME="asm-disk1", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010004", NAME="asm-disk2", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010005", NAME="asm-disk3", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010006", NAME="asm-disk4", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010007", NAME="asm-disk5", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010008", NAME="asm-disk6", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_00010009", NAME="asm-disk7", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_0001000a", NAME="asm-disk8", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_0001000b", NAME="asm-disk9", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_0001000c", NAME="asm-disk10", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_0001000d", NAME="asm-disk11", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="1IET_0001000e", NAME="asm-disk12", OWNER="grid", GROUP="asmadmin", MODE="0660" Result 为/sbin/scsi_id -g -u -s %p的输出--Match the returned string of the last PROGRAM call. This key may be used in any following rule after a PROGRAM call. 按顺序填入刚才获取的唯一标识名即可 OWNER为安装Grid Infrastructure的用户,在11gr2中一般为grid,GROUP为asmadmin MODE采用0660即可 NAME为UDEV映射后的设备名, 建议为OCR和VOTE DISK创建独立的DISKGROUP,为了容易区分将该DISKGROUP专用的设备命名为ocr1..ocrn的形式 其余磁盘可以根据其实际用途或磁盘组名来命名 4.将该规则文件拷贝到其他节点上 [root@rh2 rules.d]# scp 99-oracle-asmdevices.rules Other_node:/etc/udev/rules.d 5.在所有节点上启动udev服务,或者重启服务器即可 [root@rh2 rules.d]# /sbin/udevcontrol reload_rules [root@rh2 rules.d]# /sbin/start_udev Starting udev: [ OK ] 6.检查设备是否到位 [root@rh2 rules.d]# cd /dev [root@rh2 dev]# ls -l ocr* brw-rw---- 1 grid asmadmin 8, 32 Jul 10 17:31 ocr1 brw-rw---- 1 grid asmadmin 8, 48 Jul 10 17:31 ocr2 [root@rh2 dev]# ls -l asm-disk* brw-rw---- 1 grid asmadmin 8, 64 Jul 10 17:31 asm-disk1 brw-rw---- 1 grid asmadmin 8, 208 Jul 10 17:31 asm-disk10 brw-rw---- 1 grid asmadmin 8, 224 Jul 10 17:31 asm-disk11 brw-rw---- 1 grid asmadmin 8, 240 Jul 10 17:31 asm-disk12 brw-rw---- 1 grid asmadmin 8, 80 Jul 10 17:31 asm-disk2 brw-rw---- 1 grid asmadmin 8, 96 Jul 10 17:31 asm-disk3 brw-rw---- 1 grid asmadmin 8, 112 Jul 10 17:31 asm-disk4 brw-rw---- 1 grid asmadmin 8, 128 Jul 10 17:31 asm-disk5 brw-rw---- 1 grid asmadmin 8, 144 Jul 10 17:31 asm-disk6 brw-rw---- 1 grid asmadmin 8, 160 Jul 10 17:31 asm-disk7 brw-rw---- 1 grid asmadmin 8, 176 Jul 10 17:31 asm-disk8 brw-rw---- 1 grid asmadmin 8, 192 Jul 10 17:31 asm-disk9
(转自:http://www.askmaclean.com/archives/utilize-udev-resolve-11gr2-rac-asm-device-name.html)