Oracle VM创建共享磁盘并挂ASM

       在Oracle VM搭建Oracle RAC时,生成共享磁盘并挂到asm中步骤还是比较多的。记录一下。
前提是已经在VM中已经安装好了一个linux.

1. 我在这创建5个磁盘
  cd C:\Program Files\Oracle\VirtualBox
VBoxManage.exe createhd -filename D:\OracleVM\ASM\asm1.vdi -size 5120 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\OracleVM\ASM\asm2.vdi -size 5120 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\OracleVM\ASM\asm3.vdi -size 5120 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\OracleVM\ASM\asm4.vdi -size 5120 -format VDI -variant Fixed
VBoxManage.exe createhd -filename D:\OracleVM\ASM\asm5.vdi -size 5120 -format VDI -variant Fixed
 
2. 在Oracle VM中附加进去。 这个VM也可以用命令,但不太好使。
  Settings -> Storage->Controller:SATA ->Add Hard Disk
3. 更改成共享模式
VBoxManage.exe modifyhd D:\OracleVM\ASM\asm1.vdi --type shareable
VBoxManage.exe modifyhd D:\OracleVM\ASM\asm2.vdi --type shareable
VBoxManage.exe modifyhd D:\OracleVM\ASM\asm3.vdi --type shareable
VBoxManage.exe modifyhd D:\OracleVM\ASM\asm4.vdi --type shareable
VBoxManage.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 sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building 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): p
Disk sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x1f132726
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
   e extended
   p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652
Command (m for help): p
Disk sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x1f132726
Device Boot Start End Blocks Id System
  sdb1 1 652 5237158+ 83 Linux
Command (m for help): w
The 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/sdb1
Writing disk header: done
Instantiating disk: done
[root@xclrac1 ~]# oracleasm createdisk DISK2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@xclrac1 ~]# oracleasm createdisk DISK3 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@xclrac1 ~]# oracleasm createdisk DISK4 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@xclrac1 ~]# oracleasm createdisk DISK5 /dev/sdf1
Writing disk header: done
Instantiating disk: done

7. 检查下效果 
[root@xclrac1 ~]# oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
DISK5

8. 让oracleasm把磁盘给找出来
[root@xclrac1 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
9.配置asm 磁盘的管理用户
[root@xclrac1 Packages]# oracleasm configure -i
Configuring the Oracle ASM library driver.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
[root@xclrac1 Packages]# oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=oracle
ORACLEASM_GID=dba
ORACLEASM_SCANBOOT=true
ORACLEASM_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的安装>>


Blog:http://blog.csdn.net/xcl168

你可能感兴趣的:(ASM,RAC,OracleVM,共享磁盘,oracleasm)