Skip to content

Instantly share code, notes, and snippets.

@johnlpage
Last active January 12, 2022 17:34
Show Gist options
  • Save johnlpage/489754ef5b85401fa558d59d9976c10b to your computer and use it in GitHub Desktop.
Save johnlpage/489754ef5b85401fa558d59d9976c10b to your computer and use it in GitHub Desktop.

Quick Oracle 18 XE setup for AWS

These instructions are a quick and simple way to set up Oracle for experimenting - it is no no way fit for production use. This assumes familiarity with Amazon EC2 - you could also use RHEL 7.9 installed another way but I have not tested that.

Start an EC2 Instance in a region of your choice (Ideally the same one where you will be running MongoDB Atlas). Oracle XE has limitation on hardware and data size so it should be

  • 2 CPU, 4GB RAM (t3.medium instance)
  • OS: RHEL 7.9 64 bit (RHEL-7.9_HVM-20211005-x86_64-0-Hourly2-GP2 in COmmunity AMIs)
  • 25GB gp3 root disk (Change on Add Storage screen from 10GB gp2)

Log onto your Instance using ssh, the command I used is below, modify for your key and IP

ssh -i ~/.ssh/johnpage.pem [email protected]

Download Required Packages

curl -OL https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm

curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

Add the Centos package manager

Change region to your AWS region

export REGION="eu-west-1"
 
sudo yum-config-manager --enable rhui-${REGION}-rhel-server-extras rhui-${REGION}-rhel-server-optional

Install C++ required library version

curl -OL https://www.rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
 
sudo rpm -i compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

Install Oracle Prerequisites

sudo yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

Setup the database

sudo yum install -y oracle-database-xe-18c-1.0-1.x86_64.rpm
 
sudo /etc/init.d/oracle-xe-18c configure

You are prompted for a password here, this is used for the various initial system accounts SYS, SYSTEM, PDBADMIN - set a password here you can remember and type.

This part can take 10-20 minutes.

When complete you will see

  Database creation complete. For details check the logfiles at:
   /opt/oracle/cfgtoollogs/dbca/XE.
  Database Information:
  Global Database Name:XE
  System Identifier(SID):XE
  Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.

  Connect to Oracle Database using one of the connect strings:
       Pluggable database: ip-172-31-32-141.eu-west-1.compute.internal/XEPDB1
       Multitenant container database: ip-172-31-32-141.eu-west-1.compute.internal
  Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE

Use the following commands to set up your paths then connect.

export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE/
 
export PATH=${PATH}:/opt/oracle/product/18c/dbhomeXE/bin

Log in with

sqlplus sys/YOUPASSWORD@$(hostname)/XEPDB1 as sysdba

replace YOURPASSWORD with the password you set earlier and verify you can log in and get an SQL> prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment