30
Database, Development L L EARNING EARNING O O RACLE RACLE WITH WITH O O RACLE RACLE VM V VM V IRTUAL IRTUAL B B OX OX Leighton L. Nelson, Mercy Table of Contents INTRODUCTION.................................................................... 1 VIRTUALIZATION AND VIRTUALBOX................................................... 1 GETTING STARTED.................................................................. 3 USE CASES....................................................................... 3 OTN DATABASE APP DEVELOPMENT PRE-BUILT VM SETUP.................................5 BUILD YOUR OWN VIRTUALBOX APPLIANCE............................................ 16 LEARNING RESOURCES............................................................. 25 THE ORACLE LEARNING LIBRARY.......................................................25 GETTING THE MOST OUT OF VIRTUALBOX............................................. 26 CONCLUSION..................................................................... 27 ADDITIONAL RESOURCES........................................................... 28 ACKNOWLEDGEMENTS............................................................... 28 1 Session #374

Learning Oracle with Oracle VM VirtualBox Whitepaper

Embed Size (px)

Citation preview

Page 1: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

LLEARNINGEARNING O ORACLERACLE WITHWITH O ORACLERACLE VM V VM VIRTUALIRTUALBBOXOX

Leighton L. Nelson, Mercy

Table of Contents

INTRODUCTION............................................................................................................................................................1

VIRTUALIZATION AND VIRTUALBOX.............................................................................................................................1GETTING STARTED..................................................................................................................................................................3

USE CASES....................................................................................................................................................................3

OTN DATABASE APP DEVELOPMENT PRE-BUILT VM SETUP...........................................................................................5

BUILD YOUR OWN VIRTUALBOX APPLIANCE...............................................................................................................16

LEARNING RESOURCES...............................................................................................................................................25THE ORACLE LEARNING LIBRARY.............................................................................................................................................25

GETTING THE MOST OUT OF VIRTUALBOX..................................................................................................................26

CONCLUSION..............................................................................................................................................................27

ADDITIONAL RESOURCES............................................................................................................................................28

ACKNOWLEDGEMENTS...............................................................................................................................................28

1 Session #374

Page 2: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

INTRODUCTION Have you ever heard or read about a new technology that you had to see work for yourself? Or maybe you learned some new programming technique and you wanted to practice. We sometimes just need to “kick the tires” on a new technology to get familiar with it. The problem is that it usually requires some basic infrastructure. Your desktop or laptop computer is usually running only a single operating system – typically Windows or Mac OS X. You’ve become quite efficient at using it and have no plans for spending additional money on buying one just to create a sandbox environment. In addition, dual booting, which involves creating a second operating system on your hard drive by partitioning and using a boot loader1 to select which one to boot into, is not fool-proof and can sometimes lead to loss of data. A virtualized environment is a cost-effective and simple method to accomplish this.

VirtualBox makes it easy (and inexpensive) to create cross-platform sandbox environments for testing, development and as an educational tool. Developers, systems and database administrators can benefit from the ability to provision and distribute pre-packaged VirtualBox images or appliances. Oracle Technology Network also provides pre-configured Oracle environment for its OTN Developer Day Hands-On workshops, consisting of up-to-date versions of Oracle Enterprise Linux 5, Oracle Database 11gR2, Oracle Apex, SQL Developer and others.

VIRTUALIZATION AND VIRTUALBOX VirtualBox is robust virtualization software that runs on top of an existing host operating system. It supports a large number of guests including the latest version of Windows 7, RHEL 6, Solaris 11, Ubuntu 11.10 and Mac OS X Server 10.7. Previously, if you wanted to try another operating system, you would have to use either a separate physical machine or dual-boot (or triple-boot) your computer. Switching to another operating system would require restarting your machine each time. This was not a very efficient way to use multiple operating systems. Virtualization provides the ability to run multiple operating systems simultaneously without rebooting or modifying your existing operating system.

Figure 1 (Courtesy of Ginny Henningsen) displays the high level Oracle VM VirtualBox architecture.

1 Grub boot loader is the default for many Linux operating systems.2 Session #374

Page 3: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Figure 1 . Host Platforms and Guest Operating Environments

VirtualBox is an open-source, cross-platform virtualization software that runs on Windows, Linux, Mac OS X and Solaris. This makes it ideal for getting systems that don’t run natively on one platform to run on your computer. For example, Oracle 11g XE runs on Windows and Linux operating systems. If you use a Mac then you can install VirtualBox and then run Oracle 11g XE

3 Session #374

Page 4: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

on an Oracle Linux or Windows VM . This will then allow you to connect to your database using your native desktop clients such as SQL Developer using various techniques, which will be described later in this paper.The instructions in this whitepaper are based on Mac OS X. Instructions for other platforms should be similar. Please read the VirtualBox User Manual for platform specific commands.

GETTING STARTED

First you need to download the VirtualBox installation package for your platform. This can be downloaded from the virtualbox.org or Oracle Technology Network. VirtualBox requires a computer with at least 512MB of RAM. However, if you’re planning on running something like Oracle database then a minimum of 2GB is recommended. You should also have enough hard disk space to store your VM guest operating system as well as data for your applications. Nearly every modern computer is built with a CPU2 fast enough to handle VirtualBox. Read the VirtualBox User Manual for the installation instructions for your platform.

USE CASES “Why using Oracle VM VirtualBox makes my inner geek go genuinely giddy.” – Ginny Henningsen,

Today, virtualization has become quite predominant within the enterprise. Likewise, desktop virtualization has become increasingly popular. Developers can use the technology to develop code on different platforms. Programming languages such as Java make this even easier to accomplish due to its cross-platform nature. Oracle developers can also test code running on different versions of the database. System administrators can test installation procedures for different types and versions of operating systems such as Oracle Linux and Solaris. They are also able to learn about new operating system features by creating a personal sandbox environment. Database administrators can also test installation and creation of Oracle database server using different versions of the database on different platforms much more quickly than they would in a physical environment.

OTN PRE-BUILT APPLIANCES

VirtualBox lends itself as an excellent education tool. Oracle Technology Network has provided several pre-built VirtualBox images or appliances that contain complete stacks of pre-configured Oracle software. Currently there are nine pre-built images available from the OTN download page. The current list of pre-built VMs is below.

Name Contents

Database App Development VM Oracle Linux 5

Oracle Database 11g Release 2 Enterprise Edition

Oracle TimesTen In-Memory Database Cache

Oracle XML DB

Oracle SQL Developer

Oracle SQL Developer Data Modeler

2 VirtualBox only runs on x86 platforms. Intel/AMD4 Session #374

Page 5: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Oracle Application Express 4.1

Oracle JDeveloper

Video chats with engineers and experts

Enterprise Java Development VM Oracle Linux 5, JDK 1.6 +

Oracle WebLogic Server 12.1.1

Oracle Coherence 3.7

Oracle TopLink 12.1.1

Hudson 2.2

Subversion 1.4.2

Maven 3.0.1

NetBeans IDE 7.1 RC2

Oracle Enterprise Pack for Eclipse 12.1.1 / Eclipse 3.7

Easter Egg: Bonus introductory labs for Coherence 3.7

Oracle VM Manager 3.0 VM Oracle Linux 5 update 7 with the Unbreakable Enterprise Kernel (2.6.32)Oracle VM Manager 3.0.3 demo installation

Oracle WebLogic Server 10.3

Oracle Database 11g Express Edition

Solaris 11 Admin VM Oracle Solaris 11 11/11

Oracle WebCenter Portal Framework 11g Hands-on VM Oracle Linux 5

Oracle XE Universal Database 10.2.0.1

Oracle WebLogic Server 10.3.4.0

Oracle WebCenter Portal Framework 11gR1 PS3 (11.1.1.4.0)Oracle JDeveloper 11.1.1.4

Oracle WebCenter Extension for JDeveloper (11.1.1.4.0)

Oracle Tuxedo Web Application Server Demo V Oracle Linux 5.6

Oracle Tuxedo 11gR1 PS1 1 1(1.1.1.2.0)

Oracle SALT 11gR1 (11.1.1.2.2)

Oracle TSAM 11gR1 (11.1.1.2.0)

Oracle Database XE 10.2

PHP 5.3.6, xDebug extension

Apache HTTP Server 2.2.17

NetBeans PHP IDE 7.0 Beta

JDK 1.6 +

Oracle Business Intelligence Enterprise Edition Plus VM Oracle Database 11g Release 2

Oracle TimesTen

Essbase Server

Access Provisioning Services

OBIEE 11.1.1.5 with BI Composer configured SampleApp 10722Oracle JDev

Oracle SQL Developer

Oracle Internet Directory

SOA & BPM Development VM Oracle Linux 5

Oracle Database XE 10.2

5 Session #374

Page 6: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Oracle WebLogic Server 10.3.3.0

Oracle SOA Suite 11g R1 PS2

Oracle BPM Suite 11g R1 PS2 (with bundle patch #1)

Oracle BAM 11g R1 PS2

Oracle B2B 11g R1 PS2

Oracle JDeveloper 11.1.1.3

Enterprise PHP Development VM(Provided and supported by Zend)

Oracle Linux 5.7

Zend Server 5.5

Oracle Database XE 11.2

OTN has also included hands-on labs and tutorials for some of the VirtualBox images. These labs are also used as part of the OTN Virtual Developer Day series of webinars. The OTN Virtual Developer day for Database for example, is a half-day online training class consisting several tracks including – Java, Database, APEX and .NET.

OTN DATABASE APP DEVELOPMENT PRE-BUILT VM SETUP

Go to http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html to download the Pre-Built Developer VM

Review the requirements and download the Oracle Developer Day ova file. The OVA is an archived format, which includes both the virtual disks and meta-data for the VM.

6 Session #374

Page 7: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

After you have downloaded the file you need to import it using VirtualBox, you can use either the VirtualBox Manager Import Appliance Wizard or the command line. However, we will use the former for this demonstration.

Choose File->Import Appliance

7 Session #374

Page 8: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Navigate to the directory where you downloaded and saved the archive. Select the file and click Open.

8 Session #374

Page 9: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Click the Continue in the button.

9 Session #374

Page 10: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

You can also modify the VM settings including RAM and CPU. The defaults work fine. Click on the Import button to begin.

10 Session #374

Page 11: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

You have to agree to the OTN license term agreement before you can begin importing the VM.

11 Session #374

Page 12: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

The import will begin

12 Session #374

Page 13: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

After the Import has completed you will see the VM listed in the VM Manager. Click the green Start arrow to start up the VM.

13 Session #374

Page 14: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

14 Session #374

Page 15: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

After the VM has booted you should see the screen shown below. Type ‘oracle’ in the username field and then type ‘oracle’ for the password and press Enter/Return on your keyboard to log in.

After successfully logging in you will see information about the available labs and as well the EM URL and IP addresses. You are now ready to begin your labs. Click on the Start Here icon on the desktop to access the Hands-On Lab instructions

15 Session #374

Page 16: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

To get started click on the Start Here icon to launch the OTN Developer Days Hands-on Oracle Database 11g Application Development labs. Here you will see three tracks – Oracle Application Express, Database and Java.

16 Session #374

Page 17: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

BUILD YOUR OWN VIRTUALBOX APPLIANCE If you cannot find a suitable VirtualBox image or you would like to build your own appliance for getting hands-on experience with the installation process, then there are a few extra steps you should take. Figure 2 below (Courtesy of Ginny Henningsen) shows a configuration involving three VMs, running different versions of Oracle Linux on a Solaris host. The VMs contain Oracle Database 10g and Oracle Database 11g. It’s possible to build just about any configuration of supported Oracle stack (given enough resources) with VirtualBox.

17 Session #374

Page 18: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Figure 2

Here I will demonstrate how to create a new VM from the VirtualBox Manager GUI.First you need to create a new VM. Click New.

18 Session #374

Page 19: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

The New VM Wizard will appear. Click Continue.

19 Session #374

Page 20: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Type a name for your VM and select an OS type.

20 Session #374

Page 21: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Choose the amount of memory available you want to allocate to your VM. Remember to allocate enough memory to run the guest VM without causing performance problems on your host. Click Continue.

Choose where or not to create a new hard disk or use an existing one. By default it will allow the disk to be a Start-up Disk. If using an existing disk it must not currently be attached to an existing VM. Click Continue.

21 Session #374

Page 22: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Select the format of virtual disk image file to create. VDI is the default format used by VirtualBox. VMDK is used by VMware while VHD and HDD are Microsoft and Parallels specific image file formats.

22 Session #374

Page 23: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Choose whether you prefer a use a dynamically allocated or fixed size disk. A dynamically allocated disk will grow as data is written to it, while a fixed size disk will pre-allocate its space specified in the next screen. Dynamic disks are suitable for typical VMs.

Choose a location and size for the virtual disk image file. For a dynamic image file this will be the maximum its maximum size.

23 Session #374

Page 24: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

The Summary screen will then be displayed. You will have a chance to review the settings before creating the VM. If anything needs to be changed you can go back and make changes.

Your new VM will now appear in the VirtualBox Manager.

24 Session #374

Page 25: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Now that your VM is created you can proceed to install your Operating System and Oracle software desired. For this I recommend taking a look at some of the tutorials on the Oracle Learning Library, which will be explored further below.

RAC Attack on VirtualboxThe popular hands-on lab (which originated at Collaborate) for building Oracle Real Application Clusters on your PC called “RAC Attack” has been enhanced to include VirtualBox. This was originally created using VMware but there are many users who already use VirtualBox as a desktop virtualization solution.

25 Session #374

Page 26: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

LEARNING RESOURCES

THE ORACLE LEARNING LIBRARY The Oracle Learning Library is an APEX application and provides a comprehensive repository of learning resources for almost every product available in the Oracle stack. You can search the library by product family, product, release, content type etc.

Content type currently available includes the following: Tutorials Demos Videos White paper e-Course Blog

26 Session #374

Page 27: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

GETTING THE MOST OUT OF VIRTUALBOX

NETWORKING

VirtualBox Supports several networking modes including:- Network Address Translation (NAT) Host-Only Networking Bridged Networking Internal Networking

Different modes can be used with the same guest VM depending on what you would like to accomplish. For example, you could set up an Internal Networking mode to simulate RAC Clusters interconnect. At the same time you can setup Bridged Networking so that you can communicate with your guest VM simulating a public network.For details on the different networking modes please consult the User Manual.

ACCESSING YOUR VM DATABASES FROM YOUR HOST MACHINE

If you need to access your databases within your network using a native tool such as SQL Developer then you have several methods of doing so. NAT Port Forwarding allows you to access your databases or other services within the VM as if they were running directly on your desktop. The following is an example of how to setup port forwarding using the command line utility VBoxManage. The default listener port (1521) is forwarded to the VM so that you can use native tools such as SQL Developer and SQL*Plus to access your databases on you VM.

iMac:~ User$ VBoxManage modifyvm "Oracle Developer Days" --natpf1 "tns,tcp,127.0.0.1,1521,,1521"

You can also access your databases in your VM using Bridged-Networking. See details about bridged networking in the VirtualBox User Manual.

SNAPSHOTS

Snapshots allow you to take a point in time image of your VM. When a snapshot is taken it makes the base virtual disks read-only. New changes are written to a new snapshot delta file. Deleting a snapshot removes the delta images. It makes it really convenient to test changes within your VM. You can take a snapshot just before you make your change and revert to it if something goes wrong or to compare the results of different changes. Using snapshots, you cannot only revert changes, but you can also roll forward those changes.

I recommend using snapshots sparingly i.e. no more than 2 or 3 children for a parent image. This can cause performance issues since VirtualBox has to search all children for the correct snapshot image when doing read operations. Snapshots also can grow over time and consume a lot of space.

CLONING

27 Session #374

Page 28: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

Once you have created a VirtualBox VM that you are satisfied with, you can then clone it to produce similar guest VMs. The clone can either be registered on the same host or copied to another computer.

Cloning can be done either using the command line or the VM Manager GUI.

Example.VBoxManage clonevm OraDev1 --mode all --options keepdisknames --name OraDev2 --basefolder /Volumes/MyDrive/Virtualbox/ --register0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%Machine has been successfully cloned as "OraDev2"

GUEST ADDITIONS AND SHARED FOLDERS

The Guest Additions provides additional functionality to guest VMs such as automatic mouse capture, better graphics, seamless windows, shared folders and general performance improvements. Shared Folders allow you to access files on your host computer from within your VirtualBox guest. To enable this feature you have to first install Guest Additions in your VM.

EXTENSION PACKS

Extension packs takes advantage of the modularity of VirtualBox by providing additional features to its already rich feature set. Oracle’s extension pack adds support for USB 2.0 and Virtual Remote Desktop Protocol (VRDP)

VBOXHEADLESS

The VBoxHeadless command-line interface allows a VM to run on a host without displaying a graphical user interface. This is useful in a server environment, which does not require a display.

CONCLUSION We have seen how Oracle VM VirtualBox enables us to quickly provision a fully provisioned Oracle VM appliance complete with software from the Oracle stack. These appliances can then be used for educational and learning purposes for systems administrators, database administrators and developers. While Oracle Technology Network has done most of the work in building these appliances, we are also able to build our own custom software environments complete with Oracle Linux or Solaris and Database 11gR2 or XE to get hands-on with the installation process. Oracle has also provided a complete library of learning resources through the Oracle Learning Library portal with videos, demos, tutorials and e-Courses to help users get the most out of their learning experience with Oracle technology.Oracle VM VirtualBox makes this all possible on a single computer without rebooting or partitioning. Run multiple OSes concurrently and enjoy all the goodness that VirtualBox has to offer – for free.

28 Session #374

Page 29: Learning Oracle with Oracle VM VirtualBox Whitepaper

Database, Development

ADDITIONAL RESOURCES Oracle VM VirtualBox User Manual: http://www.virtualbox.org/manual/UserManual.htmlOracle VM VirtualBox documentation library: http://www.virtualbox.org/wiki/DocumentationOracle VM VirtualBox forums: http://forums.virtualbox.orgComputer In Your Computer: How to Use VirtualBox: http://www.makeuseof.com/pages/how-to-use-virtualbox"Fat Bloke Sings" blog: http://blogs.oracle.com/fatblokeOracle Learning Library: http://apex.oracle.com/pls/apex/f?p=44785:1RAC Attack Lab Handbook: http://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home

ACKNOWLEDGEMENTS Kris Rice – Sr. Director Database Tools, OracleGinny Henningsen - My New Favorite Tool: Oracle VM VirtualBox http://www.oracle.com/technetwork/articles/servers-storage-admin/vmlove-1368887.html

29 Session #374