This article provides a quick intro on how to set up an Oracle DB development environment on mac, Including installing the PL/SQL Developer tool and running Oracle XE on Docker.
Tools
To set up an Oracle development environment on mac, we need to 1. Install the PL/SQL developer and 2. install the Oracle DB.
As a GUI tool, we’re going to install PL/SQL Developer for mac. For the database, we’re going to run a docker image running the Oracle Database XE.
PL/SQL Developer
PL/SQL Developer is a tool from Oracle that allows the user to execute SQL queries, PL/SQL commands, and perform a number of interactive operations on DBs
The tool is freely downloadable from this page:
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
After downloading, the tool can be installed on your workstation in a few minutes.
Oracle Database Express
For educational and practice purposes, Oracle recommends using the Oracle Database Express Edition. The DB is freely downloadable from this page:
http://www.oracle.com/technetwork/database/express-edition/overview/index.html
Since there is no installer for the macOS, we will be using Docker to install and run the DB.
Setup Oracle XE with Docker
For running Oracle XE on Docker, we first download the Database rpm installer, then we build a Docker image, and then we can launch the DB container.
First, we clone the official Docker images from Oracle’s GitHub.
git clone https://github.com/oracle/docker-images.git
Then, we download Oracle XE from the Oracle Downloads Page, and copy the downloaded file into the docker-images/OracleDatabase/SingleInstance/dockerfiles folder.
In my case, I downloaded the Oracle Database Express Edition (XE) Release 18.4.0.0.0 (18c), hence my file oracle-database-xe-18c-1.0-1.x86_64.rpm goes into docker-images/OracleDatabase/SingleInstance/dockerfiles/18.4.0/
mv ~/Downloads/oracle-database-xe-18c-1.0-1.x86_64.rpm ~/git/oracle/docker-images/OracleDatabase/SingleInstance/dockerfiles/18.4.0/
At this point, we follow the instructions for building the OracleDatabase/SingleInstance. Hence, we build the OracleXE image, as follows:
cd ~/git/oracle/docker-images/OracleDatabase/SingleInstance/dockerfiles
./buildDockerImage.sh -v 18.4.0 -x -i
Wait for patience upon completion. When done you should see a message like in the screenshot below.
Now, we can execute the docker images
command to verify the new image exists.
Then, we can start a new container with the Oracle XE database. The following example shows how to run the container.
docker run --name OracleXE --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=weblogic1 oracle/database:18.4.0-xe
After starting the container the first time, we should see the following output.
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: 82f75196972c/XEPDB1
Multitenant container database: 82f75196972c
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
Once the container is running, we can connect to the Oracle XE from a GUI client, using localhost, port 1521, and sid XE.
Once connected, you can operate
To stop the DB, we can just run docker stop <image-name>
References
- Oracle Advanced PL/SQL Developer Professional Guide, Packt
- Oracle database on docker, Oracle on Github
- Create and use a docker container with Oracle XE on Macos, esentri
0 Comments