Starting Oracle 19.9.0.0 Docker Container
The accompanying video with this article is at
The scripts I have used for this series of articles are https://github.com/tenzin-ravi/docker-applied
- Make sure to create a Docker network for the Oracle 19c Docker Container.
[oracle@dockerhost dockerOracle19c]$ cat createNetwork.sh
docker network create \
--driver=bridge \
--subnet=172.19.0.0/16 \
--ip-range=172.19.5.0/24 \
--gateway=172.19.5.254 \
oracledb
2. When you run the script for the first time, it creates the core container and the pluggable database.
[oracle@dockerhost dockerOracle19c]$ cat startOracleKind.sh
docker run -dt --network=oracledb --name oracle19c --hostname dockerdb --user oracle --ip 172.19.5.10 \
-p 192.168.1.45:1521:1521 -p 192.168.1.45:5500:5500 \
-p 192.168.1.45:2484:2484 \
-e ORACLE_SID=KIND \
-e ORACLE_PDB=KINDPDB \
-v /oradrive/oradata:/opt/oracle/oradata \
oracle/database:19.3.0-ee
Here is the explanation of the script above.
docker run -dt
— network=oracledb {This is the docker network we created above.}
— name oracle19c {Name of the Docker container for the database}
— hostname dockerdb {The hostname of the Docker container instance.}
— user oracle {The Docker container will run as the OS user oracle }
— ip 172.19.5.10 \ {Docker’s internal IP for the container}
-p 192.168.1.45:1521:1521 {We are exposing container’s port 1521 to the external IP 192.168.1.45 on port 1521}
-p 192.168.1.45:5500:5500 \ {We are exposing container’s port 5500 to the external IP 192.168.1.45 on port 5500}
-p 192.168.1.45:2484:2484 \ {We are exposing container’s port 2484 to the external IP 192.168.1.45 on port 2484}
-e ORACLE_SID=KIND \ {This the SID of the Oracle Database the script will create}
-e ORACLE_PDB=KINDPDB \ {The script will create one pluggable database KINDPDB }
-v /oradrive/oradata:/opt/oracle/oradata \ {The local folder /oradrive/oradata is mounted at /opt/oracle/oradata in the image }
oracle/database:19.3.0-ee {The Docker image for Oracle 19c version 19.9.0.0.
3. Identify the filesystem volume to mount in the container
The mounted volumes in Docker allow us to edit certain files outside of the container and make them available to the container. Here is the list of important volumes.
/opt/oracle/product/19c/dbhome_1/network/admin — So that I can edit the TNS files outside of the Docker container.
/opt/oracle/product/19c/dbhome_1/dbs — So that I can view the init.ora files.
/opt/oracle/wallet — I have used this folder to store TDE wallets.
/opt/oracle/fast_recovery_area — This volume is FAST_RECOVERY_AREA
/oradrave/rman:/opt/oracle/rman — This volume is for storing RMAN backups.
4. Populate some of the volumes
/opt/oracle/product/19c/dbhome_1/dbs
[oracle@dockerhost dockerOracle19c]$ docker exec -it oracle19c bash
[oracle@dockerdb /]$ cd /opt/oracle/product/19c/dbhome_1/dbs/
[oracle@dockerdb dbs]$ ls
hc_KIND.dat init.ora initKIND.ora lkKIND orapwKIND spfileKIND.ora
[oracle@dockerdb dbs]$ sftp oracle@192.168.1.45
The authenticity of host '192.168.1.45 (192.168.1.45)' can't be established.
ECDSA key fingerprint is SHA256:SnZE4OvuV1C0msN1qC6F+3GcjDK9eFy3C8uRS5kJHQs.
ECDSA key fingerprint is MD5:fb:0f:59:5e:a5:6d:26:cf:99:09:36:bc:2f:80:9e:d2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.45' (ECDSA) to the list of known hosts.
oracle@192.168.1.45's password:
Connected to 192.168.1.45.
sftp> cd /ora
oradrave/ oradrive/
sftp> cd /oradrive/oradata/KIND/dbs/
sftp> ls
hc_KIND.dat init.ora initKIND.ora lkKIND orapwKIND spfileKIND.ora
sftp>put *
sftp>exit
/opt/oracle/product/19c/dbhome_1/network/admin
[oracle@dockerhost dockerOracle19c]$ docker exec -it oracle19c bash
[oracle@dockerdb /]$ cd /opt/oracle/product/19c/dbhome_1/network/admin
[oracle@dockerdb dbs]$ ls
hc_KIND.dat init.ora initKIND.ora lkKIND orapwKIND spfileKIND.ora
[oracle@dockerdb dbs]$ sftp oracle@192.168.1.45
The authenticity of host '192.168.1.45 (192.168.1.45)' can't be established.
ECDSA key fingerprint is SHA256:SnZE4OvuV1C0msN1qC6F+3GcjDK9eFy3C8uRS5kJHQs.
ECDSA key fingerprint is MD5:fb:0f:59:5e:a5:6d:26:cf:99:09:36:bc:2f:80:9e:d2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.45' (ECDSA) to the list of known hosts.
oracle@192.168.1.45's password:
Connected to 192.168.1.45.
sftp> cd /oradrive/oradata/KIND/network/admin
sftp> cd /oradrive/oradata/KIND/network/admin/
sftp> ls -1
tnsnames.ora listener.ora sqlnet.ora
sftp>put *
sftp>exit
Now run the real startup script
[oracle@dockerhost dockerOracle19c]$ cat startOracleKind.sh
docker rm -f oracle19c
docker run -it --network=oracledb --name oracle19c --hostname dockerdb --user oracle --ip 172.19.5.10 \
-p 192.168.1.45:1521:1521 -p 192.168.1.45:5500:5500 \
-p 192.168.1.45:2484:2484 \
-e ORACLE_SID=KIND \
-e ORACLE_PDB=KINDPDB \
-v /oradrive/oradata/KIND/network/admin:/opt/oracle/product/19c/dbhome_1/network/admin \
-v /oradrive/oradata/KIND/dbs:/opt/oracle/product/19c/dbhome_1/dbs \
-v /oradrive/oradata/KIND/wallet:/opt/oracle/wallet \
-v /oradrive/fast_recovery_area:/opt/oracle/fast_recovery_area \
-v /oradrive/rman:/opt/oracle/rman \
-v /oradrive/oradata:/opt/oracle/oradata \
oracle/database:19.3.0-ee