Virtualbox

From Oracle FAQ
Jump to: navigation, search

Oracle VM VirtualBox (formerly SUN VirtualBox, SUN xVM VirtualBox and Innotek VirtualBox) is a free and open-source hypervisor for x86 computers. It was initially developed by Innotek GmbH, and was acquired by SUN Microsystems in 2008, which was in turn acquired by Oracle in 2010.

Oracle VirtualBox can be installed on a number of operating systems, including: Windows, Linux, OS X and Solaris. There are also ports for operating systems like to FreeBSD and Genode. It supports (amongst others) the creation and management of guest virtual machines (called VM's or images) running Windows, Linux, BSD, OS/2 and Solaris.

VirtualBox is ideal for creating virtual environments on your workstation for testing Oracle (and other) products. One can, for example, install an Oracle Database on a VM running Oracle Linux on your Windows PC. Several pre-build virtual machines are also available for download on the Internet.

For some guest operating systems, a "Guest Additions" package of device drivers and system applications is available which typically improves performance (especially of graphics) and usability (like copy and paste between hosts).

Port forwarding[edit]

Port forwarding is handy to connect from your PC to a database or application server running within a VirtualBox VM. To do this:

  • Open the settings for your Virtual Machine (right click on the VM name, then choose "Settings...") and go to "Network" settings.
  • Ensure that NAT is selected in the "Attached to:" selector.
  • At the bottom of the window, click on the "Port Forwarding" (under advanced) and enter you rules.

An example rule to pass traffic listener though:

Name  Protocol  Host IP        Host Port  Guest IP       Guest Port
LSNR  TCP       (leave empty)  1521       (leave empty)  1521

You can now define your TNSNAMES.ORA entry:

xe =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = xe)
   )
 )

Oracle RAC[edit]

To support Oracle RAC, one needs to emulate a shared disk environment with a private interconnect.

The private interconnect can be created by adding a second network adapter in the VM settings. Mark it as an "internal network" and give it a common name on all nodes.

For the shared disks:

$ mkdir -p /VirtualBox/ol6-121-rac
$ cd /VirtualBox/ol6-121-rac

$ echo Create ASM disks.
$ VBoxManage createhd --filename asm1.vdi --size 5120 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm2.vdi --size 5120 --format VDI --variant Fixed
$ VBoxManage createhd --filename asm3.vdi --size 5120 --format VDI --variant Fixed

$ echo Make them shareable.
$ VBoxManage modifyhd asm1.vdi --type shareable
$ VBoxManage modifyhd asm2.vdi --type shareable
$ VBoxManage modifyhd asm3.vdi --type shareable
 
$ echo Connect disks to the first VM.
$ VBoxManage storageattach ol6-121-rac1 --storagectl "SATA" --port 1 --device 0 --type hdd \
   --medium asm1.vdi --mtype shareable
$ VBoxManage storageattach ol6-121-rac1 --storagectl "SATA" --port 2 --device 0 --type hdd \
   --medium asm2.vdi --mtype shareable
$ VBoxManage storageattach ol6-121-rac1 --storagectl "SATA" --port 3 --device 0 --type hdd \
   --medium asm3.vdi --mtype shareable

You should now be able to see the disks on your first VM under the /dev directory. Use "fdisk" to partition the disks (new, pimary, partition 1, ENTER, ENTER, write):

$ fdisk /dev/sdb
$ fdisk /dev/sdc
$ fdisk /dev/sdd

You can now present them to ASMLib:

$ /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
$ /usr/sbin/oracleasm createdisk DISK2 /dev/sdc1
$ /usr/sbin/oracleasm createdisk DISK3 /dev/sdd1

Repeat the steps "Connect disks to the first VM" (above) for the second and subsequent nodes of your cluster.

External links[edit]