1.查看现有的asm磁盘组的情况(v$asm_disk v$asm_diskgroup)
select name,type,state,total_mb,required_mirror_free_mb voting_files,free_mb,voting_files from v$asm_diskgroup;
NAME TYPE STATE TOTAL_MB VOTING_FILES FREE_MB V
------------------------------ ------ ----------- ---------- ------------ ---------- -
ARCH EXTERN CONNECTED 10240 0 9868 N
DATA EXTERN CONNECTED 51200 0 49197 N
OCR EXTERN CONNECTED 5120 0 4657 Y
select name,mode_status,state,total_mb,free_mb,path,voting_file from v$asm_disk;
NAME MODE_ST STATE TOTAL_MB FREE_MB PATH V
------------------------------ ------- -------- ---------- ---------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -
OCR_0000 ONLINE NORMAL 5120 4657 /dev/mapper/OCR Y
DATA_0000 ONLINE NORMAL 51200 49197 /dev/mapper/DATA N
ARCH_0000 ONLINE NORMAL 10240 9868 /dev/mapper/ARCH N
2.根据需求创建ASM磁盘(这里使用多路径+udev)
2.1.建立共享磁盘
切换到vmware安装目录 cd D:\VMware\vmware
cmd 命令
.\vmware-vdiskmanager.exe -c -s 3G -a lsilogic -t 2 "D:\VMware\vmware\sharedisks\11g\OCR_NEW1.vmdk"
.\vmware-vdiskmanager.exe -c -s 3G -a lsilogic -t 2 "D:\VMware\vmware\sharedisks\11g\OCR_NEW2.vmdk"
.\vmware-vdiskmanager.exe -c -s 3G -a lsilogic -t 2 "D:\VMware\vmware\sharedisks\11g\OCR_NEW3.vmdk"
.\vmware-vdiskmanager.exe -c -s 30G -a lsilogic -t 2 "D:\VMware\vmware\sharedisks\11g\DATA_NEW.vmdk"
.\vmware-vdiskmanager.exe -c -s 10G -a lsilogic -t 2 "D:\VMware\vmware\sharedisks\11g\ARCH_NEW.vmdk"
分别打开两台虚拟机目录中的vmx文件,在最后一行添加:(前三行是旧存储)
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "D:\VMware\vmware\sharedisks\11g\OCR.vmdk"
scsi1:1.deviceType = "Disk"
scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "D:\VMware\vmware\sharedisks\11g\DATA.vmdk"
scsi1:2.deviceType = "Disk"
scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "D:\VMware\vmware\sharedisks\11g\ARCH.vmdk"
scsi1:3.deviceType = "Disk"
scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.filename = "D:\VMware\vmware\sharedisks\11g\OCR_NEW1.vmdk"
scsi1:4.deviceType = "Disk"
scsi1:5.present = "TRUE"
scsi1:5.mode = "independent-persistent"
scsi1:5.filename = "D:\VMware\vmware\sharedisks\11g\OCR_NEW2.vmdk"
scsi1:5.deviceType = "Disk"
scsi1:6.present = "TRUE"
scsi1:6.mode = "independent-persistent"
scsi1:6.filename = "D:\VMware\vmware\sharedisks\11g\OCR_NEW3.vmdk"
scsi1:6.deviceType = "Disk"
scsi1:8.present = "TRUE"
scsi1:8.mode = "independent-persistent"
scsi1:8.filename = "D:\VMware\vmware\sharedisks\11g\DATA_NEW.vmdk"
scsi1:8.deviceType = "Disk"
scsi1:9.present = "TRUE"
scsi1:9.mode = "independent-persistent"
scsi1:9.filename = "D:\VMware\vmware\sharedisks\11g\ARCH_NEW.vmdk"
scsi1:9.deviceType = "Disk"
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
2.2配置multipath多路径
/dev/sdg: 3 36000c29bb60e102e6c905d9f22e2a680
/dev/sdd: 10 36000c297448260e8adee440316e9c11b
/dev/sdi: 10 36000c2934e845b39918a3519f5653b75
/dev/sdh: 30 36000c29da1c91beb84482c0a48dcc8c5
/dev/sdb: 5 36000c29834a381e8a88835b639a373b5
/dev/sdf: 3 36000c29a4543434fc08498c23bbbb6bb
/dev/sde: 3 36000c2936286649b0db7d385e512151b
vi /etc/multipath.conf
该系统原本就配置了,这里在两个节点都加入以下:
multipaths {
multipath {
wwid 36000c2936286649b0db7d385e512151b
alias OCR_NEW1
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry queue
}
}
multipaths {
multipath {
wwid 36000c29a4543434fc08498c23bbbb6bb
alias OCR_NEW2
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry queue
}
}
multipaths {
multipath {
wwid 36000c29bb60e102e6c905d9f22e2a680
alias OCR_NEW3
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry queue
}
}
multipaths {
multipath {
wwid 36000c29da1c91beb84482c0a48dcc8c5
alias DATA_NEW
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry queue
}
}
multipaths {
multipath {
wwid 36000c2934e845b39918a3519f5653b75
alias ARCH_NEW
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry queue
}
}
#重新启动多路径:
service multipathd restart
启动multipath配置后,会在/dev/mapper下生成多路径逻辑盘
cd /dev/mapper
ll
#查看多路径的状态:multipath -ll
2.3udev创建ASM磁盘,更改属组
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
ENV{DM_NAME}=="OCR", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="DATA", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="ARCH", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="OCR_NEW1", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="OCR_NEW2", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="OCR_NEW3", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="DATA_NEW", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="ARCH_NEW", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
重启udev
[root@sanan1 rules.d]# start_udev
正在启动 udev: [确定]
2.4验证是否成功
[root@whepi2 ~]# ls /dev/iscsi/
oraasm-arch1 oraasm-mes1.2 oraasm-mes1.4 oraasm-mes2.2 oraasm-ocr2
oraasm-mes1.1 oraasm-mes1.3 oraasm-mes2.1 oraasm-ocr1 oraasm-ocr3
---验证权限
ls -l /dev/dm-*
---验证命名结果
ls -l /dev/mapper/*
3.创建ASM磁盘组(表决盘的normal冗余最少3块,普通的磁盘最少2块,表决盘normal,其余external)
节点1:
create diskgroup OCR_NEW normal redundancy
failgroup FG1 disk '/dev/mapper/OCR_NEW1' name OCR_NEW_FG1_VOL1
failgroup FG2 disk '/dev/mapper/OCR_NEW2' name OCR_NEW_FG2_VOL2
failgroup FG3 disk '/dev/mapper/OCR_NEW3' name OCR_NEW_FG3_VOL3;
create diskgroup DATA_NEW external redundancy
disk '/dev/mapper/DATA_NEW' name DATA_NEW; --外部冗余,这里不做,只是做个外部冗余如何创建磁盘组的示范
create diskgroup ARCH_NEW external redundancy
disk '/dev/mapper/ARCH_NEW' name ARCH_NEW;
节点2:
ALTER DISKGROUP OCR_NEW MOUNT;
ALTER DISKGROUP DATA_NEW MOUNT;
ALTER DISKGROUP ARCH_NEW MOUNT;
删除磁盘组:
ALTER DISKGROUP OCR_NEW DISMOUNT;
drop diskgroup OCR_NEW force including contents;(强制删除ASM磁盘组)
crsctl delete resource ora.OCR_NEW.dg
crsctl stat res -t //检查ASM磁盘是否已经在两个节点挂在成功