在Oracle VM搭建Oracle RAC時,產生共用磁碟並掛到asm中步驟還是比較多的。記錄一下。前提是已經在VM中已經安裝好了一個linux.
1. 我在這建立5個磁碟 cd C:\Program Files\Oracle\VirtualBoxVBoxManage.exe createhd -filename D:\OracleVM\ASM\asm1.vdi -size 5120 -format VDI -variant FixedVBoxManage.exe createhd -filename D:\OracleVM\ASM\asm2.vdi -size 5120 -format VDI -variant FixedVBoxManage.exe createhd -filename D:\OracleVM\ASM\asm3.vdi -size 5120 -format VDI -variant FixedVBoxManage.exe createhd -filename D:\OracleVM\ASM\asm4.vdi -size 5120 -format VDI -variant FixedVBoxManage.exe createhd -filename D:\OracleVM\ASM\asm5.vdi -size 5120 -format VDI -variant Fixed 2. 在Oracle VM中附加進去。 這個VM也可以用命令,但不太好使。 Settings -> Storage->Controller:SATA ->Add Hard Disk3. 更改成共用模式VBoxManage.exe modifyhd D:\OracleVM\ASM\asm1.vdi --type shareableVBoxManage.exe modifyhd D:\OracleVM\ASM\asm2.vdi --type shareableVBoxManage.exe modifyhd D:\OracleVM\ASM\asm3.vdi --type shareableVBoxManage.exe modifyhd D:\OracleVM\ASM\asm4.vdi --type shareableVBoxManage.exe modifyhd D:\OracleVM\ASM\asm5.vdi --type shareable 4. 檢查下狀態 a. VBoxManage list vms b. 進入linux系統 [root@rac1 dev]# ls sd* sda sda1 sda2 sdb sdc sdd sde sdf //其中 sdb sdc sdd sde sdf 就是掛上的那5個盤
5. 來fdisk 磁碟。 依次: fdisk sdb fdisk sdc fdisk sdd fdisk sde fdisk sdf 附了個例子: [root@rac1 dev]# fdisk sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x1f132726.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').Command (m for help): pDisk sdb: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x1f132726Device Boot Start End Blocks Id SystemCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-652, default 1):Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):Using default value 652Command (m for help): pDisk sdb: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x1f132726Device Boot Start End Blocks Id System sdb1 1 652 5237158+ 83 LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.[root@rac1 dev]# ls sd*sda sda1 sda2 sdb sdb1 sdc sdd sde sdf
最後的結果: [root@rac1 dev]# ls sd*sda sda1 sda2 sdb sdb1 sdc sdc1 sdd sdd1 sde sde1 sdf sdf1
6. 依次建立asm磁碟 [root@xclrac1 ~]# oracleasm createdisk DISK1 /dev/sdb1Writing disk header: doneInstantiating disk: done[root@xclrac1 ~]# oracleasm createdisk DISK2 /dev/sdc1Writing disk header: doneInstantiating disk: done[root@xclrac1 ~]# oracleasm createdisk DISK3 /dev/sdd1Writing disk header: doneInstantiating disk: done[root@xclrac1 ~]# oracleasm createdisk DISK4 /dev/sde1Writing disk header: doneInstantiating disk: done[root@xclrac1 ~]# oracleasm createdisk DISK5 /dev/sdf1Writing disk header: doneInstantiating disk: done
7. 檢查下效果 [root@xclrac1 ~]# oracleasm listdisksDISK1DISK2DISK3DISK4DISK5
8. 讓oracleasm把磁碟給找出來[root@xclrac1 ~]# oracleasm scandisksReloading disk partitions: doneCleaning any stale ASM disks...Scanning system for ASM disks...9.配置asm 磁碟的系統管理使用者[root@xclrac1 Packages]# oracleasm configure -iConfiguring the Oracle ASM library driver.Default user to own the driver interface []: oracleDefault group to own the driver interface []: dba[root@xclrac1 Packages]# oracleasm configureORACLEASM_ENABLED=trueORACLEASM_UID=oracleORACLEASM_GID=dbaORACLEASM_SCANBOOT=trueORACLEASM_SCANORDER=""ORACLEASM_SCANEXCLUDE=""ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
至此,這個Linux的asm就掛載成功了。 剩下的工作就是把這個OS再Clone一下。然後你就會發現。這些磁碟都能被兩個OS找到並使用了。就可以放心裝RAC了。 C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd D:\OracleVM\OLE_RAC1\O
LE_RAC1.vdi D:\OracleVM\OLE_RAC2\OLE_RAC2.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: c7f39d05-98b8-426f-8897-16a8e39ea
34f
同時附上ORACLE ASM安裝的詳細步驟: <<搞定Linux下Oracle ASM的安裝>>
MAIL:xcl_168@aliyun.comBlog:http://blog.csdn.net/xcl168