Installing Oracle 12C as a Docker Container

While engaging in the development tasks in the local environment, it’s paramount to have the local set up as closer to the customer’s environment. There is a significant portion of giant financial institutions that uses Oracle as the primary data persistence store.

Therefore, this post is intended for developers to quickly set up their Oracle RDBMS instances in the local set up.

Prerequisites

  • Docker Installation.
  • Dockerhub Account
  • Agreeing to the Terms & Conditions of Developer Onlye license of Oracle Database Enterprise Edition 12c over .

Installation Process

Login to the docker & pull the Oracle Database Enterprise Edition 12c image.

docker login

docker pull store/oracle/database-enterprise:12.2.0.1

Next the docker image could be executed with the following command;

Note: In order to avoid data loss in the event of container is destroyed, the docker volume is shared with the host volume.

docker run -d -it — name oracle -p 1521:1521 -v /Users/firzhannaqash/oracle-db-data:/ORCL store/oracle/database-enterprise:12.2.0.1

The state of the docker container could be checked as below;

docker ps

Container ID of the Oracle Image

The log file of the Oracle container could be checked with following command;

docker logs <CONTAINER-ID> -f

Once the Oracle container is successfully started, the below command is executed to mount the Database.

docker exec -it oracle bash -c “source /home/oracle/.bashrc; sqlplus /nolog”

This would enable you to access the sqlplus terminal. We can use the sqlplus terminal to start creating the schema.

You have to execute following set of commands to create the user/schema to work on;

connect sys as sysdba;

The above command would prompt to enter the password. The default password of the Oracle Container Database is Oradoc_db1.

Next, execute the following set of commands;

alter session set “_ORACLE_SCRIPT”=true;

create user <username/schemaname> identified by <password>;

GRANT CONNECT, RESOURCE, DBA TO <username/schemaname>;

The Service Name of the above created schema would be defined as ORCLCDB.localdomain.

Now, we can connect to the above-created Oracle schema using .

A basic SQLDeveloper configuration could be found over here.

References

[1]

[2]

Integration Specialist | ML | Open Source Enthusiast