CHAPTER 12

image

VirtualBox for Oracle

Oracle VM VirtualBox, formerly known as Sun VirtualBox or Sun xVM VirtualBox, is a hypervisor for x86 computers from Oracle Corporation. Oracle VM VirtualBox is a cross–platform virtualization software that allows you to run multiple OSs at the same time on Windows, Mac OS X, Linux, and Oracle Solaris OSs. Many IT professionals heavily leverage VirtualBox to learn new and emerging technologies. VirtualBox allows IT professionals to test, develop, demo, and deploy their applications and databases on virtual machines (VMs) on their local desktops or laptops.

There are two types of hypervisors: type 1 (native or bare-metal) and type 2 (hosted). A type 1 hypervisor runs directly on a physical server with no software layer between the hypervisor and the physical hardware, which is why it is often referred to as a bare metal hypervisor. This hypervisor is designed to be extremely fast for enterprise environments. VMware ESXi, Oracle VM, Linux KVM, Hyper-V, and Citrix XenServer are all examples of type 1 hypervisors. Hypervisors are very different in their functionality and features. Hypervisors VMware, Hyper-V, OVM, and KVM have a lot of similarities, but they are also very different. Just as Oracle, SQL Server, and MySQL are relational databases, there are significant differences in how they do things, as well as the environments and ecosystems in which they run.

A type 2 hypervisor runs on top of an OS such as Windows (VMWare Workstation) or a Mac (VMware Fusion), and VirtualBox (which runs on the following platforms: Linux, Solaris, Windows, and Mac). With a type 2 hypervisor, the VM has to go through the hypervisor software as well as the OS, thus inducing additional overhead. A type 2 hypervisor is great for running multiple VMs on laptops and PCs. VMware Workstation, Parallels, and VirtualBox are additional examples of type 2 hypervisors.

This chapter focuses on installing and configuring Oracle VM VirtualBox to set up a VM to host Oracle databases. You’ll proceed with creating additional virtual disks for Oracle ASM virtual disks and presenting the virtual disks to other VMs as shared storage. The chapter also briefly mentions the network infrastructure available for VirtualBox.

You’ll dive in to the details of creating and maintaining Linux templates, cloning new Linux VMs ready for instant deployment from golden image templates, and managing snapshots.

12-1. Installing Oracle VM VirtualBox

Problem

You want to install Oracle VM VirtualBox to get started on the virtualization journey.

Solution

You can download and install Oracle VM VirtualBox from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#vbox. Oracle VM VirtualBox software is available for Windows, Mac OS X, Solaris 10+, and Linux platforms. Installing VirtualBox is simple and straightforward, and can be completed in minutes.

This example shows what the installation on a Mac OS looks like. If you downloaded the VirtualBox for the Mac, you have a file name that resembles VirtualBox-4.3.26-98988-OSX.dmg. You see the installer shown in Figure 12-1 when you double-click the .dmg file.

9781484212554_Fig12-01.jpg

Figure 12-1. VirtualBox installer software

Double-click the Virtualbox.pkg icon to start the installation. On the Mac, you are directed to a window that specifies that the package needs to run a program to determine whether the software can be installed. Confirm that you agree by clicking the Continue button to proceed to the Welcome screen. From the Welcome screen, you can click the Continue button to proceed with the installation.

On the Standard install screen, you can change the default installation location of the binaries. By clicking the Install button, you’ll be prompted to enter the Username and Password for an administrative account that has privileges to install software on the machine to continue. When the installation completes, you’ll see a success window indicating that the software was installed without issues.

As you can see from the installation procedures, VirtualBox is extremely simple to install and use.

How It Works

By learning to implement VirtualBox, you are beginning the steps of creating a virtual infrastructure on your Windows, Mac, or Linux machine. VirtualBox is the perfect vehicle for DBAs and developers to learn about virtualization, Linux, and various Oracle technologies. Lots of professionals learn new technologies by installing VirtualBox on their laptops to create VMs of various OSs. VirtualBox is the perfect virtualization technology because it is easily accessible and completely free to deploy. VirtualBox is the preferred type 2 hypervisor for Oracle professionals running Oracle databases on OL.

Oracle announced recent addition of guest platforms, including the following:

  • OL 6
  • Ubuntu Linux and Fedora distributions
  • Mac OS X 10.9 “Mavericks”
  • Windows 8.1 and Windows Server 2012 R2

Image Note  Oracle provides downloadable Oracle virtual appliances (packaged VMs) for VirtualBox so that you can get started with a particular Oracle technology right away. Navigating your way around a new software stack is challenging enough without having to spend multiple cycles on the install process. Instead, you can download prebuilt Oracle VM VirtualBox appliances from Oracle’s web site. Deployment of the packaged virtual appliances is as easy as 1-2-3: download, assemble the files, and import into VirtualBox. For more information about virtual appliances, please see recipe 12-7.

12-2. Setting Up VirtualBox Virtual Machine (VM)

Problem

You want to create your first VM to instantiate a Linux server and install Oracle Database 12c.

Solution

You’ll focus on configuring VirtualBox to create a new VM for OL 6/7 and installing OL 6/7 from the ISO image as a guest OS. The OL 6/7 ISO image can be downloaded from edelivery.oracle.com—Oracle Software Delivery Cloud. You must have a (free) valid Oracle Account to download the Linux ISO.

To create a VM, click the New button in the top-left corner of the Oracle VM VirtualBox Manager and provide a descriptive name for the VM, location of the VM, and the OS type. The name that is specified will be used to identify the VM configuration. Specify a descriptive name and select the guest OS type and version. In this example, you want to select Linux for the type and Oracle (64-bit) for the version. You can choose Red Hat (64-bit) if your infrastructure is still running Red Hat.

Here’s the list of Linux flavors supported by VirtualBox:

  • Linux 2.2
  • Linux 2.4 (32-bit/64-bit)
  • Linux 2.6 (32-bit/64-bit)
  • Arch Linux (32-bit/64-bit)
  • Debian Linux (32-bit/64-bit)
  • openSUSE (32-bit/64-bit)
  • Fedora (32-bit/64-bit)
  • Gentoo (32-bit/64-bit)
  • Mandriva (32-bit/64-bit)
  • Red Hat (32-bit/64-bit)
  • TurboLinux (32-bit/64-bit)
  • Ubuntu (32-bit/64-bit)
  • Xandros (32-bit/64-bit)
  • OL (32-bit/64-bit)
  • Other Linux (32-bit/64-bit)

In the same screen, you have to configure the amount of memory allocated for this VM (see Figure 12-2). Please be aware that the memory that you allocate in the memory size screen will not be available while the guest VM is running. Do not overallocate memory if you are leveraging your machine for other applications such as Microsoft Word, Microsoft Excel, or Microsoft PowerPoint. Microsoft products are notorious for draining memory on the machine when they are being used. To effectively run any Oracle Database 12c, you should allocate a minimum of 4GB of memory and two virtual CPUs (vCPUs). Allocate 4GB for this VM, take the default option to Create a Virtual Hard Drive Now, and click the Create button.

9781484212554_Fig12-02.jpg

Figure 12-2. Creating a new VM

In the next screen, provide some basic information about the virtual hard drive you are creating for the VM. This virtual hard drive will be where you’ll place the Linux OS. Unless you’re planning for this virtual disk to be compatible with VMware or other virtualization technology, choose the default VDI (VirtualBox Disk Image). For VMware-compatible disks, select VMDK (Virtual Machine Disk). Figure 12-3 shows the options for location and size of the virtual disk.

9781484212554_Fig12-03.jpg

Figure 12-3. File location and size for virtual disk for new VM

Select the Dynamically Allocated option to choose a thinly provisioned virtual disk. If you want better performance, you can choose the Fixed Size option. For a fixed size disk, VirtualBox preallocates all the space up front; the dynamically allocated disk allocates disk space only as your usage consumption grows.

For VMDK virtual disks, you also have the option to split the files into 2GB files. This example creates a 64GB disk; if you choose the option to split the files of less than 2GB, you’ll have approximately 32 files. For this VM instantiation, you’ll allocate 64GB for the root and /u01 filesystems. You may opt to create multiple virtual disks: one for the root filesystem and another one for the /u01 filesystem. Click the Create button to create the VM.

Image Note  If you chose fixed size virtual disk(s), you’ll be waiting for a while when you click the Create button. The fixed size disk will consume the entire disk size, even if only a fraction of the disk space is being consumed. A fixed size disk will occupy lots more disk space, but it will incur less overhead.

Once the VDI disk is created with the specified size (thin for dynamically allocated or thick for fixed size provisioned), you’ll be directed back to the Oracle VM VirtualBox Manager screen. You should also notice the newly created VM on the left side of the screen.

How It Works

You just created a VM with one vCPU, 4GB of memory, and a 64GB virtual disk. You should allocate at least two vCPUs for any VM running an Oracle database. You can change the number of vCPUs by clicking the Settings button for the VM and then clicking the Processor button in the middle of the screen. You can increase the number of vCPUs from one to two or even higher.

You can create powerful VMs on enterprise class servers. VirtualBox supports VM configurations up to 32 vCPUs and up to 1TB of RAM for a guest VM.

Like a physical disk, a virtual disk is created with a specified capacity in MB/GB/TB when the image file is created. Unlike a physical disk, a virtual disk can be expanded after it is created, even if data already exists on the virtual disk.

VirtualBox supports four types of virtual disks: a Virtual Disk Image (VDI) file, which is VirtualBox’s native container for virtual disks; VMDK disks, which are leveraged by other virtualization technologies such as VMware; VHD format, which is used by Microsoft; and HDD format, which is leveraged by older versions of Parallels. If you want to expand a virtual disk to a greater size or have all the feature functionality available from VirtualBox, you should select VDI as your disk choice.

You can create Linux guest VMs: Red Hat (5/6/7) and OL (5/6/7) in particular. VirtualBox has limited support for 2.4 kernels; 2.6 and 3.x Linux kernels are fully supported. 32/64-bit Solaris guest OSs are also supported on VirtualBox. Supported versions are Solaris 11, Solaris 11 Express, and Solaris 10 U6 and higher.

12-3. Starting Up a VM for the First Time

Problem

Now that you have created your first VM you want to start installing the OL OS.

Solution

You can configure the VM (in particular, the CD/DVD drive) so that the VM can be started from a bootable ISO image. Click the Settings button in the top-left corner next to the New button to view the general settings for the VM.

A window that looks like Figure 12-4 displays. Click the Storage button in the top middle of the row.

9781484212554_Fig12-04.jpg

Figure 12-4. Storage settings for the VM

On the left side of the screen, choose the IDE controller and click the empty CD icon. On the right side of the screen, click the CD image icon for the CD/DVD drive in the Attributes section (next to the IDE Secondary drop list) and click the Choose a Virtual CD/DVD Disk File option. Find your ISO image for OL 6 from the browser and select OL 6.6 ISO. As a final step, make sure to click the Live CD/DVD check box option.

From the Storage screen, you can click the OK button to go back to the main Oracle VM VirtualBox Manager screen. From the Oracle VM VirtualBox Manager screen, select the VM that you just created and click the green Start icon on the top of the screen. Because you specified the OL 6.6 ISO image to be the virtual CD/DVD disk file, the VM will boot off the OL 6.6 ISO image and start the Linux installation on the VM. For complete step-by-step installation steps of OL 6.6, please visit the DBAExpert.com/blog site and search on Oracle Linux installation.

How It Works

You’ll focus on configuring VirtualBox to create a new VM for OL 6 and installing OL 6 from the ISO image as a guest OS. Oracle 6.7 is the latest and greatest release of OL at the time of writing this book. The OL 6 Update 7 ISO image can be downloaded from edelivery.oracle.com, Oracle’s Software Delivery Cloud. You must have a valid (free) Oracle Account to download the Linux ISO.

Once the Oracle 6 ISO image is set up with the virtual CD/DVD player, click the Start button on the top portion of the Oracle VM VirtualBox Manager (9781484212554_unFig12-01.jpg) or right-click the VM and select the Start option. If you selected the Live CD/DVD option, the installation process starts instantly.

12-4. Creating Additional Virtual Disks

Problem

You want to create additional virtual disks for ASM. You want to create additional disks for the DATA and FRA disk groups.

Solution

To create another virtual disk for the guest VM, you have two options from the Oracle VM VirtualBox Manager. You can either click the storage section of the VM, or click the Setting button next to the New button on the top-left corner and click the Storage button on the middle-top portion of the General screen. From the Storage screen, look for the Serial ATA (SATA) controller and click the Controller: SATA line. A CDROM icon and a disk icon with a plus sign will appear. Click the disk icon with a plus sign, and you’ll see the buttons Choose Existing Disk and Create New Disk (see Figure 12-5).

9781484212554_Fig12-05.jpg

Figure 12-5. Adding a virtual hard disk

Because this is a new virtual hard disk, click the Create New Disk button. You’ll now see the same Hard Drive File Type screen that displays in Figure 12-6.

9781484212554_Fig12-06.jpg

Figure 12-6. Hard drive file type screen for the VM

Choose the VDI (VirtualBox Disk Image) option and click Continue. As you continue with the disk creation process, you’ll be directed to the Storage on Physical Hard Drive screen, in which you have to choose between creating a dynamically allocated disk or a fixed size disk. Choose the Dynamically Allocated option and click the Continue button to proceed to the File Location and Size screen, as displayed in Figure 12-7.

9781484212554_Fig12-07.jpg

Figure 12-7. File location and size screen for the VM

Finally you have to specify the name and size of the virtual disk. For this example, you’ll create a 64GB disk called ASMDISK1. VirtualBox will create a file called ASMDISK1.vdi. Once you click the Create button, you’ll see your virtual disk on the Storage Tree (left side) of the Storage screen, as seen in Figure 12-8.

9781484212554_Fig12-08.jpg

Figure 12-8. Storage tree

You have to repeat these steps for each virtual disk for the ASM disk groups.

Image Note  Alternatively, you’ll see a disk icon with a plus sign on it under the Storage Tree section of the screen. Clicking the disk icon enables you to either create a CD/DVD device or a hard disk.

So far, you have gone through the process of creating virtual disks from the Oracle VM VirtualBox Manager. Now let’s look at creating virtual disks with the command-line interface (CLI). Here’s the command to create a VMDK to provision disks to run Oracle ASM on a Linux VMs:

$ VBoxManage createhd --filename asm1.vmdk --size 4096 --format VMDK --variant Fixed
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Disk image created. UUID: 1e2ab785-7687-42a5-bfd9-28962820f0eb

In this example, you created VMDK format disks so that you can port them to VMware later. To create a VDI disk, simply replace the --format option to be VDI. You should always create a VDI disk if you don’t plan to migrate to another virtualization platform.

How It Works

You want to provision four disks for each of the DATA and FRA disk groups. The differences between VMDK, VDI, VHD, and HDD disks was briefly covered. VirtualBox emulates the four most common types of hard disk controllers: IDE, SATA (AHCI), Small Computer System Interface (SCSI), and SAS. The IDE (ATA) controllers are backward-compatible controllers that came out by IBM PC/AT in 1984 for only hard drives. Later, the support expanded to include CD-ROM drivers and other removable media. In the physical world, IDE standard uses flat ribbon parallel cables with 40 or 80 wires that can connect 2 devices. A VM may have one IDE controller enabled, and an IDE controller can have up to four storage devices attached to it. By default, one of the four devices is preconfigured to the CD/DVD drive, but it can be changed. By default, a new VM has one IDE controller with a CD/DVD virtual drive attached to it as one of the four ports.

SATA is the newer standard that was introduced in 2003. In the physical world, devices attached to SATA controllers can be added/removed while the OS is running. SATA controllers operate faster and are less CPU–resource intensive than IDE controllers. With SATA controllers, VMs can also handle up to 30 virtual disks. VirtualBox leverages the SATA controller as the default controller for virtual disks and attaches the first virtual disk to the SATA controller.

SCSI, another standard that goes back to 1986, is a generic interface for data transfer between all kinds of devices. SCSI controllers are still common today in high-performance servers for connecting hard disks and tape devices. Each SCSI controller can handle up to 15 virtual hard disks. VirtualBox supports LSI and BugLogic SCSI controllers.

Serial Attached SCSI (SAS) is another bus standard in which serial cables are used instead of parallel cables. Serial cables simplify device connections and provide more reliable and faster connections than SATA. You can think of SAS is to SCSI as SCSI is to IDE. VirtualBox emulates LSI Logic SAS controller and supports up to eight devices.

Whether you choose SATA, SCSI, or SAS in VirtualBox, there won’t be much performance difference in your personal desktop. All the controller support by VirtualBox is provided for compatibility with legacy hardware and hypervisors.

12-5. Provisioning/Sharing a Disk with Another VM

Problem

You want to make the virtual disks to be shared disks. Disks created for RAC must be created as shared disks.

Solution

One of the caveats about a shareable disk is that the virtual disk must be created as a fixed size disk in which the disk file fully consumes the allocated space at the time of creation. Once you create virtual disks for ASM disk groups, you can designate them to be shareable with one of the two options: using the VBoxManage (Oracle VM VirtualBox Command Line Management Interface Version) executable or leveraging the Virtual Media Manager.

With VBoxManage modifyhd, you can change the characteristic of a virtual disk and make them shareable, as shown here:

$ VBoxManage modifyhd asm1.vmdk --type shareable

For other options with the modifyhd parameter, issue this command:

$ VBoxManage --help modifyhd

To leverage the Virtual Media Manager, click the File menu from the top-left part of the screen and choose the menu option for Virtual Media Manager. From the Virtual Media Manager, locate your disk, right-click the disk, select the Sharable radio button option, and click the OK button.

After you make the virtual disks shareable, you have to assign them to the second or third or fourth RAC VM. You have to add virtual disks (refer to recipe 12-4), but select the option to choose existing disks (as shown in Figure 12-5) and select the shared disk from the file browser to complete the process for each disk.

How It Works

Shared disks are required for Oracle RAC. Making a virtual disk shareable can be accomplished via the command line with the VBoxManage command or with the VirtualBox Media Manager. For shared disks, you should place the shared disks in a different folder from the VM. We also recommend the following folder topology and virtual disk placement for a RAC configuration:

dallasrac01
dallasrac02
dallasrac_shared_disk
           ov01_disk.vdi
           ov02_disk.vdi
           ov03_disk.vdi
           data01_disk.vdi
           data02_disk.vdi
           data03_disk.vdi
           data04_disk.vdi
           fra01_disk.vdi
           fra02_disk.vdi
           fra03_disk.vdi
           fra04_disk.vdi

You should create separate folders for each node and a dedicated folder for the shared disks. Disks for Oracle Cluster Registry (OCR) and voting files be a minimum of 8GB in size, and we also recommend 3 disks with normal redundancy for the OCR and Vote (OV) disk group. Each OCR file is 400MB in size and each voting file is 300MB in size in Oracle Database 12c. The Grid Infrastructure Management Repository (GIMR) consumes approximately 3.3GB in size and is by default in the same location as the OV files. Starting in Oracle version 12.1.0.2, there are options to move the GIMR to another disk group.

In this example, all the shared disks were intentionally created in a separate folder. You can create a dallasrac03 VM folder from a copy of the dallasrac01 VM folder. As a separate task, you can add the shared disks and easily provision another RAC node into the configuration.

12-6. Configuring the Virtual Network

Problem

You want to configure the virtual network for both private and public network access.

Solution

To create a virtual network within VirtualBox, navigate to the Oracle VM VirtualBox Manager, click the VM for which you want to create a virtual network, and click the Settings button (9781484212554_unFig12-02.jpg) on the top-left corner next to the New button. You’ll see a window with the title - [VM NAME] - General. This screen has eight buttons: General, System, Display, Storage, Audio, Network, Ports, and Shared Folders. Navigate your mouse to the top of the screen and click the Network button on the top of the screen. Figure 12-9 shows four adapters in the Network screen.

9781484212554_Fig12-09.jpg

Figure 12-9. Oracle VM VirtualBox Manager Network screen

You’ll leverage Adapter 1 to be the private network and Adapter 2 to be the public network. The default settings for Adapter 1 are Enabled and NAT.

Click the Attached To: field drop-down list; you’ll see that Oracle VM VirtualBox Manager offers seven different networking offerings: Not Attached, NAT, NAT Network, Bridged Adapter, Internal Network, Host-only Adapter, and Generic Driver. Figure 12-10 displays all the network offerings from the Oracle VM VirtualBox Manager.

9781484212554_Fig12-10.jpg

Figure 12-10. Oracle VM VirtualBox Manager network adapter options

Choose Host-only Adapter for the private network (Adapter 1) and select vboxnet0 for the name. Next, configure the second adapter for the public network interface. Click the Adapter 2 folder, and (for simplicity’s sake), choose Internal Network for the “Attached To:” drop-down list. Click the Enable Network Adapter check box. You’ll see the name of the Internal Network (intnet) displayed.

How It Works

The networking portion of VirtualBox is problematic for lots of DBAs. But with a little explanation, understanding the networking component can be simplified. This section concentrates on four common networking options: Network Address Translation (NAT), Host-only Adapter, Internal Network, and Bridged Adapter. There is also the Not Attached option, but this type is commonly leveraged for troubleshooting. The Not Attached mode implies that there is a network card but no network connectivity. You can think of it as having an Ethernet cable that is not plugged into the network interface card.

NAT, which is the default networking mode for VirtualBox, provides the simplest way to access an external network. NAT is popular because it typically doesn’t require any changes to the host or guest OS. With NAT, you can surf the Web, check e-mail, and download files from the guest VM, but the outside world can’t communicate with the guest VM. NAT enables the guest VM to reach the Internet via a private IP address that can’t be seen from the host or the rest of the network. When the guest VM sends an IP packet to a remote server, the NAT service does the following:

  • Intercepts the packet
  • Extracts the TCP/IP segments
  • Manipulates the IP address to the IP address of the host machine
  • Sends the packet to the remote server

To the outside world, only the IP address of the host machine is revealed. Reply packets are received by the host and sent on to the guest VM.

With the Host-only Adapter, you can create a virtual network between the host and a set of VMs. Similar to a loopback interface, you can establish connectivity between the VMs and the host.

With the Bridged Adapter, VirtualBox interfaces directly to the network interface and exchanges packets directly, bypassing the host OS’s network layer. You can connect to the same switch/router that the host OS is connected to and obtain an IP address that is on the same subnet as the host. The guest VM can act like an equal citizen as the host and be presented like any other server on the network.

Internal Networking (or isolated network) is similar to the bridged networking in the sense that the VM can communicate with the outside world. With Internal Networking, the outside world can see only the other VMs on the host that are connected to the same internal network, so it is considered more secure. Internal networks are created automatically and identified by name.

12-7. Leveraging/Creating Oracle VM VirtualBox Prebuilt Templates

Problem

You want to leverage the prebuilt Oracle VM VirtualBox templates that Oracle has created and reduce the amount of time to stand up an environment. You want to create an Oracle VM VirtualBox template to share with another DBA or to another organization. You also want to share the Oracle VM VirtualBox template with VMware folks.

Solution #1: Leveraging Oracle’s Prebuilt Template

This solution looks into leveraging an Oracle template for the OL 6 Admin. Start by downloading the OL 6 Admin VM (OracleLinux65.ova) file from the Oracle web site: http://www.oracle.com/technetwork/community/developer-vm/index.html.

Image Note  You can download numerous prebuilt templates from Oracle. Be careful: some of the templates are only for Oracle VM, not for VirtualBox.

Once the download of the .ova file completes, navigate to the File menu and select the Import Appliance option. You’ll see an Appliance Settings window, in which you specify what to import. Click the file browser, find the .ova file that you downloaded, and click the Continue button.

From the Appliance Settings screen (see Figure 12-11), you can review the specifications of the VM and modify components such as the name of the VM or whether you want to enable the CD/DVD player or the sound card. You also have the option to reinitialize the MAC address of all the network cards.

9781484212554_Fig12-11.jpg

Figure 12-11. Import Appliance: Appliance Settings screen

Click the Import button to start the import process. You’ll be immediately directed to the terms and conditions and software license agreement screen. You must agree to the terms and license agreements before the process starts. Once you click the Import button, it should take less than couple of minutes for the import of the OL 6 Admin VM to complete. You’ll see Oracle Virtual Sysadmin Days (Powered Off) when the import is complete.

Solution #2: Creating Your Own OVA Template

You can create your own template in the form of an .ova file. Choose the VM that you want to create an Open Virtualization Archive or Application (OVA) template for, go to the File menu, and select the Export Appliance option. Choose the location and version of the Open Virtualization Format (OVF) file that you want to create and click the Continue button. By default, VirtualBox defaults to OVF 1.0 format. You have the option to select the Write Manifest File check box.

In the Appliance Settings screen, review the VM that you are about to export. After you make the changes that you want and review the configuration specification, click the Export button to start the OVA creation process. The amount of time that it takes depends on how many virtual disks you have, the size of the virtual disks, and how much data are in the virtual disks.

How It Works

Oracle provides numerous prebuilt templates for various Oracle products, including OL and Oracle Solaris 10/11. You can save hours and days by leveraging the prebuilt templates for instant VM provisioning. Oracle recommends using its prebuilt templates for development and education purposes, but they should never be used for production environments. For the OL 6 Admin VM, you need at least 2GB of RAM and 10GB of free disk space. You also have to know the password for the root and oracle accounts: ‘oracle’ (without the single quotes).

OVF is a packaging standard designed to address the portability and deployment of a VM or appliance so that it can be imported and be leveraged with other virtualization technologies. With the OVF standard, you can create a VM package that can be deployed between VMware Player and VirtualBox. The OVF package can be stored in an OVA, a single file distribution using the TAR format. You can think of an OVA as a single compressed and "installable" version of a VM.

You can take an OVA file, rename it to a .tar file and execute a tar command with the –tvf options (t=list contents to standard out; v=verbose; f=read the archive from the specified file) to list the contents of the original .ova file:

$ mv OracleLinux65.ova OracleLinux65.tar
$ tar -tvf OracleLinux65.tar
-rw------- 0 someone 46184 Dec 6 2013 OracleLinux65.ovf
-rw------- 0 someone someone 2189755904 Dec 6 2013 OracleLinux65-disk1.vmdk
-rw------- 0 someone someone   68096 Dec 6 2013 OracleLinux65-disk2.vmdk
-rw------- 0 someone someone   68096 Dec 6 2013 OracleLinux65-disk3.vmdk

The OVF format has two standards that you have to be concerned with. The OVF 1.0 standard provided the standardized virtualization format that solved the critical business need for software vendors and cloud providers. OVF 1.0 was widely adopted and became an international standard adopted by ISO/IEC in 2011.

The OVF 2.0 standard provides additional capabilities over the 1.0 format for improved network configurations, shared disks, more flexible scaling/deployment options, and basic placement policies such as affinity rules and encryption capabilities.

12-8. Cloning a VM

Problem

You want to clone a VM to create another VM.

Solution

To clone an existing VM from the Oracle VM VirtualBox Manager, right-click the VM and select the Clone option, as displayed in Figure 12-12.

9781484212554_Fig12-12.jpg

Figure 12-12. Cloning a VM

You’ll see the option to clone a VM only if the VM is powered off. In the first screen of the cloning process, you must provide a name for the new VM that you are about to create from the clone. You also have the option to reinitialize the MAC address of all the network cards during the cloning process. After you supply the name of the cloned VM, click Continue to proceed. You’ll be directed to the Clone Type screen, as shown in Figure 12-13.

9781484212554_Fig12-13.jpg

Figure 12-13. Clone Type screen

The Clone Type screen shows two options: Full Clone and Linked Clone. In this example, choose the Full Clone option and click the Clone button. Depending on the size of the virtual disks, you’ll see a status window indicating progress of the copy of virtual disks and such. Once the cloning process is complete, you’ll land back at the Oracle VM VirtualBox Manager screen.

For the Linked Clone option, you’ll see on the name of the VM (Linked Base for AP02) on the VM library on the left of the screen.

How It Works

As you have seen in this solution, cloning a powered-off VM is extremely simple. The full clone represents an exact copy of the source VM, including all the virtual disks. Alternatively, you can create a linked clone in which the virtual disks will be tied to the virtual hard drives files of the original VM. With linked clones, a new snapshot will be created for the original VM as part of the cloning process. Only changes to the cloned VM will be written to disk.

In this example, choose the option to fully clone the source VM. With the full clone type, the amount of time it takes to create a clone VM is directly correlated to the size of the virtual disks of the source VM. For larger files, it will take longer to perform a full clone. For linked clones, the cloning process is almost instantaneous. You can create linked clones in minutes from the source VM. For linked clone types, it operates in the copy-on-write technology.

12-9. Working with Snapshots

Problem

You want to create a snapshot of the VM to revert back to in the event of a catastrophic situation such as a failed OS upgrade or failed database upgrades.

Solution

To create a VM snapshot, you have to be in the Oracle VM VirtualBox manager. From there, you can click the Snapshots button on the top-right corner of the screen. The Snapshots button has a little camera on the left of the button label and also has the number of snapshots taken in parentheses.

Figure 12-14 shows that three snapshots already exist for the current VM called den00. If you look at the left side of the Oracle VM VirtualBox Manager, you’ll see that next to the VM den00 is the snapshot name of the latest snapshot taken: (My Snapshot).

9781484212554_Fig12-14.jpg

Figure 12-14. Snapshot inventory

You can perform a snapshot from the Current State. You can also start the clone process from the Current State or any of the previous snapshots that were taken. If you navigate to previous snapshots and right-click a snapshot name, you can also restore the VM from that specific snapshot or even delete the snapshot to clean up space.

Figure 12-15 reveals the options available for a snapshot. You can also look at detailed information about the snapshot by choosing the Show Details option.

9781484212554_Fig12-15.jpg

Figure 12-15. Snapshot options

You can revert the VM back to a previous snapshot by choosing the Restore Snapshot option. You’ll see a warning window that asks whether you’re sure you want to restore the snapshot. If you click the Restore button, your VM will be restored to the point-in-time snapshot that was taken.

How It Works

The VM can be online or be powered off to take a point-in-time snapshot. For Oracle databases, you should always create a snapshot of the VM from the powered-off state. This way, all the Oracle header files are consistent because the database should also be offline, and you have a cold backup of the database. If you’re working on an application server or web server, you may opt to take a snapshot while the VM is online.

To perform a live snapshot, navigate to the Machine menu option on top of the screen and choose the Take Snapshot option, as displayed in Figure 12-16.

9781484212554_Fig12-16.jpg

Figure 12-16. Taking an online snapshot

Figure 12-14 shows five buttons on the right pane window. The first camera button creates a snapshot. The second button, with the semicircle arrow on the camera, restores a snapshot. The third button, with an X on the camera, removes a snapshot. The fourth button has a little circle at the bottom-right corner of the camera. You can look at the details of the snapshot such as when the snapshot was taken and additional documentation for the snapshot. The fifth button, which looks like a paste icon, is the cloning button. With this button, you can clone any snapshot to create a new VM.

This example demonstrates how to leverage the CLI to perform snapshots. You can perform a snapshot with the snapshot option and pass additional parameters to create a snapshot (the take option of the CLI) and provide a name and description for the snapshot:

$ vboxmanage snapshot den00 take "CLI Snapshot" --description "Snapshot was taken via CLI"
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

You can list all the snapshots that were taken with the snapshot [VM Name] list parameters:

$ vboxmanage snapshot den00 list
  Name: Den01_b4_upgrade (UUID: fa8c8efc-6c29-49cd-81a0-7339da706bc0)
  Description:
Before our 12.1.0.2.2 upgrade
   Name: Before_VB_Guest_Additions (UUID: f0d88500-e06c-460e-93df-9fb31608fe30)
     Name: My Snapshot (UUID: e18a1bb0-a31d-4301-9184-a3f35fb3d53a)
     Name: CLI Snapshot (UUID: a692d5bd-b0bc-43de-91f6-582045ddf8ab) *
     Description:
Snapshot was taken via CLI

If you want to review all the options for managing snapshots with the vboxmanage CLI, provide the –help option followed by the keyword snapshot, as shown here:

$ vboxmanage --help snapshot
Oracle VM VirtualBox Command Line Management Interface Version 4.3.26
(C) 2005-2015 Oracle Corporation
All rights reserved.

Usage:

VBoxManage snapshot     <uuid|vmname>
              take <name> [--description <desc>] [--live] |
              delete <uuid|snapname> |
              restore <uuid|snapname> |
              restorecurrent |
              edit <uuid|snapname>|--current
                 [--name <name>]
                 [--description <desc>] |
              list [--details|--machinereadable]
              showvminfo <uuid|snapname>

As you can see, you have other options to delete a snapshot, restore a snapshot, edit a snapshot, show details for a snapshot, and even take a live snapshot with the --live option.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset