Installing enterprise databases like Oracle Database 19c is not for the faint of heart. Anyone who has gone through the process knows the pain: reading long installation guides, following hundreds of manual steps, risking potential misconfigurations, and facing the looming chance of failure halfway through.
Now, imagine doing all that inside a modern environment built to run both containers and virtual machines, like Red Hat OpenShift Virtualization. First, you provision a Red Hat Enterprise Linux (RHEL) virtual machine (VM), configure the operating system, set up storage, and then step through the Oracle installer. One wrong package or missing kernel parameter, and you're back at square one.
The solution? Automation. Red Hat Ansible Automation Platform helps you remove the manual, error-prone steps. You can replace them with a single, repeatable command that provisions the VM, configures RHEL, and installs Oracle 19c automatically. This can save hours (or days) of setup time and ensures consistency across development, testing, and production environments.
The manual process (and its pitfalls)
Setting up Oracle 19c in this environment involves the following steps:
- Creating a RHEL 9 VM manually in OpenShift Virtualization.
- Configuring the operating system (users, kernel parameters, packages).
- Attaching storage and mounting file systems.
- Uploading Oracle installation media.
- Running the Oracle installer in silent mode.
- Configuring listener, service names, and testing connectivity.
This process can be tedious, and it sets the system up for mistakes. Automation provides a more reliable way to manage these complex tasks.
How the automation helps your team
When you combine Red Hat OpenShift Virtualization with Red Hat Ansible Automation Platform, you change how your team manages database infrastructure. This combination helps developers manage their Oracle Database testing environments on their own, which reduces wait times and increases productivity.
By removing the need for repetitive, manual installations, you free up database administrators and system administrators to focus on more strategic tasks. Furthermore, this automated approach ensures that every environment follows established best practices for consistency and reliability.
Ultimately, you create a foundation for Oracle Database workloads that can run across hybrid cloud environments, providing the flexibility to operate in both local data centers and public clouds.
Automating the setup with Ansible
You can break the problem down into two main Ansible playbooks:
prepare_os.yml, which provisions the RHEL VM and prepares the OS for Oracle.install_oracle.yml, which installs and configures Oracle 19c in silent mode.
Prerequisites
- Red Hat OpenShift 4.19+ with OpenShift Virtualization (CNV) enabled
- Storage: 120 GiB or more persistent volume claim (PVC) for the database and 8 GiB for the disc image (ISO)
- Image: RHEL 9 ISO (must be registered with a Red Hat account)
- Oracle software: Oracle 19c binaries (compressed file from Oracle website)
- CLI tools:
oc,virtctl, and access to the web console - Privileges: cluster-admin access to OpenShift
Enable OpenShift Virtualization
- In the OpenShift web console, go to Operators → OperatorHub.
- Search for OpenShift Virtualization.
- Click Install in the
openshift-cnvnamespace. - Once installed, go to Operators → Installed Operators → OpenShift Virtualization.
- Select the Create HyperConverged resource.
- Wait until all components show a status of Healthy.
Upload the RHEL 9 ISO
While the RHEL 9 ISO is built into OpenShift Virtualization, these steps help if you want to use a different guest operating system. You'll need a RHEL 9 ISO to install the guest OS.
Create a PVC using the file
rhel9-iso-pvc.yaml:apiVersion: v1 kind: PersistentVolumeClaim metadata: name: rhel9-iso-pvc namespace: openshift-virtualization spec: accessModes: - ReadWriteOnce resources: requests: storage: 8Gi storageClassName: <your-storage-class>Apply it with:
oc apply -f rhel9-iso-pvc.yamlUpload the ISO using the
virtctlcommand:virtctl image-upload pvc rhel9-iso-pvc \ --image-path=RHEL9-x86_64-dvd.iso \ --access-mode=ReadWriteOnce \ --size=8Gi \ --insecure
Create a RHEL 9 VM
You can create your virtual machine in OpenShift Virtualization using the web console for a guided setup or a configuration file for an automated approach.
Option A: Use the OpenShift web console
The OpenShift web console provides a visual interface to guide you through the VM creation process.
- Go to Virtualization → Virtual Machines → Create VM.
- Choose Custom Template.
- Set:
- Name:
oracle19c-rhel9 - Operating system: Other (or Red Hat Enterprise Linux 9 if available)
- Boot source: Use existing PVC →
rhel9-iso-pvc - Memory: 16 Gi
- CPUs: 4 or more
- Disk: Add an additional 100 Gi for Oracle data
- Network: Default pod network
- Name:
- Click Create, then start the VM.
Option B: Use a configuration file
Practitioners who prefer an automated approach can define the virtual machine as code. You can create the VM by applying a YAML file through the oc command-line utility.
Install RHEL 9
- Access the VM console.
- Follow the interactive RHEL 9 installer:
- Set the host name (for example,
oracle19c.local). - Configure the network and root password.
- Create a regular user (using
oracleis optional). - Partition disk (a custom partition for
/u01is optional).
- Set the host name (for example,
- Once finished, reboot into installed system.
Prepare RHEL 9 for Oracle
Register with Red Hat (if you have not already):
sudo subscription-manager register sudo subscription-manager attach --autoEnable the required repositories:
sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-$(arch)-rpmsInstall the dependencies:
sudo dnf groupinstall "Development Tools" -y sudo dnf install -y bc binutils compat-openssl11 elfutils-libelf gcc \ glibc glibc-devel ksh libaio libaio-devel libXrender \ libX11 libXau libXi libXtst libgcc libnsl make sysstat unixODBC # Optional: Install missing 32-bit libraries (if needed)Create the Oracle user and directories:
sudo groupadd oinstall sudo groupadd dba sudo useradd -g oinstall -G dba oracle sudo passwd oracle sudo mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1 sudo chown -R oracle:oinstall /u01 sudo chmod -R 775 /u01Set kernel parameters. Edit the
/etc/sysctl.conffile:fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 net.core.rmem_default = 262144 net.core.wmem_default = 262144 net.ipv4.ip_local_port_range = 9000 65500Apply the changes:
sudo sysctl -pUpdate the
/etc/security/limits.conffile:oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768
Install Oracle 19c
- Upload the binaries. Copy the file
LINUX.X64_193000_db_home.zipto/home/oracle. Unpack the file and set the environment variables:
su - oracle unzip LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.0.0/dbhome_1 # Add environment to ~/.bash_profile export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=ORCLRun the installer (software only):
cd $ORACLE_HOME ./runInstaller -silent -ignorePrereq -waitforcompletion \ -responseFile $ORACLE_HOME/install/response/db_install.rspRun the root scripts when prompted:
sudo /u01/app/oraInventory/orainstRoot.sh sudo /u01/app/oracle/product/19.0.0/dbhome_1/root.shCreate the Oracle database:
dbca -silent -createDatabase \ -templateName General_Purpose.dbc \ -gdbname ORCL \ -sid ORCL \ -responseFile NO_VALUE \ -characterSet AL32UTF8 \ -memoryPercentage 40 \ -emConfiguration NONE \ -sysPassword Oracle123 \ -systemPassword Oracle123 \ -createAsContainerDatabase true \ -numberOfPDBs 1 \ -pdbName PDB1 \ -pdbAdminPassword Oracle123Verify the installation:
sqlplus / as sysdba
Expose Oracle for access
Create a NodePort service:
apiVersion: v1
kind: Service
metadata:
name: oracle19c-service
namespace: openshift-virtualization
spec:
type: NodePort
selector:
kubevirt.io/domain: oracle19c-rhel9
ports:
- protocol: TCP
port: 1521
targetPort: 1521Another option is to use a load balancer (if supported).
Validation
From an external client:
sqlplus system/Oracle123@//<node-ip>:<node-port>/ORCLFrom inside the cluster, run:
oc run testclient --image=oraclelinux:9 -it -- bash sqlplus ...
Tips and post-installation
After you complete the initial installation, follow these best practices to improve your system performance and data protection.
Take a snapshot to protect your progress
Use Red Hat OpenShift Virtualization to take a snapshot of your virtual machine (VM). This creates a point-in-time backup of your installed image, allowing you to restore the system quickly if you need to start over after a configuration error.
Ensure data persistence for your database
Move the /u01 directory to a persistent volume claim (PVC) to retain your Oracle Database data after a system restart. This ensures that your database remains intact even if the VM is deleted or moved to a different node in the cluster.
Improve system and database security
You can improve the security of your Red Hat Enterprise Linux 9 environment and Oracle Database by implementing specific security controls:
- SELinux tuning: Configure Security-Enhanced Linux (SELinux) to provide mandatory access control for database processes.
- firewalld rules: Use the firewalld service to restrict network traffic to only the necessary database ports.
- SSH key-only access: Disable password authentication and use SSH keys to secure administrative access to the VM.
Scale your deployment with automation
While manual steps help you understand the process, you should use Red Hat Ansible Automation Platform or Terraform to automate this setup. Automation ensures that every Oracle Database environment you create is consistent, repeatable, and follows your team's established best practices
Automation guide and Ansible playbook
The goal of this guide is to create a RHEL 9 virtual machine within OpenShift Virtualization 4.19, set up the environment, and install Oracle Database 19c using Ansible.
Organize your project files using the following directory structure to ensure the playbooks can locate your variables and templates:
oracle19c-install/
├── ansible.cfg
├── inventory.ini
├── vars/
│ └── oracle_vars.yml
├── playbooks/
│ ├── provision_vm.yml
│ ├── prepare_os.yml
│ ├── install_oracle.yml
├── templates/
│ ├── db_install.rsp.j2
│ ├── listener.ora.j2
│ └── tnsnames.ora.j2
└── files/
└── LINUX.X64_193000_db_home.zip # (manually placed)Ansible configuration (ansible.cfg):
[defaults]
inventory = inventory.ini
host_key_checking = False
timeout = 60Inventory (inventory.ini)
Update with your VM IP or host name:
[oracle]
oracle19c ansible_host=<vm_ip_or_hostname> ansible_user=oracle ansible_ssh_private_key_file=~/.ssh/id_rsaDefine variables in vars/oracle_vars.yml:
oracle_base: /u01/app/oracle
oracle_home: "{{ oracle_base }}/product/19.0.0/dbhome_1"
oracle_sid: ORCL
oracle_pdb: PDB1
oracle_password: Oracle123Step-by-step automation workflow
Follow these steps to prepare your virtual machine and execute the installation playbooks in the correct order.
- Prepare the VM for automation: Provision a RHEL 9 VM in OpenShift Virtualization manually using the console or a
kubevirtYAML file. Ensure SSH access is configured for Ansible (by adding a public key or enabling password access). Prepare the operating system: Use the
prepare_os.ymlplaybook to set up the necessary environment on your RHEL VM. It automates the installation of dependencies, creates theoracleuser, and sets the required kernel parameters.- name: Prepare RHEL 9 for Oracle hosts: oracle become: yes vars_files: - ../vars/oracle_vars.yml tasks: - name: Install dependencies dnf: name: - gcc - make - binutils - glibc - glibc-devel - libaio - libaio-devel - ksh - sysstat - unixODBC state: present- name: Add oracle user and groups group: name: oinstall state: present tags: user- name: Add dba group group: name: dba state: present< - name: Add oracle user user: name: oracle group: oinstall groups: dba append: yes shell: /bin/bash - name: Create Oracle base directories file: path: "{{ item }}" state: directory owner: oracle group: oinstall mode: '0775' loop: - "{{ oracle_base }}" - "{{ oracle_home }}" - name: Set sysctl params copy: dest: /etc/sysctl.d/99-oracle.conf content: | fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 net.core.rmem_default = 262144 net.core.wmem_default = 262144 net.ipv4.ip_local_port_range = 9000 65500 notify: Reload sysctl - name: Set security limits lineinfile: path: /etc/security/limits.conf line: "{{ item }}" loop: - 'oracle soft nproc 2047' - 'oracle hard nproc 16384' - 'oracle soft nofile 1024' - 'oracle hard nofile 65536' - 'oracle soft stack 10240' - 'oracle hard stack 32768' handlers: - name: Reload sysctl command: sysctl -p /etc/sysctl.d/99-oracle.confInstall Oracle Database software: The
install_oracle.ymlplaybook handles the heavy lifting of unpacking the binaries and running the Oracle installer in silent mode. It ensures the software is placed in the correctORACLE_HOMEdirectory without manual intervention.- name: Install Oracle 19c hosts: oracle become: yes vars_files: - ../vars/oracle_vars.yml tasks: - name: Unpack Oracle binaries unarchive: src: ../files/LINUX.X64_193000_db_home.zip dest: "{{ oracle_home }}" remote_src: no owner: oracle group: oinstall
- name: Generate response file template: src: ../templates/db_install.rsp.j2 dest: "{{ oracle_home }}/db_install.rsp" owner: oracle group: oinstall
- name: Run Oracle installer (software only) become_user: oracle shell: | {{ oracle_home }}/runInstaller -silent -ignorePrereq -waitforcompletion \ -responseFile {{ oracle_home }}/db_install.rsp args: chdir: "{{ oracle_home }}" register: install_result failed_when: "'Successfully Setup Software' not in install_result.stdout"
- name: Run root scripts shell: | /u01/app/oraInventory/orainstRoot.sh {{ oracle_home }}/root.shTemplate:
db_install.rsp.j2oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME={{ oracle_home }} ORACLE_BASE={{ oracle_base }} oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=dba oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba oracle.install.db.config.starterdb.type=GENERAL_PURPOSE DECLINE_SECURITY_UPDATES=trueCreate your database instance: Once the software is installed, run the
create_database.ymlplaybook to create the actual database container and pluggable database (PDB). It uses the Database Configuration Assistant (DBCA) to build the environment based on your variables.- name: Create Oracle Database hosts: oracle become: yes vars_files: - ../vars/oracle_vars.yml tasks: - name: Create database become_user: oracle shell: | {{ oracle_home }}/bin/dbca -silent -createDatabase \ -templateName General_Purpose.dbc \ -gdbname {{ oracle_sid }} -sid {{ oracle_sid }} \ -responseFile NO_VALUE \ -characterSet AL32UTF8 \ -memoryPercentage 40 \ -emConfiguration NONE \ -sysPassword {{ oracle_password }} \ -systemPassword {{ oracle_password }} \ -createAsContainerDatabase true \ -numberOfPDBs 1 \ -pdbName {{ oracle_pdb }} \ -pdbAdminPassword {{ oracle_password }} args: executable: /bin/bash
How to run the automation
Follow these steps to set up your environment and execute the playbooks.
- Prepare your environment:
- Ensure the RHEL 9 VM is running and can be reached through SSH.
- Place the
LINUX.X64_193000_db_home.zipfile in thefiles/directory.
Run playbooks:
cd oracle19c-install
ansible-playbook playbooks/prepare_os.yml ansible-playbook playbooks/install_oracle.yml ansible-playbook playbooks/create_database.ymlValidation:
sqlplus system/{{ oracle_password }}@//localhost:1521/{{ oracle_sid }}
Bonus tips
Follow these additional practices to make your deployment more flexible and secure.
- Automate binary mounting: Use a persistent volume claim (PVC) and a
DataVolumeto mount Oracle binaries automatically. This approach allows you to share the installation media across multiple virtual machines without manual uploads. - Protect your data: Use the
kubevirtsnapshotting API to take backups of your virtual machine. Taking a snapshot before making significant changes allows you to restore the system to a previous state if an error occurs. - Simplify external access: Use a
NodePortservice to expose Oracle Database port 1521 outside the cluster. This allows external clients and developers to connect to the database instance using standard tools. - Standardize infrastructure: Automate the creation of Red Hat OpenShift virtual machines using KubeVirt CRDs. Defining your virtual machine as code ensures that every environment is built using the same certified configuration.
Conclusion
Installing Oracle 19c on OpenShift Virtualization doesn't have to be a complex, manual process. With Red Hat Ansible Automation Platform, you can automate the entire setup from VM provisioning to database startup. This gives you more consistency, speed, and confidence in your deployments.
Next time you need an Oracle database for development, testing, or production, don't click through installers. Run the playbook.