Running SQL*Plus in OpenShift

The terminal waits. You type sqlplus, but this time you’re in OpenShift.

Running SQL*Plus inside OpenShift is fast, but only if you handle the container environment correctly. You need Oracle client tools in your image, a secure way to connect, and proper network access to your database service.

Start by building a custom OpenShift image with the Oracle Instant Client. Include SQL*Plus in the build so you can run commands directly. In your Dockerfile or Containerfile, add:

FROM registry.access.redhat.com/ubi8/ubi
RUN yum install -y oracle-instantclient-sqlplus

Push the image to your OpenShift cluster and create a Deployment or Pod using it.

Set environment variables for your database connection:

ORACLE_USER=myuser
ORACLE_PASSWORD=mypassword
ORACLE_HOST=dbhost.example.com
ORACLE_SID=ORCL

For external databases, check your OpenShift network policies. Ensure egress is allowed to the database host and port. For internal services, define a Service and use the cluster DNS name in your SQL*Plus connection string.

To connect, exec into the running Pod:

oc exec -it mypod -- sqlplus $ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_HOST/$ORACLE_SID

You now have SQL*Plus inside OpenShift. Run queries, manage schemas, or script operations without leaving the container.

Automate this with OpenShift Jobs for scheduled SQL operations. Store scripts in ConfigMaps or mount them from persistent volumes. Keep secrets in OpenShift’s Secret objects, not in plain text.

Integrating SQL*Plus with OpenShift streamlines database admin tasks for complex environments. Build and run once, deploy anywhere in the cluster, and keep it repeatable.

Want to skip the setup and try it live? Launch a working OpenShift + SQL*Plus environment in minutes at hoop.dev.