oracledba.help
SpecialTopics

VirtualBox 6.x

Overview

The following covers the essential steps to implement Oracle VirtualBox on a Windows system.

For optimal performance of your VMs:

  1. Ensure your bios is set to enable VT (Virtualization Technology).
  2. Set Power Options to use the (x) High performance power plan.
  3. Use Fixed disks for your VMs as opposed to Dynamic.
  4. Ensure your virus scan software excludes your VirtualBox directories.
  5. Use the baseline settings in your VM's shown here.
  6. With no VMs active, defrag the drive with your VMs.
    Use Defraggler by Piriform\Ccleaner. It is much better than Windows defrag!

If your system is still slow after the above try this.

Keyboard Essentials

  • Use Right Ctrl key to move mouse outside of VBox window.
  • Use Right Ctrl-F to restore a VBox window if inadvertently made an odd size.

Prerequisites

  • Download Oracle VM VirtualBox
    Example: Oracle VM VirtualBox Base Packages - 6.1.0 -> Windows Installer
  • Download Oracle VM VirtualBox Extension Pack
    Example: Oracle_VM_VirtualBox_Extension_Pack-6.x.x-nnnnnn.vbox-extpack
  • Download the Corresponding Guest Editions .iso.
    Example: VBoxGuestAdditions_6.1.0.iso
  • Download or have available your OS iso files.
  • Create work directories that the VMs can access from the host system.
    Place the corresponding software in the volumes or directories.

      Your software directory:
        C:\software 
      A directory for ISO files used to create new VMs:
        C:\software\iso
      A directory for VM files:
        C:\VirtualBoxes
    

Installation

Run: VirtualBox-6.x.x-nnnnnn-Win.exe

 1. Welcome
    [Next]
 2. Custom Setup
    a. Features
       [Next] (accepting defaults)
    b. Options
       [Next] (accepting defaults)
 3. Warning: Network Interfaces
    Note that you will lose connectivity temporarily during this process.
    Proceed: [Yes]
 4. Ready to Install
    [Install]

    Installation process runs...

 5. Windows Security Popup
    Would you like to install this device software?
       Always trust software from "Oracle Corporation"
      [Install]

 6. Oracle VM VirtualBox 6.x.x installation is complete.
     Start Oracle VM after installation
    [Finish]

    The Oracle VM VirtualBox Manager will launch.

Configure Preferences

From File -> Preferences:

 General
   Default Machine Folder: C:\VirtualBoxes
 Update
   ☐ Check for Updates
 Extensions
   Add Package button (small right button).
   Filename: <PathToExt>Oracle_VM_VirtualBox_Extension_Pack-6.x-nnnnnn.vbox-extpack

Create Virtual Machine

Configure VM

Example here is of Oracle Linux 7 Server but are generally the same for all OS's.
Select New:

 Name and operating system
   Name:        OL74
   Main Folder: C:\VirtualBoxes
   Type:        Linux
   Version:     Oracle (64-bit)
 Memory size
   size: 9728 (set to your required value - 19c min displayed)
 Hard disk
   🖸 Create a virtual hard disk now
 Hard disk file type
   🖸 VDI
 Storage on physical hard disk
   🖸 Dynamically allocated
 File location and size
   Name of new VM:       OL74
   Size of virtual disk: 128 GB
 [Create]

  VM settings
  Configure baseline VM settings. <- Don't skip this step!

For version 6.x you may need to set: System -> Pointing Device to USB Tablet or your mouse may not be visible.

VM OS Installation

  1. Select the Start button.
  2. Follow normal OS installation.

Install Guest Additions

Prerequisite

Linux 8.5 or later

 0. Make sure in Settings\General: Advanced -> Shared Clipboard = Bidirectional
 1. Update Linux
    yum repolist
    yum search release-el8 
    yum update -y
 2. Reboot.
 3. yum -y install kernel-uek-devel-`uname -r`
 4. Unmount any .iso disks.
 5. Mount\run the latest Guest Additions version .iso (ex: 6.1.32).

DL latest Guest Additions. 6.1.32 example here.

