An initiative of Mobiliar IT

Setup Oracle Test Environment with Vagrant in one command

Hello, everybody. I am one who often needs an Oracle test environment to test or verify something. Up to now, a Virtual Box environment had to be set up and configured for this purpose. This was sometimes quite time consuming and when I didn’t do it regularly I had to keep looking up how certain things work in Virtual Box.
The following work has to be done to set up an Oracle environment:

  • Configure Network in Virtualbox (NAT, Port Forwarding)
  • Setup Operating System
  • Configure Network of OS
  • Install required Packages to install Oracle Binaries
  • Install Binaries and setup network settings (listener, sqlnet)
  • Setup Oracle Database

Finally, after all these tasks, it is possible to test something that may only take a few minutes.
There are great news now, because this is history now. Oracle has published an official repository in GitHub for Oracle products which are available in a vagrant box. These include an Oracle 12.2 and an 11g database environment. The following steps apply to Windows, Linux and Mac
 

What is Vagrant?
Vagrant is a free Ruby application for creating and managing virtual machines. Vagrant enables simple software distribution, especially in software and web development, and serves as a wrapper between virtualization software such as VirtualBox, KVM/QEMU, VMware and Hyper-V and software configuration management applications or system configuration tools such as Chef, Saltstack and Puppet

With Vagrant it is now possible to perform all the tasks listed above with a simple command. The following requirements must be met:

  • Virtual Box is installed
  • Vagrant is installed
  • Compunter has a working Internet connection

 

Now we are ready to set up an Oracle environment in a few steps:

  1. copy the repository locally to the computer
      git clone https://github.com/oracle/vagrant-boxes

If no GIT client is installed on the computer, the repository can also be downloaded and unpacked as a zip file.

2. copy the 11g or 12.2 Oracle software in the 64bit Linux version to the
appropriate folder of the unpacked or cloned repository

cp linuxx64_12201_database.zip vagrant-boxes\OracleDatabase\12.2.0.1
  1. go to the directory where the software was copied and type in the following:
Vagrant up

This command executes all work automatically. The whole process takes between 15 and 45 minutes, depending on your notebook

  • At the end of the setup you have the following at your disposal:
  • New Virtualbox environment with an Oracle 12.2 CDB and a PDB
  • Oracle Database Express is available at https://localhost:5500
  • ssh connection is configured to localhost:2222 and automatically integrated into Vagrant

The passwords for the Oracle database are shown at the end of the setup and can be adjusted if required.

default: INSTALLER: setPassword.sh file setup
default: ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: VIxtcphKIQs=1
default: INSTALLER: Installation complete, database ready to use!

Once the environment is ready, it can be connected as follows

Vagrant ssh

After that you are automatically logged in as vagrant user on the environment. This user has sudo rights to become Oracle.

sudo su - oracle

That’s all. Have fun testing and trying it out

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: