This project configures and deploys an Oracle database in a Docker container for personal development environments.
First build an Oracle container image as described in https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance. For Oracle Database 12.2.0.1 Enterprise Edition this involves the following steps:
- Place
linuxx64_12201_database.zip
indockerfiles/12.2.0.1
. - Go to
dockerfiles
and runbuildDockerImage.sh -v 12.2.0.1 -e
For Oracle Database 19.3.0 Enterprise Edition:
- Place
LINUX.X64_193000_db_home.zip
indockerfiles/19.3.0
. - Go to
dockerfiles
and runbuildDockerImage.sh -v 19.3.0 -e
Afterwards return to this project and run make save
and make load
to export and import the image to file.
The scripts in docker/setup are executed for initial setup of the database. Edit docker/setup/01_create_user.sql to setup a schema.
The scripts in docker/startup are ran before starting the database.
Edit docker/Dockerfile to modify SID and PDB.
In the container, the database is located at /opt/oracle/oradata
. The run
target in Makefile mounts this directory on a volume oradata
, in
order to persist the database between runs.
Use
ORACLE_PWD=<password> make run
to build and run the database, and set the database password. The first run
will will create a database in a volume oradata
. Consequent runs will mount
the previously built database. If ORACLE_PWD
is unset, the password will
not be changed.
Type make logs
to view and follow the container log and see when the database is ready.
Connect as user system
(service):
jdbc:oracle:thin:@//localhost:1521/ORCLCDB
Connect as user myschema
(service):
jdbc:oracle:thin:@//localhost:1521/ORCLPDB1
Lookup the container id with docker ps
.
docker exec -it <container-id> bash
Use make save
and make load
to export resp. import the container image.
Check your Oracle license! A developer license only allows deployment on a physical development PC. In general, Oracle does not allow soft partitioning and may require a license for the entire cluster on which an instance is deployed.