1.使用asmlib(REHL 6以上不支持,因爲Redhat公司從RHEL 6這個版本開始決定從Kernel中移除ASMLIB,而且再也不給與Oracle公司對於該部份內核代碼的訪問修改權利,這直接致使Oracle不可能build出FOR RHEL 6的ASMLIB版本了)
2.使用raw設備(rhel 5以前使用/etc/sysconfig/rawdevices,rhel 5以後用udev)
3.直接使用磁盤
asmlib
建立asm磁盤
/etc/init.d/oracleasm configure (這裏須要輸入oracle用戶和dba組,因此須要先建立好。)
/etc/init.d/oracleasm enable
/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
/etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
/etc/init.d/oracleasm createdisk VOL4 /dev/sde1
/etc/init.d/oracleasm createdisk VOL5 /dev/sdf1
/etc/init.d/oracleasm createdisk VOL6 /dev/sdg1
獲取磁盤變化:/etc/init.d/oracleasm scandisks
查看asm磁盤:/etc/init.d/oracleasm listdisks
2.raw設備
兩種方式
2.1 rawdevices (rhel 5以前)
Edit the "/etc/sysconfig/rawdevices" file, adding the following lines.
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
Restart the rawdevices service using the following command.
service rawdevices restart
Run the following commands and add them the "/etc/rc.local" file.
chown oracle:oinstall /dev/raw/raw1
chown oracle:oinstall /dev/raw/raw2
chown oracle:oinstall /dev/raw/raw3
chmod 600 /dev/raw/raw1
chmod 600 /dev/raw/raw2
chmod 600 /dev/raw/raw3
The ASM raw device disks are now configured.
2.2 udev
(redhat 5及以上版本使用)
Edit the "/etc/udev/rules.d/60-raw.rules" file, adding the following lines.
ACTION=="add",KERNEL=="sde1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",KERNEL=="sdg1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",KERNEL=="sdh1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="sdi1",RUN+="/bin/raw /dev/raw/raw4 %N"
KERNEL=="raw[1-4]", OWNER="grid", GROUP="asmadmin", MODE="660"
Start the udev
#start_udev
3.直接來(oracle 11g 開始能用)
[root@rac1 ~]# ls -l /dev/sdb
brw-r----- 1 root disk 8, 16 Jun 22 09:56 /dev/sdb
[root@rac1 ~]# chown grid:asmadmin /dev/sdb
[root@rac1 ~]# chmod 660 /dev/sdb
[root@rac1 ~]# ls -l /dev/sdb
brw-rw---- 1 grid asmadmin 8, 16 Jun 22 09:56 /dev/sdb
這樣子就能在添加asm磁盤的時候認到,不過會報PRVF-5184,忽視直接執行
有兩點須要注意,通常來講能做爲asm磁盤的都是c設備,也就是字符設備,而使用/dev/sdb時沒有這個限制。oracle
另外oracle 11g後全部磁盤的權限是 grid:asmadmin 660,10g時是oracle:oinstall 600ui