Getting Oracle VM VirtualBox Ready for an Oracle Database

Everyone wants to go virtual, but getting started with Oracle’s VM VirtualBox can be tricky. James Koopmann takes a quick look at installing Oracle VM VirtualBox 3.2.4, covering some of the features you as a database administrator or database developer might run across while trying to install an operating system or Oracle database.

Introduction

There seems to be a constant buzz around virtualization and it seems everyone wants to be a part of it or take advantage of it within the datacenter. Virtualization, when stable VM are copied for reuse, is great for rapid deployment of a VM and Oracle instances; enabling database administrators and developers to quickly deploy complete and stable systems that can be used for testing, QA, or just investigating new features and development practices. With a VM, it literally takes only a few minutes to bring up a stable VM copy, no more wasting of days to rebuild system, database, and application software environments on physical machines.

On the Oracle front, after the acquisition of Sun, VirtualBox is giving other desktop virtualization tools a run for their money. Oracle’s VM VirtualBox is free to download and use at no cost and provides great benefits for DBAs and developers alike; giving them an opportunity to try out a variety of operating systems, configurations, and tests easily.

This paper takes a quick look at installing Oracle VM VirtualBox 3.2.4 and some of the features you as a database administrator or database developer might stumble up against while trying to install an operating system or Oracle database.

Installing Oracle’s VM VirtualBox

If you’ve been hiding yourself somewhere, now is the time to come out and dive into the world of virtualization. Oracle’s VM VirtualBox basically allows you to run different and simultaneously different operating systems on your desktop or laptop. The best place for information would be Oracle’s own Oracle VM VirtualBox website where you can also find the link for Oracle VM VirtualBox Downloads. Installing the latest release (3.2.4) is probably the simplest thing in this whole process and I’d encourage everyone to play around with it, if nothing more than just to look at the documentation in case you have a need in the future. Because this is so simple, I’m not going to elaborate on this process as it is really nothing more than clicking a few “NEXT” buttons.

Installing an Operating System for Oracle

You can choose most any operating system to get started. You can either go to a specific download site such as centos.org, Oracle’s website for Solaris or Linux. Alternatively, you might want to search and download pre-built VMs such as Solaris from the Oracle website. Installation of an operating system is just the same as when installing it on physical hardware except for telling VirtualBox where the ISO images reside on disk and answering a few questions about how you would like your host system’s resources to be distributed to the VM. That being said, I think it somewhat useful if I give you an idea of the prompts and responses I actually entered during the installation of a CentOS operating system.

    1. Through the Virtual Media Manager, add CD/DVD images for the CentOS ISO images you downloaded from a CentOS mirror. Making these available upfront, before beginning the actual creation of the VM makes it easier to switch disks in my opinion.
    2. Click the New button at the upper left area of the Oracle VM VirtualBox GUI to start the process of creating a new VM.
    3. A wizard will then guide you through a few simple steps that help you create a new VM. About the only interesting prompts where you’ll need to enter something are:
      1. the VM name (I called mine CentOS-5.5)
      2. specify the memory you want (I initially specified 1024MB but had to bump it up later to 1280MB during the database install)
      3. select the creation of a new disk
      4. accept a dynamically expanding storage, I made my disk size 20GB as I’m expecting to do some heavy database activity and because it will grow the file as needed there is now real wasted space here
      5. click Finish to complete the setup steps for the VM.
    4. Now to actually start the VM and begin the installation process for CentOS you have to click the Start button. This will initiate the First Run Wizard. This is where setting up the ISO images through the media manager comes in handy. Select the first disk ISO image for CentOS, Click Next, Click Finish, and this will begin the CentOS installation; just as if you were installing on a stand-alone machine and inserted a CD. As additional disks are required for the installation, use the media manager to select the proper ISO image.

Just for grins, below are the prompts and responses during my installation of the CentOS operating system:

Language Selection – English
Keyboard Selection – us
Warning about creating new partition – Yes
Partitioning Type – Remove linux partitions on selected drives and create default  layout
Warning about remove all Linux partitions – Yes
Review Partition Layout – Yes if you want, No to just continue
Boot Loader Configuration – Use GRUB Boot Loader
Boot Loader Configuration – blank for passing boot options
Boot Loader Configuration – no GRUB password
Boot Loader Configuration – just boot CentOS
Boot Loader Configuration – install boot loader on /dev/sda
Configure Network Interface – Yes to configure eth0
Network Configuration for eth0 – Activate on boot / Enable IPv4
IPv4 Configuration for eth0 – Manual address configuration 192.168.61.161/255.255.255.0
Gateway/Primary DNS/Secondary DNS – 192.168.61.1/**.**.***.**/**.**.***.**
Hostname Configuration – manually/wagner
Time Zone Selection – System clock uses UTC:America/Denver
Root Password - ********
Package selection – Desktop/Gnome
Installation to begin – OK
Required Install Media – Continue

Additional VirtualBox Must-Haves for Oracle

  1. Depending on your hardware configuration, the installation process may or may not have recognized and be able to access the network. To configure the network adapter, at least for me, I usually pick a Bridged Adapter so I can ping my other test systems and access the internet as well. Read the user guide to see what other network adapters offer.
  2. VirtualBox has additional software (Guest Additions) that can be installed inside the Linux virtual machines to improve performance and integration and allow you to take advantage of features such as a full screen or creating shared folders between host and VM. The shared folder feature is probably the most important as it not only makes the installation of Oracle easier but allows you to quickly access files between host and VM. To install the Guest Additions:
    1. Login as root and bring the mode of operation to runlevel 5 by issuing the ‘init 5’ command.
    2. Open a terminal window.
    3. Guest Additions, straight out of the box with fresh CentOS 5.5, will not properly install. Use the following to install additional packages required for installing the Guest Additions:
			[root@wagner ~]# uname -rp
			2.6.18-194.el5 i686 
			[root@wagner ~]# yum install gcc -y
			[root@wagner ~]# yum install kernel-devel-2.6.18-194.el5 -y
			[root@wagner ~]# yum install kernel-xen-devel-2.6.18-194.el5 –y
			[root@wagner ~]# export KERN_DIR=/usr/src/kernels/2.6.18-194.el5-i686
    1. Mount the Guest Additions CD by selecting Devices -> Install Guest Additions.
    2. The Guest Additions script needs to be executed from somewhere else other than the mounted location. I typically just copy the script to root’s $HOME and execute there:
		[root@wagner ~]# cd $HOME
		[root@wagner ~]# cp /media/VBOXADDITIONS_3.2.4_62467/VBoxLinuxAdditions-x86.run $HOME 
		[root@wagner ~]# ./VBoxLinuxAdditions-x86.run

Note: if you perform updates to the system, the Guest Additions probably won’t be rebuilt. You will have to, after the updates are done, re-execute VBoxLinuxAdditions-x86.run and restart your VM.

  1. Adding a shared folder allows bi-directional use of disk space outside the VM. This can become quite handy during the installation process and acts just like a mounted drive. To share a folder, for an Oracle installation where we have downloaded Oracle in a directory named C:Oracle11gR2-linux:
    1. Ensure the VM is stopped.
    2. Click the Settings button while the CentOS VM is highlighted.
    3. Highlight the Shared Folders option on the left.
    4. Click the Add button that exists on the right side of the panel to add a share.
    5. In the Folder Path, browse to the shared folder C:Oracle11gR2-linux.
    6. Enter a Folder Name of oracle11gr2.
    7. Click OK.
    8. In a terminal window, issue the following commands to mount the share and extract the Oracle installation.
		[root@wagner ~]# mkdir /media/share
		[root@wagner ~]# mount -t vboxsf oracle11gr2 /media/share
		[root@wagner ~]# cd /media/share
		[root@wagner share]# ls -l
		total 2227301
		-rwxrwxrwx 1 root root 1285396902 May 20 00:16 linux_11gR2_database_1of2.zip
		-rwxrwxrwx 1 root root  995359177 May 19 23:52 linux_11gR2_database_2of2.zip
		[root@wagner share]# unzip linux_11gR2_database_1of2.zip
		[root@wagner share]# unzip linux_11gR2_database_2of2.zip

Install Oracle and You’re done

At this point, your system will look just like many other systems you’ve installed Oracle on. At this point you may wish to export the appliance through the export wizard. This would allow you, if for some reason the Oracle installation failed or you corrupted your VM, to get back to a stable system just before the Oracle installation began. I usually take an export at this point but also after I’ve installed my Oracle database. That way I can always just use the copy to have a fresh VM at any time. Hopefully at this point you can see the benefit of using VMs. VMs provide great flexibility to DBAs and developers; allowing them to easily test new features yet have the flexibility to revert to a stable environment.

» See All Articles by Columnist James Koopmann

James Koopmann
James Koopmann
James Koopmann has fourteen years of database design, development and performance tuning experience. In addition, he has extensive database administration experience in Oracle and other relational databases in production environments, specializing in performance tuning of database engines and SQL based applications. Koopmann is an accomplished author with several technical papers in various Oracle related publications such as Oracle Magazine, Oracle Professional and SQL>UPDATE_RMOUG. He is a featured author and database expert for DatabaseJournal, a member of the editorial review committee for Select Journal (The Magazine for the International Oracle Users Group), an Oracle Certified Professional DBA and noted speaker at local Oracle User Groups around the country.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles