Sunday, March 21, 2021

Oracle Linux 8 -- Run an Oracle Database 19c Enterprise Edition as a Container


You need a test Oracle database easy and fast without much of the server configuration steps which usually involved during normal Oracle Database installation procedure. 


To avoid the preinstallation steps required to configure a database server, you may run an Oracle database as a container using Podman or Docker on Linux. Oracle Linux 8 and Podman is used for this exercise.
1. This exercise assumes an existing Oracle Linux 8 host. Follow the details outlined in Oracle Linux 8 -- Minimal Installation In a VirtualBox VM to set up one. 

2. Install container tools

# dnf module install container-tools:ol8

Verify podman

# podman info

Optionally install podman-docker to alias docker commands to podman commands for convenience

# dnf install podman-docker
3. Optionally change the location where images will be downloaded and stored.


driver = "overlay"
graphroot = "/media/sf_Shared/oelinux83/containers/storage"

4. Pull the image of the Oracle Database 19.3 from

$ podman login
$ podman pull

During pull /var/tmp/ folder will be used as temp storage. You can change it with the TMPDIR environment variable.

Verify the image:

$ podman images

5. Create a container:

$ podman create --name <container_name> \
 -p <host_port>:1521 -p <host_port>:5500 \
 -e ORACLE_PWD=<your_database_password> \
 -e INIT_SGA_SIZE=1024 \
 -e INIT_PGA_SIZE=512 \
Note. You need to provide both the values, INIT_SGA_SIZE and INIT_PGA_SIZE or neither of them

Open specified ports on host through firewall:

# firewall-cmd --permanent --zone=public --add-port=1521/tcp --add-port=5500/tcp
# firewall-cmd --reload
6. Start the container:

$ podman start <container_name>

Monitor the container instantiation with:
$ podman logs -f  <container_name>

It will take some time for database provisioning

7. Test connection to the newly created database as a container:

From the host:
$ podman exec -it <container_name> sqlplus / as sysdba

From a client:

$ sqlplus system/<pwd>@<host>:1521/ORCLCDB
$ sqlplus system/<pwd>@<host>:1521/orclpdb1

When connecting from a Windows client host, you might need to disable the out-of-band break messages, in case you get ORA-12637: Packet receive failed or ORA-01017: invalid username/password:

For SQL*Net OCI clients add DISABLE_OOB=ON to the sqlnet.ora file
For JDBC Thin clients use

Now the database is accessible and ready for use.
For more information and reference, check the link

No comments: