Docker Installation of Oracle Database 12c on Mac

I have been working with Virtual machines for quite a while, most of my testing and demo environments are on VirtualBox. The problem I’ve always faced is the storage and resources requirements to run multiple VMs.  Running VMs on a MAC works well, however we all know that MAC storage is a premium that not all of us have.

I have always kept my VMs in an external drive, but quite honestly every time I am on a client or want to demos something, I usually don’t have the drive with me. With that I have been looking for alternatives and for quite a while I wanted to try Docker.

With some available time today, I decided to give it a shot and it worked really well.  Below I am demonstrating what I did to get started.


Here are my Steps:

Download and Install Docker for Mac from the Docker Store

https://store.docker.com/editions/community/docker-ce-desktop-mac


Install it

Double-click Docker.dmg to start the install process.

When the installation completes and Docker starts, the whale in the top status bar shows that Docker is running, and accessible from a terminal.


Run it

Open a command-line terminal, and try out some Docker commands.

Run $docker version to check that you have the latest release installed.

Run $docker run hello-world to verify that Docker is pulling images and running as expected.

More information on how to run and install Docker on Mac can be found here:

https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac


Now that I have downloaded and installed Docker successfully, I will download an existing Database 12c Image public available.

Docker Image to Download:

Go to hub.docker.com and type: Oracle 12c

Search_-_Docker_Hub

Click in the image absolutapps/oracle-ee-12c

Search_-_Docker_Hub2

Copy the Docker Pull Command:

docker pull absolutapps/oracle-12c-ee

absolutapps_oracle-12c-ee_-_Docker_Hub

 Alexs-MBP:~ alexlima$ docker pull absolutapps/oracle-12c-ee
Using default tag: latest
latest: Pulling from absolutapps/oracle-12c-ee
a3ed95caeb02: Pull complete
3f5d218d03fc: Pull complete
7599fba7a3e8: Pull complete
fe1149d58656: Pull complete
d40655be04ce: Pull complete
03835bd35ad5: Pull complete
3924faff9c04: Pull complete
a28a2f0d73a5: Pull complete
Digest: sha256:390a2166d94ea535ba1f82e293406cd91d0b34f1ecd84addf520d42c58f9bc06
Status: Downloaded newer image for absolutapps/oracle-12c-ee:latest
Alexs-MBP:~ alexlima$

Running image on Docker:

Alexs-MBP:~ alexlima$ docker run -d --name oracle-12cR1-ee --privileged absolutapps/oracle-12c-ee
f4a900e3f98755bf36df2cd073a6a81644e6b7c72d46051253ed1111d1b8e6c5

Install Oracle Database on Docker:

Alexs-MBP:~ alexlima$ docker logs -f oracle-12cR1-ee
ls: cannot access /u01/app/oracle/oradata/orcl: No such file or directory
No databases found in /u01/app/oracle/oradata/orcl. About to create a new database instance
Starting database listener

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-MAR-2018 16:34:46

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/f4a900e3f987/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=f4a900e3f987)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=f4a900e3f987)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                30-MAR-2018 16:34:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/f4a900e3f987/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=f4a900e3f987)(PORT=1521)))
The listener supports no services
The command completed successfully
Copying database files
1% complete
3% complete
11% complete
18% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-MAR-2018 16:39:57

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=f4a900e3f987)(PORT=1521)))
The command completed successfully
Database has been created in /u01/app/oracle/oradata/orcl
SYS and SYSTEM passwords are set to [oracle]
Setting HTTP port to 8080

PL/SQL procedure successfully completed.

Please login to http://:8080/em to use enterprise manager
User: sys; Password oracle; Sysdba: true
Fixing permissions...
Running init scripts...
Init scripts in /oracle.init.d/: Ignoring /oracle.init.d/*

Done with scripts we are ready to go

Start oracle Database and note the hostname:

Alexs-MBP:~ alexlima$ docker exec -it oracle-12cR1-ee /bin/bash
[root@f4a900e3f987 /]# echo $ORACLE_SID
orcl
[root@f4a900e3f987 /]# sqlplus system/oracle@//localhost:1521/orcl

SQL*Plus: Release 12.1.0.2.0 Production on Fri Mar 30 16:42:16 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> desc v$instance
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 INSTANCE_NUMBER				    NUMBER
 INSTANCE_NAME					    VARCHAR2(16)
 HOST_NAME					    VARCHAR2(64)
 VERSION					    VARCHAR2(17)
 STARTUP_TIME					    DATE
 STATUS 					    VARCHAR2(12)
 PARALLEL					    VARCHAR2(3)
 THREAD#					    NUMBER
 ARCHIVER					    VARCHAR2(7)
 LOG_SWITCH_WAIT				    VARCHAR2(15)
 LOGINS 					    VARCHAR2(10)
 SHUTDOWN_PENDING				    VARCHAR2(3)
 DATABASE_STATUS				    VARCHAR2(17)
 INSTANCE_ROLE					    VARCHAR2(18)
 ACTIVE_STATE					    VARCHAR2(9)
 BLOCKED					    VARCHAR2(3)
 CON_ID 					    NUMBER
 INSTANCE_MODE					    VARCHAR2(11)
 EDITION					    VARCHAR2(7)
 FAMILY 					    VARCHAR2(80)

SQL> select INSTANCE_NAME,HOST_NAME from v$instance;

INSTANCE_NAME
----------------
HOST_NAME
----------------------------------------------------------------
orcl
f4a900e3f987
SQL> select tablespace_name, file_name from dba_data_files;

TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/u01/app/oracle/oradata/orcl/users01.dbf

UNDOTBS1
/u01/app/oracle/oradata/orcl/undotbs01.dbf

SYSTEM
/u01/app/oracle/oradata/orcl/system01.dbf


TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
SYSAUX
/u01/app/oracle/oradata/orcl/sysaux01.dbf

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[root@f4a900e3f987 /]# exit
exit
Alexs-MBP:~ alexlima$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4a900e3f987 absolutapps/oracle-12c-ee "/entrypoint.sh" 12 minutes ago Up 12 minutes 1521/tcp, 5500/tcp, 8080/tcp oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker stop oracle-12cR1-ee
oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Alexs-MBP:~ alexlima$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest f2a91732366c 4 months ago 1.85kB
absolutapps/oracle-12c-ee latest ad9bdfc002e7 23 months ago 6.12GB

Alexs-MBP:~ alexlima$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Alexs-MBP:~ alexlima$ docker start oracle-12cR1-ee
oracle-12cR1-ee
Alexs-MBP:~ alexlima$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4a900e3f987 absolutapps/oracle-12c-ee "/entrypoint.sh" 2 hours ago Up 7 seconds 1521/tcp, 5500/tcp, 8080/tcp oracle-12cR1-ee

 

And that’s it.  I now have an working version of Oracle database 12c R1 running on my MAC with Docker.

Next test is to create a GoldenGate Microservices image to test some integrations.  Stay tuned.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s