系统环境:RedHat EL64
Oracle: Oracle 11gR2
在Oracle 11gR2,构建RAC时可以通过ASM创建asm disk,但是需要安装asmlib相关软件;对于RedHat EL64,Oracle的asm不能很好的支持,所以可以通过udev来创建asm disk,就不需要安装asmlib相关软件。
一、查看系统环境
内核版本:
[root@rh64 rules.d]# uname -a
Linux rh64 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
系统用户:
[root@rh64 rules.d]# id grid
uid=400(grid) gid=400(asmadmin) groups=400(asmadmin)
二、创建共享磁盘(可以采用分区或独立的磁盘)
[root@rh64 ~]# fdisk -l
Disk /dev/sdc: 24.3 GB, 24323964928 bytes
255 heads, 63 sectors/track, 2957 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
查看磁盘UUID:
[root@rh64 ~]# /sbin/scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VB3d5ccb5e-9c197b67
磁盘分区:
[root@rh64 ~]# fdisk -l
Disk /dev/sdc: 24.3 GB, 24323964928 bytes
255 heads, 63 sectors/track, 2957 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb09f8d3
Device Boot Start End Blocks Id System
/dev/sdc1 1 915 7349706 83 Linux
/dev/sdc2 916 1830 7349737+ 83 Linux
/dev/sdc3 1831 2957 9052627+ 83 Linux
三、建立UDEV规则文件
[root@rh64 ~]# cd /etc/udev/rules.d/
[root@rh64 rules.d]# ls
60-fprint-autosuspend.rules 60-raw.rules 80-kvm.rules 97-bluetooth-serial.rules
60-openct.rules 70-persistent-cd.rules 90-alsa.rules 98-kexec.rules
60-pcmcia.rules 70-persistent-net.rules 90-hal.rules 99-fuse.rules
[root@rh64 rules.d]# cat 99-oracle-asmdisk.rules
1
2
3
|
KERNEL== "sdc1" , BUS== "scsi" , PROGRAM== "/sbin/scsi_id -g -u -d /dev/$parent" , RESULT== "1ATA_VBOX_HARDDISK_VB3d5ccb5e-9c197b67" , NAME= "asm_disk1" , OWNER= "grid" , GROUP= "asmadmin" , MODE= "0660" KERNEL== "sdc2" , BUS== "scsi" , PROGRAM== "/sbin/scsi_id -g -u -d /dev/$parent" , RESULT== "1ATA_VBOX_HARDDISK_VB3d5ccb5e-9c197b67" , NAME= "asm_disk2" , OWNER= "grid" , GROUP= "asmadmin" , MODE= "0660" KERNEL== "sdc3" , BUS== "scsi" , PROGRAM== "/sbin/scsi_id -g -u -d /dev/$parent" , RESULT== "1ATA_VBOX_HARDDISK_VB3d5ccb5e-9c197b67" , NAME= "asm_disk3" , OWNER= "grid" , GROUP= "asmadmin" , MODE= "0660"
|
四、启动udev service
载入配置文件:
[root@rh64 rules.d]# udevadm control --reload-rules
启动udev service:
[root@rh64 rules.d]# start_udev
Starting udev:
查看asm disks:
[root@rh64 rules.d]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 33 Jan 13 16:52 /dev/asm_disk1
brw-rw---- 1 grid asmadmin 8, 34 Jan 13 16:52 /dev/asm_disk2
brw-rw---- 1 grid asmadmin 8, 35 Jan 13 16:52 /dev/asm_disk3
--------至此,asm disk创建成功 !