Deploy Oracle RAC Test Environment Quickly with VirtualBox & Vagrant
Learn how to rapidly set up an Oracle RAC testing cluster using VirtualBox and Vagrant, covering the reasons for avoiding Docker, required software versions, Vagrantfile configuration, shared disk creation, network setup, and step‑by‑step commands to launch and access the virtual machines.
Background
Recently a project required building an Oracle RAC environment for testing. The usual OpenNebula VM provisioning cannot handle the shared disk requirements of RAC, so an alternative method is needed.
This article shows how to use VirtualBox + Vagrant to quickly deploy an Oracle RAC test environment.
Software Introduction
VirtualBox is a lightweight virtualization engine that can create isolated VM environments.
Vagrant is an automation tool that manages VM lifecycles via a declarative Vagrantfile.
Current versions: VirtualBox 7.1.10, Vagrant 2.4.7.
Why Not Docker?
Considerations include:
Physical storage layer
Oracle RAC relies on ASM and requires direct access to raw block devices, which Docker volumes cannot provide even with --privileged and cgroup restrictions.
Network architecture layer
RAC needs a dedicated heartbeat network, virtual IP failover, and SCAN resolution. Docker’s overlay network adds latency and conflicts with required networking tools.
Kernel and resource isolation layer
RAC requires strict isolation and kernel modules (e.g., oracleasm) that cannot be installed inside Docker containers because they share the host kernel.
Advantages of the VirtualBox Solution
True VM‑level isolation : each node runs its own kernel.
Native block device support : shared disks can be created with VBoxManage.
Free network configuration : Host‑Only networking provides zero‑loss communication.
Configuring Vagrant
1. Initialize the Vagrant environment
Run the initialization command in the Vagrant installation directory (e.g., C:\Program Files\Vagrant) to generate a Vagrantfile.
2. Create the Vagrant configuration file
Edit the generated Vagrantfile to define two RAC nodes. The effective configuration is shown below.
Vagrant.configure("2") do |config| // specify 2 VMs
config.vm.box = "CentOS7u2" // OS box
config.disksize.size = "20GB" // root disk size (requires vagrant-disksize plugin)
# RAC node 1
config.vm.define :rac1 do |rac1|
rac1.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--name", "rac1", "--memory", "2048"]
end
rac1.vm.box = "CentOS7u2"
rac1.vm.hostname = "rac1"
rac1.vm.network :public_network, ip: "192.168.56.11", :adapter => 2
rac1.vm.network :private_network, ip: "10.10.10.11", :adapter => 3
end
# RAC node 2
config.vm.define :rac2 do |rac2|
rac2.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--name", "rac2", "--memory", "2048"]
end
rac2.vm.box = "CentOS7u2"
rac2.vm.hostname = "rac2"
rac2.vm.network :public_network, ip: "192.168.56.12", :adapter => 2
rac2.vm.network :private_network, ip: "10.10.10.12", :adapter => 3
end
end3. Install the vagrant-disksize plugin
Use config.disksize.size to enlarge the root partition (recommended 20‑30 GB).
4. Download and add a box image
Choose a CentOS 7 box (e.g., bento/centos-7.2 ) and add it with the same name used in the Vagrantfile ( CentOS7u2 ).
5. Create shared disks
Use VBoxManage to create fixed‑size VDI files and mark them as shareable.
VBoxManage createhd --filename "D:\VirtualBox VMs\ocr1.vdi" --size 1024 --format VDI --variant Fixed
VBoxManage modifyhd "D:\VirtualBox VMs\ocr1.vdi" --type shareable
... (repeat for other disks) ...6. Create and start the VMs
Run vagrant up to launch the two RAC nodes.
7. Log into the VMs
Use vagrant ssh (default user vagrant , password same as username) or other shells such as Git Bash.
Note: If you cannot reach the VM, change the second network adapter from bridge mode to Host‑Only.
Summary
This guide demonstrates how to use VirtualBox + Vagrant to quickly provision a virtual environment suitable for an Oracle RAC cluster, emphasizing multi‑NIC configuration, shared disk creation, and resource sizing.
Be aware that insufficient VM resources (e.g., only 2 GB RAM) can cause installation issues.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
