Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • See all Red Hat products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Red Hat OpenShift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • See all technologies
    • Programming languages & frameworks

      • Java
      • Python
      • JavaScript
    • System design & architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer experience

      • Productivity
      • Tools
      • GitOps
    • Automated data processing

      • AI/ML
      • Data science
      • Apache Kafka on Kubernetes
    • Platform engineering

      • DevOps
      • DevSecOps
      • Red Hat Ansible Automation Platform for applications and services
    • Secure development & architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & cloud native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • See all learning resources

    E-books

    • GitOps cookbook
    • Podman in action
    • Kubernetes operators
    • The path to GitOps
    • See all e-books

    Cheat sheets

    • Linux commands
    • Bash commands
    • Git
    • systemd commands
    • See all cheat sheets

    Documentation

    • Product documentation
    • API catalog
    • Legacy documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore the Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Automate Oracle 19c deployments on OpenShift Virtualization

December 22, 2025
Bins Sam Thomas
Related topics:
Automation and managementDatabasesDeveloper ProductivityGitOps
Related products:
Red Hat Ansible Automation PlatformRed Hat OpenShiftRed Hat OpenShift Virtualization

    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:

    1. Creating a RHEL 9 VM manually in OpenShift Virtualization.
    2. Configuring the operating system (users, kernel parameters, packages).
    3. Attaching storage and mounting file systems.
    4. Uploading Oracle installation media.
    5. Running the Oracle installer in silent mode.
    6. 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

    1. In the OpenShift web console, go to Operators → OperatorHub.
    2. Search for OpenShift Virtualization.
    3. Click Install in the openshift-cnv namespace.
    4. Once installed, go to Operators → Installed Operators → OpenShift Virtualization.
    5. Select the Create HyperConverged resource.
    6. 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.

    1. 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.yaml
    2. Upload the ISO using the virtctl command:

      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.

    1. Go to Virtualization → Virtual Machines → Create VM.
    2. Choose Custom Template.
    3. 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
    4. 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

    1. Access the VM console.
    2. Follow the interactive RHEL 9 installer:
      1. Set the host name (for example, oracle19c.local).
      2. Configure the network and root password.
      3. Create a regular user (using oracle is optional).
      4. Partition disk (a custom partition for /u01 is optional).
    3. Once finished, reboot into installed system.

    Prepare RHEL 9 for Oracle

    1. Register with Red Hat (if you have not already):

      sudo subscription-manager register
      sudo subscription-manager attach --auto
    2. Enable the required repositories:

      sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-$(arch)-rpms
    3. Install 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)
    4. 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 /u01
    5. Set kernel parameters. Edit the /etc/sysctl.conf file:

      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

      Apply the changes:

      sudo sysctl -p

      Update the /etc/security/limits.conf file:

      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

    1. Upload the binaries. Copy the file LINUX.X64_193000_db_home.zip to /home/oracle.
    2. 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=ORCL
    3. Run the installer (software only):

      cd $ORACLE_HOME
      ./runInstaller -silent -ignorePrereq -waitforcompletion \
       -responseFile $ORACLE_HOME/install/response/db_install.rsp
    4. Run the root scripts when prompted:

      sudo /u01/app/oraInventory/orainstRoot.sh
      sudo /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

      Create 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 Oracle123

      Verify 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: 1521

    Another option is to use a load balancer (if supported).

    Validation

    1. From an external client:

      sqlplus system/Oracle123@//<node-ip>:<node-port>/ORCL
    2. From 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 = 60

    Inventory (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_rsa

    Define 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: Oracle123

    Step-by-step automation workflow

    Follow these steps to prepare your virtual machine and execute the installation playbooks in the correct order.

    1. Prepare the VM for automation: Provision a RHEL 9 VM in OpenShift Virtualization manually using the console or a kubevirt YAML file. Ensure SSH access is configured for Ansible (by adding a public key or enabling password access).
    2. Prepare the operating system: Use the prepare_os.yml playbook to set up the necessary environment on your RHEL VM. It automates the installation of dependencies, creates the oracle user, 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.conf
    3. Install Oracle Database software: The install_oracle.yml playbook handles the heavy lifting of unpacking the binaries and running the Oracle installer in silent mode. It ensures the software is placed in the correct ORACLE_HOME directory 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.sh

      Template: db_install.rsp.j2

      oracle.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=true
    4. Create your database instance: Once the software is installed, run the create_database.yml playbook 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.

    1. Prepare your environment:
      1. Ensure the RHEL 9 VM is running and can be reached through SSH.
      2. Place the LINUX.X64_193000_db_home.zip file in the files/ directory.
    2. Run playbooks:

      cd oracle19c-install
      ansible-playbook playbooks/prepare_os.yml ansible-playbook playbooks/install_oracle.yml ansible-playbook playbooks/create_database.yml
    3. Validation:

      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 DataVolume to 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 kubevirt snapshotting 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 NodePort service 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.

    Related Posts

    • PostGIS: A powerful geospatial extension for PostgreSQL

    • Boost OpenShift database VM density with memory overcommit

    • How to run SQL Server with SELinux enabled on RHEL 9

    • Develop SQL Server databases on RHEL with Podman Desktop

    • Use NetApp to run SAP on OpenShift Virtualization with a dual boot on bare metal

    • Automate VM golden image builds for OpenShift with Packer

    Recent Posts

    • Automate Oracle 19c deployments on OpenShift Virtualization

    • Monitoring OpenShift Gateway API and Service Mesh with Kiali

    • Improve efficiency with OpenStack Services on OpenShift

    • Quantum-secure gateways in Red Hat OpenShift Service Mesh 3.2

    • Quantum-secure gateways in Red Hat OpenShift Service Mesh 3.2

    What’s up next?

    Download the OpenShift Virtualization for VMware admins cheat sheet for a quick guide to managing virtual machines within the powerful OpenShift environment.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue