Install orafce for AlloyDB Omni

Select a documentation version:

This page describes how to manually add the orafce extension to an existing AlloyDB Omni installation. The orafce extension provides functions and operators that emulate a subset of functions and packages from the Oracle database. This extension simplifies migration of applications from Oracle to PostgreSQL-compatible databases such as AlloyDB Omni.

Before you begin

Install AlloyDB Omni on your system.

Add orafce to your AlloyDB Omni installation

To add the orafce extension to your AlloyDB Omni installation, follow these steps:

  1. Add the PostgreSQL Yum Repository:

    sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    
  2. Install PostgreSQL server and development packages:

    sudo dnf install -y "postgresql17-server"
    
  3. Install the Orafce extension:

    sudo dnf install -y orafce_17
    
  4. Create required symlinks so the extensions are in the expected paths:

    set -e
    PGVER="17"
    
    sudo mkdir -p "/usr/lib/postgresql/${PGVER}/share/extension"
    
    for file in /usr/pgsql-${PGVER}/share/extension/*; do
      target="/usr/lib/postgresql/${PGVER}/share/extension/$(basename "$file")"
      if [[ ! -e "$target" ]]; then
        sudo ln -s "$file" "$target" || (echo "Failed to link \"$file\" to \"$target\", exiting." && exit 1)
        echo "Created extension link for $(basename "$file")"
      else
        echo "Target $target already exists."
      fi
    done
    
    sudo mkdir -p "/usr/lib/postgresql/${PGVER}/lib"
    
    for file in /usr/pgsql-${PGVER}/lib/*; do
        if [[ ! -e "$target" ]]; then
          sudo ln -s "$file" "$target" || (echo "Failed to link \"$file\" to \"$target\", exiting." && exit 1)
          echo "Created lib link for $(basename "$file")"
        else
          echo "Target $target already exists."
        fi
    done
    
  5. Connect to your database with the orafce extension:

    /usr/lib/postgresql/17/bin/psql -h localhost -U postgres
    
  6. Enable orafce:

    CREATE EXTENSION IF NOT EXISTS ORAFCE;
    
  7. Confirm that orafce is installed and enabled:

    SELECT oracle.sysdate();
    

    The output is similar to the following:

    postgres=# SELECT oracle.sysdate();
    sysdate
    ---------------------
    2025-12-12 16:36:30
    (1 row)