Select a documentation version: <button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">18.1.1</button>

- [Current (18.4.0)](https://docs.cloud.google.com/alloydb/omni/linux/current/docs/install-orafce.md.txt)
- [18.4.0](https://docs.cloud.google.com/alloydb/omni/linux/18.4.0/docs/install-orafce.md.txt)
- [18.3.0](https://docs.cloud.google.com/alloydb/omni/linux/18.3.0/docs/install-orafce.md.txt)
- [18.1.1](https://docs.cloud.google.com/alloydb/omni/linux/18.1.1/docs/install-orafce.md.txt)
- [18.1.0](https://docs.cloud.google.com/alloydb/omni/linux/18.1.0/docs/install-orafce.md.txt)
- [17.5.0](https://docs.cloud.google.com/alloydb/omni/linux/17.5.0/docs/install-orafce.md.txt)

<br />

This page describes how to manually add the [orafce extension](https://github.com/orafce/orafce) 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.

<br />

## Before you begin

[Install AlloyDB Omni](https://docs.cloud.google.com/alloydb/omni/linux/18.1.1/docs/deploy-vm.md.txt) 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:

   ```bash
   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:

   ```bash
   sudo dnf install -y "postgresql18-server"
   ```
3. Install the Orafce extension:

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

   ```bash
   set -e
   PGVER="18"

   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
     target="/usr/lib/postgresql/${PGVER}/lib/$(basename "$file")"
     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 and run the `CREATE EXTENSION` command to enable
   orafce:


   For instructions on connecting to your instance, see
   [Run and connect to AlloyDB Omni](https://docs.cloud.google.com/alloydb/omni/linux/18.1.1/docs/run-connect.md.txt).

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

   ```sql
   SELECT oracle.sysdate();
   ```

   The output is similar to the following:

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