Archived\Obsolete Notes
For Oracle Linux 8.x make sure to install zlib and elfutils:

 From Devices, remount the OL8 .iso.

 As root,
 cd /run/media/root/OL-8-1-0-BaseOS-x86_64/BaseOS/Packages
 rpm –ivh zlib-devel-1.2.11-10.el8.x86 64.rpm
 rpm-ivh elfutils-libelf-devel-0.176-5.el8.x86_64.rpm
 OR
 yum install zlib-devel
 yum install elfutils-libelf-devel

 For 8.4 and Later Also Do this:
 yum -y install gcc make
 yum -y install kernel-uek-devel-`uname -r`

 From Devices, unmount the OL8 .iso.

More details on this here .

Procedure

 1. Start VM on LINUX and login as root (on Windows login as Administrator).
 2. From vbox menu: 
    - Select: Devices
    - Select: Optical Drive
    - Choose disk image: VBoxGuestAdditions_6.x.x.iso
 3. Run install for Guest Editions from mounted .iso drive (if does not auto-run).
    - Accept defaults.
    - Process runs.
    - Restart VM\OS when done.

On LINUX systems you should see a shortcut on the desktop for each shared folder.

Ubuntu: Guest Editions - Manually Installing

mkdir -p /media/cdrom
sudo mount /dev/sr0 /media/cdrom
sudo sh /media/cdrom/VBoxLinuxAdditions.run
   Process runs...
sudo -i shutdown -h now

OS Cheat Sheets

RHEL7\CentOS 7\Oracle Linux 7

For Linux OS for Oracle go here?.

Windows 2012

Language to install:      English
Time and currency format: English
Keyboard of input method: US
[Install now]

Version
 Windows Server 2012 R2 Standard (Server with a GUI)
License
 [x] I accept the licence terms
Type
 Custom: Install Windows only (advanced)
Where
 Used selected drive.
 - Create any drives as needed.
   Process runs...
Settings
 Username: Administrator
 Password: VeryComplexPW1!

Post Install
 - Set PageFile (RAM * 2.5)
 - Set autologin via SysInternals AutoLogon tool.
   https://technet.microsoft.com/en-us/sysinternals/bb963905
 - Defrag disk(s).

Windows 2008

- Windows 2008 R2 Standard (Full Installation) x64
- License Terms: Accept
- Custom (advanced)
- Drive Options - choose: Disk 0 Unallocated Space
  Process runs and multiple reboots will occur.
- On first login set password: [OK]
  Administrator\<EnterStrongPassword>

Windows XP

- English (United States)
- Press Enter to Continue and install OS.
- Accept device settings detected.
- C = Create Partition then ENTER to Install
- Format partition as NTFS (quick format) \\
  Install reboots VM at this point in install... 
- Initial Boot into GUI
  * Welcome [Next]
  * Regional and Language Options [Next]
  * Name: WinXP_VBox, Org:
  * Product Key:

- Computer Info
    Name (WINXP-XXXXXXX)
    Password: ********
  - Date and Time
    (GMT-0500) Eastern Time
    [ ] Auto adjust clock of daylight savings changes
  - Network: (x) Typical
  - Registering Components ...
  - [Finish]

Create a Shared Folder

  1. Ensure the dir to share exists on host systems hard drive.
    • Example: C:\software
  2. Go to: Settings -> Shared Folders
  3. Select Add Folder button on right.
  4. Select host folder: C:\software
    • Folder name: software
    • ☐ Read-only
    • ☑ Auto-mount

Create ifg File

  1. cd to /etc/sysconfig/network-scripts
  2. vi ifcfg-<InterfaceMatchingMAC> and Set Values

Example: /etc/sysconfig/network-scripts/ifcfg-enp0s9

DEVICE=enp0s9
BOOTPROTO=none
ONBOOT=yes
PREFIX=24
IPADDR=192.168.1.50

Edit /etc/hosts

Add new IP to hosts file. Example:

192.168.1.50    db01

If need be, set system hostname using: hostnamectl set-hostname <hostname>

Bounce VirtualBox.

Create Virtual Machine for ASM (RHEL7 Example)

Change as needed for your testing environment.

Configure Core VM

  1. Select New toolbar button.
  2. Name and Operating System
    • Name: [MyOSName]
    • Type: Linux
    • Version: Red Hat (64-bit)
  3. Memory Size At least 1024mb
  4. Hard Drive
    • (x) Create a virtual hard drive now.
    • [Create]
  5. Hard Drive File Type
    • (x) VDI
  6. Storage On Physical Hard Disk
    • Fixed Size
  7. File Location and Size
    • 25gb
    • [Create]

Create Shared Disk

Create Disks for ASM Groups: GRID, DATA and FRA.

Considerations

A useful shared disk convention is:

 D:\VirtualBoxes\zShared\RAC1_ASM_GRID.vdi  55g
 D:\VirtualBoxes\zShared\RAC1_ASM_DATA.vdi  20g
 D:\VirtualBoxes\zShared\RAC1_ASM_FRA.vdi   20g

Then for each test RAC just change\increment RAC1_. Ex: RAC2_

Process

  File 🠊 Virtual Media Manager

  [Create]
  (x) VDI
  (x) Fixed size
  File location and size
    <Path>\ASM_GRID.vdi
    55.00 GB
    [Create]

  [Create]
  (x) VDI
  (x) Fixed size
  File location and size
    <Path>\ASM_DATA.vdi
    20.00 GB
    [Create]

  [Create]
  (x) VDI
  (x) Fixed size
  File location and size
    <Path>\ASM_FRA.vdi
    20.00 GB
    [Create]

Disks must be Fixed (not Dynamic) to be shareable.

Make Disks Sharable

 File 🠊 Virtual Media Manager
   Type: Sharable

Attach New Disks to Node 1 VM

  Select VBox [Settings] 🠊 [Storage] 🠊 Controller: SATA 

  [Add Hard Disk]
    Select: ASM_GRID.vdi [Choose]
  Add Hard Disk
    Select: ASM_DATA.vdi [Choose]
  Add Hard Disk
    Select: ASM_FRA.vdi [Choose]
  [OK]

After above completed, Add disks to other nodes\VMs.

RAD Vbox Backup\Restore

This is not a supported way to save/restore images in VirtualBox, but it is very simple and worked well. The restore is limited to the VirtualBox setup where images were saved.

Stop both VMs. Find the location where VB stores images: Main menu | File | Preferences | General, "Default Machine Folder" box. For example: "C:\Users\scott\VirtualBox VMs". Go to this folder and locate "rac1", "rac2" directories and "rac_shared_disk1.vdi" file. Make a .zip or .rar file containing these three items. If you don't have compressing tools and there is enough disk space, you can copy these three items to another location. The images are saved!

In order to restore these images:

  1. Make sure VMs are stopped.
  2. Go to the "VirtualBox VMs" folder and delete "rac1", "rac2" directories, and "rac_shared_disk1.vdi" files.
  3. Restore these three items from the .zip file or copy from the location where these items were saved

The restored VMs are ready to run.

Auto capture keyboard, Disable Notification

  • To remove the message once: click the X button.
  • To remove the message once and for all: click the crossed-out balloon next to the X.

Baseline VirtualBox Defaults

General

 • Advanced: Shared Clipboard: Bidirectional

System

 • Base Memory: 4096mb (minimum for RAC 9216mb).
 • ☐ Floppy (disable)
 • Pointing Device: USB Tablet (to fix bug where mouse disappears)
 • Processors: 2 (minimum for RAC 4).
 • Acceleration -> Paravirtualization Interface:
      If Windows  7 host: None
      If Windows 10 host: Default (with VBox 6.1.0 or later)
        - If create DB (via dbca) takes excessive time try setting this to None.
        - Monitor CPUs too (increase if required).
        - Also for SGA/PGA try: 1536m\256m as minimums.

Display

 • Video Memory: 128mb 
• Enable the acceleration options possible (3D Acceleration etc.).

Storage

 • Controller: IDE  ->  Optical Drive: ->  <Choose Linux ISO for Install>
 • Controller: SATA:
      If Windows  7 Host: ☑ Use Host I/O Cache
      If Windows 10 Host: ☐ Use Host I/O Cache ==> HUGE Performance bug in 5.2x if enabled!

Shared Folders

 • F:\sw: ☑ Auto-mount

Interfaces for RAC

  • Adapters 1 & 2 used for local and Internet connectivity.
  • Adapters 3 & 4 used for RAC.

Settings -> Network
Adapter 1

[x] Enable Network Adapter
Attached to: NAT

Adapter 2

[x] Enable Network Adapter
Attached to: Host-only Adapter
Promiscuous Mode: Allow All

Adapter 3

[x] Enable Network Adapter
Attached to: Internal Network
Name: pubnet
Promiscuous Mode: Allow All

Adapter 4

[x] Enable Network Adapter
Attached to: Internal Network
Name: privnet
Promiscuous Mode: Allow All

Note the MAC addresses - they will be needed in OS install.

Linux Preferences

Disable Power Saving (screen saver)

 Applications -> System Tools -> Settings
 Power -> Blank screen: Never

Disable Screen Locking

 Applications -> System Tools -> Settings
 Privacy -> Screen Lock -> Automatic Screen Lock: OFF

Misc Checkoff

 - Baseline VM settings in place.
 - OS Software Updated.
 - .bashrc Common Aliases set.
 - initLnxForOra.sh (12.2.x) run.
 - Oracle's Preinstallation rpm installed.
 - Logged into GUI as root, grid and oracle. 
   -- Disabled screen saver.
   -- Disabled screen locking.
 - Additional rpms installed: cvuqdisk-1.0.9-1,Flash, rlwrap, dconf-editor.
 - gnome, Changed default app settings (gedit, nautilus).

Network Interface Change Bug

Topic

 From GUI: Applications -> System Tools -> Settings -> Network

If you to change a network interface IP and do not need a Gateway:

  1. You may need to put in a bogus Gateway address (0.0.0.0) to be able to hit Apply.
  2. Then after you save it, turn the interface Off then On to bind it.

Network, Stopping Excessive Outbound Traffic

If excessive data is being sent from a VM and you do not require constant connection to the Internet or a Host-only Adapter, this can be remedied by disabling the NAT adapter. You can re-enable it at times when you need to update the OS\packages or make other connections to the Internet.

Disabling your NAT interface under most conditions should not interfere with any VBox-to-VBox connections (like for RAC or Data Guard).

If your host system is Windows you can easily validate how much data is being sent by:

  1. Run the Task Manager.
  2. Select the Performance tab.
  3. Select Ethernet.
  4. Observe the Send and Receive kps.
    The Send Kps should generally be less than 100 if not tending to be 0 (zero).

Enable High Performance

This snippet came from this link.

Windows 10 Pro users can lock in the power plan using Group Policy Editor

First set the power plan, but don't reboot right away. To do this, run CMD prompt as admin In the command prompt, type powercfg –restoredefaultschemes and press Enter.

Go to Control Panel > Power Options and select High Performance from Control Panel > Power Options, but do not reboot the PC yet.

Make whatever custom changes you want to your High Performance plan using Change plan settings > Change advanced power settings, but still do not reboot the PC yet.

Now from the taskbar search type gpedit.msc and run as admin. This opens Group Policy Editor

Navigate to Computer Configuration -> Administrative Templates -> System -> Power Management

In the right hand pane double click on "Select an active power plan" In the window that pops up select "Enabled" This will allow you to then select "High Performance" from the drop down menu Select Apply and OK to close out Now reboot the PC.

When you go to Control Panel > Power Options it will say "Some settings are managed by your system administrator", with the options below that grayed out. But you should be able to see below that it's set at High Performance, even though the option to change settings will be grayed out as it's now handled by Group Policy Editor.


Get VirtualBox Version

VirtualBox Version

 /usr/sbin/VBoxService --version

Guest Editions Version

 lsmod | grep vboxguest

You can also use this to see if the Guest Editions has been installed.


Window Position Setting

Global Values

  • Set global settings from here: File 🠊 Display: Width and Height
    Values written here: C:\Users\<UserName>\.VirtualBox\VirtualBox.xml

VM Instance Values

  • The values are stored in your VirtualBox dir <VMname>.vbox
    • Value: <ExtraData><ExtraDataItem name="GUI/LastNormalWindowPosition"
      value="<Absolute upper-left X>,<Absolute upper-left Y>,800,642"

Example 1

 <ExtraDataItem name="GUI/LastNormalWindowPosition" value="11,36,800,642"/>

Example 2

 <ExtraDataItem name="GUI/LastNormalWindowPosition" value="988,25,800,642"/>
  • If values set to invalid values they may be changed.
  • X=Horizontal - Y=Vertical

VBoxManage Session Example

 cd C:\Program Files\Oracle\VirtualBox
 VBoxManage setextradata zLnx01 GUI/LastNormalWindowPosition 11,36,800,642
 VBoxManage setextradata zLnx02 GUI/LastNormalWindowPosition 929,36,800,642

 VBoxManage setextradata zLnx01 GUI/LastGuestSizeHint 11,36,800,642
 VBoxManage setextradata zLnx02 GUI/LastGuestSizeHint 929,36,800,642

You might also need to manually move the VM window to have it detect a change and set flag. THEN run VBoxManage. Crazy!


Resize VBox & Linux Disk\Partition: GUI

Disk must be created as Dynamically allocated to use this option to resize.

VirtualBox

 - Create VM.
 - From VM Create a new disk to attached to this VM.
   -- File -> Virtual Media Manager
      [Create]
        (x) VDI
        (x) Dynamiclly allocated
        Location: D:\VirtualBoxes\Shared\data01.vdi
        1.00 GB
        [Create]  
    -- Select: VBox VM -> Storage -> Controller: SATA -> Add Hard disk
       Scroll down to "Not Attached" and select and [Choose]
       [OK]

Linux

 - Start Linux OS and login as root.
 - Create LINUX disk partition for newly added disk.
   -- Confirm new disk attached and correct size: lsblk
   -- Partition disk: fdisk /dev/sdb
   -- Confirm new partition and size: lsblk
 - Shutdown Linux OS

Resize VMWare Disk

 - File -> Virtual Media Manager
 - Select Disk
 - Increase the value of Size.
   Ex: If 1.00 GB set to 2.00 GB
   [Apply]

Resize Linux Partition

 From this point you can use parted and resizepart cmd.

Resize VBox & Linux Disk\Partition: Cmd Line

 • lsblk shows Vbox Virtual size.
 • VBox disk must be Dynamic to resize.
   If disk is not Dynamic you can: 
   a. clone it
   b. resize the clone
   c. re-attach cloned disk (removing original)

   VBoxManage clonehd mydrive.vdi newdrive.vdi --variant Standard
   VBoxManage modifyhd --resize 8096 newdrive.vdi
   VBoxManage clonehd newdrive.vdi newdriveFixed.vdi --variant Fixed

VBoxManage Disk Commands

 VBoxManage clonehd [old-VDI] [new-VDI] --variant Fixed
 VBoxManage clonehd [old-VDI] [new-VDI] --variant Standard
 VBoxManage modifyhd [VDI] --resize [megabytes]

Standard = dynamic.

Resize Session

- Create partition using fdisk.
  lsblk
    sdb           8:16   0  3.4G  0 disk 
    +-sdb1        8:17   0  3.4G  0 part

- Resize Disk at VBox Level
  set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"
  cd "C:\Program Files\Oracle\VirtualBox"
  VBoxmanage.exe modifyhd "C:\VirtualBoxes\OL74_DiskTest\xxxxTest1.vdi" --resize 4000
  0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

  Note: In VBox it will be the "Virtual Size" that is increased not the "Actual Size"

- Increase Linux Partition
  lsblk
    sdb           8:16   0  3.9G  0 disk 
    +-sdb1        8:17   0  3.4G  0 part

  parted  
    (parted) select /dev/sdb
    (parted) print
      Number  Start   End     Size    Type     File system  Flags
       1      1049kB  3670MB  3669MB  primary

    (parted) resizepart
      Partition number? 1
      End? 4G
    (parted) quit

  lsblk
    sdb           8:16   0  3.9G  0 disk 
    +-sdb1        8:17   0  3.7G  0 part

APPENDIX

Install Updates (Linux)

  1. Ensure Guest Editions installed and can ping Internet.
  2. Menu: Applications -> System Tools -> Applications Installer
  3. Click Updates button at top.
  4. Click the Refresh button at topic left.
    Checking for updates will be displayed.
    This may take several minutes...
  5. Select the Restart & Install button at top.

You may have to reinstall the Guest Editions CD if large update.

More Optimization Tips to Try

  • Disabling real-time virus protection.
  • Setting System->Motherboard: Chipset from default PIIX3 to ICH9.
  • Setting Display->Screen: [x] Enable 3D Acceleration.
  • Making your OS disk Dynamic and any data disks Fixed.

Video Hot Keys

Assuming RightCtl is your host key:

 RightCtl-C: Scale Mode Toggle
          Menu access: Right-HOME
 RightCtl-L: Seamless Mode
 RightCtl-F: Full Screen Mode
 RightCtl-A: Window Size, Adjust

<- SpecialTopics