Skip to main content

Installing Oracle 19c in a docker container

Installing Oracle 19c in a docker container

Reference: https://mkc110891.medium.com/oracle-19c-on-ubuntu-18-04-docker-6898cd2916f9

1 - Clone Oracle Dockerfile Images
git clone https://github.com/oracle/docker-images

2 - Download Oracle 19c zip from Oracle website

You can download the zip from https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c
Download Linux x 86–64 from 19.3 section.

Copy zip file in docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0/.

cp <path-of-download-directory>/LINUX.X64_193000_db_home.zip docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0/

3 - Run Docker Image builder
cd docker-images/OracleDatabase/SingleInstance/dockerfiles
./buildContainerImage.sh -v 19.3.0 -e

Check images and confirm oracle image is listed there

docker images

You will see something like:

REPOSITORY TAG IMAGE ID CREATED SIZE

oracle/database 19.3.0-ee 915764c34e05 2 days ago 7.75GB

oraclelinux 7-slim 0a28ba78f4c9 2 months ago 132MB


4 - Create docker persistent area for oradata
mkdir -p /opt/oracle/oradata

You should provide the oracle:db ids from the container while setting the ownership. It should be 54321:54322.

sudo chown -R 54321:54322 /opt/oracle
5 - Create docker container

This step is done only time

docker run --name oracle19c --network host -p 1521:1521 -p 5500:5500 -v /opt/oracle/oradata:/opt/oracle/oradata -v /opt/oracle/scripts/startup:/opt/oracle/scripts/startup oracle/database:19.3.0-ee

It takes time. To update the password of the DB system, run:

docker exec oracle19c ./setPassword.sh <password>

Normally we leave the password as "manager", so do:

docker exec oracle19c ./setPassword.sh manager

Note: You can now use this as if the Oracle is installed on localhost due to the ports update

6 - Update Oratab

Outside of the container you can now edit /opt/oracle/oradata/dbconfig/ORCLCDB/oratab and update it from:

ORCLCDB:/opt/oracle/product/19c/dbhome_1:N

to

ORCLCDB:/opt/oracle/product/19c/dbhome_1:Y
7 - Start/Stop Oracle container
docker start oracle19c
docker stop oracle19c

8 - Necessary Steps for Windchill docker
docker exec -ti oracle19c sqlplus system/manager@orclpdb1
SQL> alter pluggable database orclpdb1 open;

SQL> CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
/

SQL> CREATE TABLESPACE "BLOBS" DATAFILE '/opt/oracle/oradata/ORCLCDB/blobs01.dbf' SIZE 1G AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;

SQL> CREATE TABLESPACE "WCAUDIT" DATAFILE '/opt/oracle/oradata/ORCLCDB/wcaudit01.dbf' SIZE 1G AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;

SQL> commit;