Getting my hands on a Virtual Machine with Oracle Database 12.1.0.2 Enterprise Edition - 20-30 minutes from start to finish image2

Getting my hands on a Virtual Machine with Oracle Database 12.1.0.2 Enterprise Edition – 20-30 minutes from start to finish

NOTE: even though the steps described in this article all work – I am running into a problem with shutting down and starting up the VM again. So at the present I can have the VM created and the database installed – however, I can not successfully restart it. I am not sure if it is my environment, the Base Box or something in the configuration files provided by Yasushi. Please tread carefully when going through the steps described below.

A short time ago, Oracle release Oracle Database 12c – release 12.1.0.2. With a bunch of goodies that I would like to try out. This release can be downloaded from OTN: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-2240591.html. And subsequently I can create or clone a Virtual Machine, do the necessary preparations and run the installer. Nothing wrong with that of course. However, my recent work with Vagrant and Puppet has made me … more efficient or lazier – I am not sure what the best expression is. Anyways, things can be really simple with today’s tools and with friends on the internet who share their own goodies (and I do not want you to take that in the wrong and possibly funny way).

Let me be more specific: Yasushi YAMAZAKI from Tokio, Japan made his Vagrant/Docker configuration files available on GitHub that will stamp out the complete VirtualBox VM with Oracle Linux (6.5) and with a few manual steps (too bad about these…) Oracle Database 12c (12.1.0.2) can be installed on it: https://github.com/yasushiyy/vagrant-docker-oracle12c.

All I have to do to create the VM (since I have already installed Vagrant and VirtualBox locally – see this article for instructions on this very simple installation):

    • download the two database installation files from OTN
      image
    • download Yasushi’s Git repository and extract the zip file to a local directory or (Git) clone the repository to that same local directory; let’s call it the VAGRANT_12_1_0_2_HOME for now.
    • optional: you may consider making a few small changes to the Vagrantfile, in particular add a line to assign an IP address that makes the VM accessible from the host or from other VMs and perhaps one or more shared folder definitions; my Vagrantfile now looks something like:
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# copied directly from vagrant init chef/centos-6.5
config.vm.box = "chef/centos-6.5"

config.vm.define "db12102" , primary: true do |db12102|

config.vm.hostname = "db12102.example.com"
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=777"]
config.vm.synced_folder "C:\\Users\\lucas_j\\Downloads", "/software"
config.vm.synced_folder "C:\\temp", "/host_temp"

config.vm.network :private_network, ip: "10.10.10.27"

# change memory size
config.vm.provider "virtualbox" do |v|
v.memory = 2048
end

# Oracle port forwarding
config.vm.network "forwarded_port", guest: 11521, host: 21521

# run setup.sh
config.vm.provision "shell", path: "setup.sh"
end
end

  • create a subdirectory called database and extract the two download files from OTN to this directory VAGRANT_12_1_0_2_HOME
    image
  • open a command line and navigate to directory VAGRANT_12_1_0_2_HOME
  • run: vagrant plugin install vagrant-vbguest
  • run: vagrant up
  • At this point, Vagrant takes over and starts to create the VM based on a Vagrant Box

image

After some time – between 10-30 minutes, depending on your environment – the VM is ready and running – without the database on it, but fully prepared to become the proud owner of a running Oracle Database 12.1.0.2:

image

Manual Database installation

Now comes the “hard” part that requires some manual action:
run:

 vagrant ssh

(to connect to the container; alternatively use Putty to open a session to the VM and login with vagrant/vagrant)

run:

sudo docker run --privileged -h db12c -p 11521:1521 -t -i -v /vagrant:/vagrant yasushiyy/vagrant-docker-oracle12c /bin/bash

run:

su - oracle

run:

/vagrant/database/runInstaller -silent -showProgress -ignorePrereq -responseFile /vagrant/db_install.rsp

exit

image

run:

/opt/oraInventory/orainstRoot.sh
/opt/oracle/product/12.1.0.2/dbhome_1/root.sh

run:

su - oracle
netca -silent -responseFile $ORACLE_HOME/assistants/netca/netca.rsp

image
run:

dbca -silent -createDatabase -responseFile /vagrant/dbca.rsp

run:

sqlplus system/oracle@localhost:1521/orcl

image

So we are in business: not only is the VM up and running, it now also has a running database inside – SYS and SYSTEM are set up with password ORACLE. De SID is orcl. The database port is 1521.

2 Comments

  1. Coco Steinbrück (@corocoton) September 25, 2015
  2. Coco Steinbrück (@corocoton) September 10, 2015