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

- [Current (18.4.0)](https://docs.cloud.google.com/alloydb/omni/containers/current/docs/install-orafce.md.txt)
- [18.4.0](https://docs.cloud.google.com/alloydb/omni/containers/18.4.0/docs/install-orafce.md.txt)
- [18.3.0](https://docs.cloud.google.com/alloydb/omni/containers/18.3.0/docs/install-orafce.md.txt)
- [18.1.0](https://docs.cloud.google.com/alloydb/omni/containers/18.1.0/docs/install-orafce.md.txt)
- [17.10.0](https://docs.cloud.google.com/alloydb/omni/containers/17.10.0/docs/install-orafce.md.txt)
- [17.9.0](https://docs.cloud.google.com/alloydb/omni/containers/17.9.0/docs/install-orafce.md.txt)
- [17.7.0](https://docs.cloud.google.com/alloydb/omni/containers/17.7.0/docs/install-orafce.md.txt)
- [17.5.0](https://docs.cloud.google.com/alloydb/omni/containers/17.5.0/docs/install-orafce.md.txt)
- [16.14.0](https://docs.cloud.google.com/alloydb/omni/containers/16.14.0/docs/install-orafce.md.txt)
- [16.13.0](https://docs.cloud.google.com/alloydb/omni/containers/16.13.0/docs/install-orafce.md.txt)
- [16.11.0](https://docs.cloud.google.com/alloydb/omni/containers/16.11.0/docs/install-orafce.md.txt)
- [16.9.0](https://docs.cloud.google.com/alloydb/omni/containers/16.9.0/docs/install-orafce.md.txt)
- [16.8.0](https://docs.cloud.google.com/alloydb/omni/containers/16.8.0/docs/install-orafce.md.txt)
- [16.3.0](https://docs.cloud.google.com/alloydb/omni/containers/16.3.0/docs/install-orafce.md.txt)
- [15.18.0](https://docs.cloud.google.com/alloydb/omni/containers/15.18.0/docs/install-orafce.md.txt)
- [15.17.0](https://docs.cloud.google.com/alloydb/omni/containers/15.17.0/docs/install-orafce.md.txt)
- [15.15.0](https://docs.cloud.google.com/alloydb/omni/containers/15.15.0/docs/install-orafce.md.txt)
- [15.13.0](https://docs.cloud.google.com/alloydb/omni/containers/15.13.0/docs/install-orafce.md.txt)
- [15.12.0](https://docs.cloud.google.com/alloydb/omni/containers/15.12.0/docs/install-orafce.md.txt)
- [15.7.1](https://docs.cloud.google.com/alloydb/omni/containers/15.7.1/docs/install-orafce.md.txt)
- [15.7.0](https://docs.cloud.google.com/alloydb/omni/containers/15.7.0/docs/install-orafce.md.txt)
- [15.5.5](https://docs.cloud.google.com/alloydb/omni/containers/15.5.5/docs/install-orafce.md.txt)
- [15.5.4](https://docs.cloud.google.com/alloydb/omni/containers/15.5.4/docs/install-orafce.md.txt)
- [15.5.2](https://docs.cloud.google.com/alloydb/omni/containers/15.5.2/docs/install-orafce.md.txt)

<br />

AlloyDB Omni does not include [the Orafce extension](https://github.com/orafce/orafce), but you can manually add it to an existing AlloyDB Omni installation by following the instructions on this page to provide additional functions and operators from the Oracle database.

<br />

## Before you begin

Ensure that you've [installed AlloyDB Omni](https://docs.cloud.google.com/alloydb/omni/containers/15.5.4/docs/install.md.txt) on your system.

### Single-server

## Add Orafce to your AlloyDB Omni installation

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

1. Find your installed AlloyDB Omni version labels:

   ```
   docker run --rm -it  google/alloydbomni cat VERSION.txt
   ```

   The output is similar to the following:

   ```
   AlloyDB Omni version: 15.5.4
   ```

   Take note of the AlloyDB Omni version number; you need it in the next step.
2. Set the `OMNI_VERSION` environment variable:

   ```bash
   OMNI_VERSION=VERSION
   ```

   Replace <var translate="no">VERSION</var> with the complete database server version from the previous step---for example, `15.5.4`.
3. Create a new AlloyDB Omni container that includes Orafce:

   ### Docker

   ```bash
     mkdir ~/alloydb-omni-orafce
     tee -a ~/alloydb-omni-orafce/Dockerfile << EOF
     ARG OMNI_VERSION

     FROM postgres:15-bookworm AS postgres

     RUN apt-get update && \
     apt-get install -y --no-install-recommends \
     postgresql-15-orafce && \
     apt-get purge -y --auto-remove && \
     rm -rf /var/lib/apt/lists/*

     FROM google/alloydbomni:${OMNI_VERSION}

     COPY --from=postgres /usr/lib/postgresql/15/lib/orafce.so /usr/lib/postgresql/15/lib/orafce.so
     COPY --from=postgres /usr/share/postgresql/15/extension/orafce* /usr/lib/postgresql/15/share/extension/

     COPY --from=postgres /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
     COPY --from=postgres /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
     EOF
     cd ~/alloydb-omni-orafce
     sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-orafce:$OMNI_VERSION .
     
   ```

   ### Podman

   ```bash
     mkdir ~/alloydb-omni-orafce
     tee -a ~/alloydb-omni-orafce/Dockerfile << EOF
     ARG OMNI_VERSION

     FROM postgres:15-bookworm AS postgres

     RUN apt-get update && \
     apt-get install -y --no-install-recommends \
     postgresql-15-orafce && \
     apt-get purge -y --auto-remove && \
     rm -rf /var/lib/apt/lists/*

     FROM google/alloydbomni:${OMNI_VERSION}

     COPY --from=postgres /usr/lib/postgresql/15/lib/orafce.so /usr/lib/postgresql/15/lib/orafce.so
     COPY --from=postgres /usr/share/postgresql/15/extension/orafce* /usr/lib/postgresql/15/share/extension/

     COPY --from=postgres /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/
     COPY --from=postgres /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
     EOF
     cd ~/alloydb-omni-orafce
     sudo podman build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-orafce:$OMNI_VERSION .
     
   ```

   ### Docker

   ```bash
     mkdir ~/alloydb-omni-orafce
     tee -a ~/alloydb-omni-orafce/Dockerfile << EOF
     ARG OMNI_VERSION

     FROM postgres:15-bookworm AS postgres

     RUN apt-get update && \
     apt-get install -y --no-install-recommends \
     postgresql-15-orafce && \
     apt-get purge -y --auto-remove && \
     rm -rf /var/lib/apt/lists/*

     FROM google/alloydbomni:${OMNI_VERSION}

     COPY --from=postgres /usr/lib/postgresql/15/lib/orafce.so /usr/lib/postgresql/15/lib/orafce.so
     COPY --from=postgres /usr/share/postgresql/15/extension/orafce* /usr/lib/postgresql/15/share/extension/

     COPY --from=postgres /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
     COPY --from=postgres /lib/aarch64-linux-gnu/ /lib/aarch64-linux-gnu/
     EOF
     cd ~/alloydb-omni-orafce
     sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-orafce:$OMNI_VERSION .
     
   ```

   ### Podman

   ```bash
     mkdir ~/alloydb-omni-orafce
     tee -a ~/alloydb-omni-orafce/Dockerfile << EOF
     ARG OMNI_VERSION

     FROM postgres:15-bookworm AS postgres

     RUN apt-get update && \
     apt-get install -y --no-install-recommends \
     postgresql-15-orafce && \
     apt-get purge -y --auto-remove && \
     rm -rf /var/lib/apt/lists/*

     FROM google/alloydbomni:${OMNI_VERSION}

     COPY --from=postgres /usr/lib/postgresql/15/lib/orafce.so /usr/lib/postgresql/15/lib/orafce.so
     COPY --from=postgres /usr/share/postgresql/15/extension/orafce* /usr/lib/postgresql/15/share/extension/

     COPY --from=postgres /usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
     COPY --from=postgres /lib/aarch64-linux-gnu/ /lib/aarch64-linux-gnu/
     EOF
     cd ~/alloydb-omni-orafce
     sudo podman build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-orafce:$OMNI_VERSION .
   ```
4. Create a new container with AlloyDB Omni named `my-omni-orafce`:

   ### Docker

   ```
   docker run --name my-omni-orafce  -e POSTGRES_PASSWORD=NEW_PASSWORD  -d google/alloydbomni-with-orafce:OMNI_VERSION
   ```

   ### Podman

   ```
   podman run --name my-omni-orafce  -e POSTGRES_PASSWORD=NEW_PASSWORD  -d google/alloydbomni-with-orafce:OMNI_VERSION
   ```
5. Connect to your database with the Orafce extension:

   ### Docker

   ```
   docker exec -it my-omni-orafce psql -h localhost -U postgres
   ```

   ### Podman

   ```
   podman exec -it my-omni-orafce psql -h localhost -U postgres
   ```
6. Enable Orafce:

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

   ```sql
   SELECT oracle.sysdate();
   ```
   The output looks similar to the following:

   ```sql
   postgres=# SELECT oracle.sysdate();
        sysdate
   ---
   2024-06-10 16:36:30
   (1 row)
   ```

> [!NOTE]
> **Note:** Due to some known issues with the Orafce extension on AlloyDB Omni, we don't recommend using the `dbms_utility.format_call_stack` and `dbms_output.get_line` functions.