Extremely convenient way to run free Oracle Database 18c on your laptop – or anywhere else – using Vagrant & Virtual Box

0

imageOracle Database 18c XE (eXpress Edition) is the free community edition of the enterprise edition of Oracle Database. Oracle Database XE has almost all features of Oracle Database; however, it is limited in non-functional terms (2 CPUs, 2 GB memory, 12 GB data volume). Oracle is generous in the terms under which XE can be used:

“We grant you a nonexclusive, nontransferable limited license to use the programs for: (a) purposes of developing, prototyping and running your applications for your own internal data processing operations; (b) you may also distribute the programs with your applications; (c) you may use the programs to provide third party demonstrations and training; and d) you may copy and distribute the programs to your licensees provided that each such licensee agrees to the terms of this Agreement.”

You can include Oracle Database XE in your production systems and in your own products that you sell to third parties.

It is not difficult to get going with Oracle Database 18c XE. You can simply download the installer for your platform and run it, to install the database natively on your platform. If however you prefer to manage all software in VMs and containers – like I do – there are other options. One such option is to make use of Vagrant and VirtualBox – to install and run Oracle Database XE in a Virtual Machine. The resulting Virtual Machine is very easily managed with vagrant commands: vagrant up, vagrant ssh (to open a terminal into the VM to perform admin actions) and vagrant halt (to stop the VM).

The instructions and scripts for automated creation of the VM and installation & configuration of the database can be downloaded from the Oracle GitHub Repository: https://github.com/oracle/vagrant-boxes/tree/master/OracleDatabase/18.4.0-XE .

The steps we have to go through:

1. Prepare: download and install Vagrant and VirtualBox

2. Download the Oracle Database XE 18c installer for Linux from OTN: https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

imageThe download will take a few minutes – depending on your network connection.

image

3. Git clone the GitHub repository

4. Move the downloaded Database Installer (rpm file) to the OracleDatabase\18.4.0-XE directory in the cloned Git repo

5. Run the command: vagrant up

and wait for 10-20 minutes for the preparation of the database. No other manual intervention is required.

imageThis will run for quite some time – during which the Oracle Linux 7 base box is downloaded, the database software is installed and the database is created and started.

Some remarkable log messages:

image

See how port forwarding is configured, to allow us to access the database later at localhost:1521.

After downloading the base box, the database software is installed into the VM:

image

image

And the final step:

image

At this point the VM is fully prepared. It is running. We can connect to the database – as if it was running on our laptop (thanks to port forwarding).

Create database connection to SYS account in SQL Developer:

image

and check the contents of our database:

image

and create a connection to the PDB:

image

Or connect to the database from within the VM using SQL*Plus:

SNAGHTML2dd6b35f


image

Note:

  • If you need to, you can connect to the machine via vagrant ssh.
  • You can sudo su - oracle to switch to the oracle user.
  • The Oracle installation path is /opt/oracle/.

With vagrant halt I can stop the database (and the VM) and with vagrant up I can start it up again.

Run VM with APEX 19.1 and ORDS with XE

Early May 2019, a more expanded vagrant script was published to not only produce a VM with Oracle Database XE (18c) but also add APEX 19.1 and ORDS into the mix. See https://blogs.oracle.com/scoter/automated-oracle-apex-191-installation-with-vagrant-and-virtualbox for details.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.