Dan [the] Salmon

Running Oracle 18c on MacOS

Oracle Docker MacOS

Update: May 14, 2019 This article originally contained instructions for running Oracle 12c. The Docker image that was being used was deleted by the author and so was not usable. I have updated the instructions to work again, though the image it uses now runs Oracle 18c. If you need to run 12c specifically, you’ll need to look for instructions elsewhere. Some screenshots may now be out of date.

In this post, we will go through the steps of installing Oracle 12c in a Docker container and connect to the database using SQL Developer on a Mac. This is a much lighter way of running Oracle locally compared to running a full Windows virtual machine with VMWare or Virtualbox.

1. Install Docker

- If your Mac is newer than 2010
You can simply install “Docker for Mac”. Download and install “Docker for Mac” from here (You’ll have to create a quick account to download it. Annoying, I know)

- If your Mac is 2010 or older
You can still run Docker, but there will be a few extra steps. You’ll install a tool called “Docker Toolbox” which includes everything you need. Download and install “Docker Toolbox” here.

2. Pull Docker image

docker version
docker pull hothamandcheese/oracle-18.4.0-xe

version-pull

3. Create container

mkdir ~/oracle_data
docker run -d -p 8080:8080 -p 1521:1521 -e ORACLE_PWD='Password1' -v ~/oracle_data/:/u01/app/oracle hothamandcheese/oracle-18.4.0-xe

This should return a long hash string.

Kitematic

4. Install SQL Developer

5. Connect to Oracle database

New SQL Developer Connection

6. Creating new databases

Change SALES to whatever database name you want

CREATE USER SALES
  IDENTIFIED BY password
  DEFAULT TABLESPACE USERS
  TEMPORARY TABLESPACE TEMP
  QUOTA 200M on USERS;
 
GRANT create session TO SALES;
GRANT create table TO SALES;
GRANT create view TO SALES;
GRANT create any trigger TO SALES;
GRANT create any procedure TO SALES;
GRANT create sequence TO SALES;
GRANT create synonym TO SALES;

Potential Problems

This means that you are trying to connect with SQL Developer, but your Docker container is stopped. Open Kitematic, select your Oracle container, and click “Start”. When the logs read “Database ready to use. Enjoy! ;)”