Monday, October 4, 2010

10gR2 RAC on RHEL 4 using VirtualBox

This blog is mainly about the pre-installation tasks (highlights) that is needed on VirtualBox to create 10gR2 RAC on RHEL 4. The oracle-base site has two articles on creating 11gR2 RAC using VirtualBox and VMware. These articles uses RHEL 5 on the virtual servers could be refered for installing a 11gR2 RAC.

1. Download Virtualbox rpm (VirtualBox-3.2-3.2.8_64453_rhel5-1.x86_64.rpm or later, chose the correct kernel architecture and host OS version). This version of virtualbox allows the creation of shared disks, which is a key requirment to create a RAC.

2. When installing RHEL 4 with a mixture of IDE controllers (for CD, iso image) and SATA controllers (for loacl hard disk) following error could be seen. (This is not seen when installing RHEL 5) Linux installation bootup seem to hang at this error but continues after a long wait but it wasn't possible to restart the virtual server after the Linux OS installation.

3. To fix this problem all the local disks were created using the IDE controller which seem to solve this issue.

4. Once Linux OS is installed in one virtual server, clone it with
VBoxManage clonehd /vm/rac1.vdi /vm/rac2.vdi --remember
When creating the second virtual server select "use existing harddisk" option to make use of the cloned disk. Once the clone (second rac node) is started change the hostname,IP and etc to make clone different from the source.
If the vdi file is copied instead of cloning generate a new uid with (tested on VirtualBox 4.1)
VBoxManage internalcommands sethduuid rac2.vdi
UUID changed to: ee7c49ae-2871-463b-a75c-a88135b57bde
5. Using IDE controllers only 3 local disks could be used at one time in the server (considering fourth IDE slot would be for CD). Create disks with shareable option
VBoxManage createhd --filename /vm/asm1.vdi --size 10240 --format VDI --variant Fixed --type shareable --remember

VBoxManage createhd --filename /vm/asm2.vdi --size 10240 --format VDI --variant Fixed --type shareable --remember 
and attach them to each virtual server
VBoxManage storageattach rac1 --storagectl "IDE Controller" --port 0 --device 1 --type hdd --medium /vm/asm1.vdi
VBoxManage storageattach rac1 --storagectl "IDE Controller" --port 1 --device 1 --type hdd --medium /vm/asm2.vdi

VBoxManage storageattach rac2 --storagectl "IDE Controller" --port 0 --device 1 --type hdd --medium /vm/asm1.vdi
VBoxManage storageattach rac2 --storagectl "IDE Controller" --port 1 --device 1 --type hdd --medium /vm/asm2.vdi
May need to assign IDE slots (primary salve/master, secondary slave/master) as appropriately.
6. These disks would appear as /dev/hdb and /dev/hdc (similar names) when listed with fdisk -l from the virtual server. To store the ocr,vote disks and asm spfile craeted partitons in one of them and use the reset of the space to create a ASM disk using oracleasm.
Disk /dev/hdb: 10.7 GB, 10737418240 bytes
16 heads, 63 sectors/track, 20805 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1         214      107824+  83  Linux
/dev/hdb2             215         273       29736   83  Linux
/dev/hdb3             274         293       10080   83  Linux
/dev/hdb4             294       20805    10338048    5  Extended
/dev/hdb5             294       20805    10338016+  83  Linux

Disk /dev/hdc: 10.7 GB, 10737418240 bytes
16 heads, 63 sectors/track, 20805 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hdc1               1       20805    10485688+  83  Linux
Here hdb1 would be bound to a raw device and will be used as storage location for OCR, hdb2 for vote and hdb3 for asm spfile. Rest of it will be used for ASM (data). hdc1 would be used for another ASM disk (flash).

7. Provided other requriement are satisfied (two network cards) this is all that is required to get started with the RAC installation. (RAC related pre-installation ie. kernel parameters, required rpms and etc are needed, not covered here)

8. Use the following when starting virtual servers remotely and having a GUI interface is not important.
VBoxManage startvm rac1 --type headless
VBoxManage startvm rac2 --type headless