Team member was fighting trying to get a docker container for Oracle setup on his Mac as there's a lot of confusing and conflicting information out there. This was tried and tested!
You will need to aquire access to the container via the standard Oracle data grab here.
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username (17twenty):
Password:
Login Succeeded
$ docker pull store/oracle/database-enterprise:12.2.0.1 # This will take an age
...
$ docker run -d -it --name oracleDB -p 1521:1521 -p 5500:5500 store/oracle/database-enterprise:12.2.0.1
$ You can specify a config to override all the Oracle defaults but let's start with a working setup first.
Download sqlplus
and support bins from Oracle's site - http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
I grabbed some creds from bugmenot (no, I didn't make this part up):
Username: eatabowlofdicksoracle@gmail.com
Password: FUoracle1
You'll need to install the following with brew:
- instantclient-basic-macos.x64–XXXX.zip
- instantclient-sqlplus-macos.x64–XXXX.zip
Move them to ~/Library/Caches/Homebrew
$ brew tap InstantClientTap/instantclient
$ brew install instantclient-basic
$ brew install instantclient-sqlplus
You'll need a file called tnsnames.ora
in a folder, say oracle
. It should look like this:
$ less oracle/tnsnames.ora
ORCLCDB=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLCDB.localdomain)))
ORCLPDB1=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCLPDB1.localdomain)))
Now finally...
$ export TNS_ADMIN=./oracle
$ sqlplus sys/Oradoc_db1@ORCLCDB as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 9 13:45:39 2018
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
Oradoc_db1 is the default password, you can change this nonsense with a config passed in. The Oracle doco on Docker hub can expand more.
You're done!
This is amazing - thank you!
Small correction, change;
$ less oracle/tnsname.ora
...to...
$ less oracle/tnsnames.ora
This fixes an error you will receive when connecting...
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified