Installing Oracle 12c Enterprise Edition on macOS
Using Docker to run SQL*Plus (and more!) on macOS
A rewrite? No!
I personally have been using mfofana’s article for some time myself. This article isn’t intended to replace mfofana’s, but to briefly touch on the differences from then to now. And add some troubleshooting I’ve experienced before.
Kitematic has changed since that article was published, so I wanted to clarify the process for those unfamiliar with Docker. I have also included some help for common questions regarding running script files that I’ve come across.
Additionally, this guide will install Oracle 12c Enterprise Edition (which is its own source of confusion because of multiple images), Standard Edition can still be pulled using the original article’s image.
From the original article, Kitematic used to be installed separately — now you no longer need to worry about it.
Install Docker Desktop if you don’t have it already and you will be good to go.
While that’s downloading, create a folder for Oracle 12c in your home folder. The command line command for this is
mkdir ~/oracle_data. The folder name and location are up to you, but this is my (strong) recommendation.
Creating our Container
If you open Docker for the first time, you won’t have any containers running and the interface looks like this:
Optional: Sign yourself in at the top-right. Not required for the container to run though.
Switch back to your command line. Let’s run our Oracle 12c Enterprise container.
Run the following:
docker run -d -p 8080:8080 -p 1521:1521 -v ~/oracle_data/:/u01/app/oracle absolutapps/oracle-12c-ee
Note that this is ~3GB and will take some time so let it run and make yourself a coffee.
Just to reiterate,
absolutapps/oracle-12c-ee is the image for Enterprise Edition. mfofana’s
truevoly /oracle-12c is the Standard Edition. Download whichever one you need (Oracle’s description table here).
When it’s done, the console output will look like this:
% docker run -d -p 8080:8080 -p 1521:1521 -v ~/oracle_data/:/u01/app/oracle absolutapps/oracle-12c-eeUnable to find image 'absolutapps/oracle-12c-ee:latest' locally
latest: Pulling from absolutapps/oracle-12c-ee
Image docker.io/absolutapps/oracle-12c-ee:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
a3ed95caeb02: Pull complete
3f5d218d03fc: Pull complete
7599fba7a3e8: Pull complete
fe1149d58656: Pull complete
d40655be04ce: Pull complete
03835bd35ad5: Pull complete
3924faff9c04: Pull complete
a28a2f0d73a5: Pull complete
Status: Downloaded newer image for absolutapps/oracle-12c-ee:latest
Using SQL*PLUS For the First Time
SQL*Plus is Oracle DB Server’s command-line user interface. Now that we’ve got our container, go back to Docker Desktop to find it.
It will be there under a randomly generated name. Now click on the container’s name (in my case,
inspiring_tu). It will be in the process of installing 12c for you. From experience this takes some time, here are some screenshots of text you might expect.
When the set up finishes, the console will display
Done with scripts we are ready to go (red box in screenshot above).
Now open Docker’s Command Line Interface (CLI). This is the fourth last button on the top right. It is also highlighted with an orange arrow and box in the screenshot above.
This will open a terminal window and you can log in and you can now use SQL*Plus on your macOS!
You can stop and start this container when you want. However, when you restart it, you still need to wait for the
Done with scripts we are ready to go message. It should be pretty fast, on my second start up it took ~30 seconds.
For those interested the rest of this article will cover:
- Running an SQL Script
- Explaining the Docker Run command
- Deleting a container (for those new to Docker)
But that is it for a guide on installing Oracle 12c Enterprise Edition! Flip over to mfofana’s original guide for how to open SQL*Plus, create a DB and set up SQL Developer.
Thanks again to mfofana for their original guide. :)
Running an SQL Script
Typically we want to load in a lot of data and have an SQL file ready to import! But, with our container, we cannot give SQL*Plus the file path like Windows. e.g.
@/Users/courtney/christmas_wishlist.sql won’t work!
In our container, we were monitoring Logs (top bar’s tab) before. For running SQL files open Inspect first.
This is what the pane should look like. Find the Mounts subheading.
Here it will tell you that YOUR path is (
/Users/zhimin/oracle_datain my case), and the CONTAINER reads it as
For those unfamiliar with Docker, you can think of the container renaming (
u01/app/oracle) the path it is actually is (
- Move your SQL file into your path (
- Open the container’s CLI, login as your SQL user and run the following:
@u01/app/oracle/<your filename here>
3. Your file will execute inside the container! :)
Explaining the Docker Run command
This command looks a bit much at first. But lets break down the flags:
docker run -d
-d: Detached mode. This is default, but it means that the container will exit when the root process exits.
-p: Ports. Exposes a port (or a range of ports) in
host:destination format. In our case, we’re running Docker at port 8080 and Oracle at 1521 (Oracle’s default port).
-v : Bind a Volume. Format:
host-src:container-dest. This is needed to share files across filesystems (i.e. really needed to run scripts!). Here I’m binding our created folder
~/oracle_data as the container’s destination (
Finally, the last argument is our image,
absolutapps/oracle-12c-ee. In mfofana’s original article, this was truevoly’s
oracle-12c for SE.
Deleting the container
It’s pretty straight forward. Hit the circular delete button on the top right of your container.
For the command line way:
- Get the container ID from running
- Stop the container:
docker stop <container id>
- Then remove it:
command docker rm <container id>
It will disappear from your Docker list, and you won’t have Oracle 12c EE anymore.