Before you begin
Ensure that you've installed AlloyDB Omni 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:
- 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. 
- Set the OMNI_VERSIONenvironment variable:OMNI_VERSION = VERSION Replace VERSION with the complete database server version from the previous step—for example, 15.5.4.
- Create a new AlloyDB Omni container that includes Orafce: Dockermkdir ~/alloydb-omni-orafcetee -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/ EOFcd ~/alloydb-omni-orafcesudo docker build --build-arg OMNI_VERSION = $OMNI_VERSION --tag google/alloydbomni-with-orafce: $OMNI_VERSION .Podmanmkdir ~/alloydb-omni-orafcetee -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/ EOFcd ~/alloydb-omni-orafcesudo podman build --build-arg OMNI_VERSION = $OMNI_VERSION --tag google/alloydbomni-with-orafce: $OMNI_VERSION .Dockermkdir ~/alloydb-omni-orafcetee -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/ EOFcd ~/alloydb-omni-orafcesudo docker build --build-arg OMNI_VERSION = $OMNI_VERSION --tag google/alloydbomni-with-orafce: $OMNI_VERSION .Podmanmkdir ~/alloydb-omni-orafcetee -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/ EOFcd ~/alloydb-omni-orafcesudo podman build --build-arg OMNI_VERSION = $OMNI_VERSION --tag google/alloydbomni-with-orafce: $OMNI_VERSION .
- Create a new container with AlloyDB Omni named my-omni-orafce:Dockerdocker run --name my-omni-orafce -e POSTGRES_PASSWORD= NEW_PASSWORD -d google/alloydbomni-with-orafce: OMNI_VERSION Podmanpodman run --name my-omni-orafce -e POSTGRES_PASSWORD= NEW_PASSWORD -d google/alloydbomni-with-orafce: OMNI_VERSION 
- Connect to your database with the Orafce extension: Dockerdocker exec -it my-omni-orafce psql -h localhost -U postgres Podmanpodman exec -it my-omni-orafce psql -h localhost -U postgres 
- Enable Orafce: CREATE EXTENSION IF NOT EXISTS ORAFCE ; 
- Confirm that Orafce is installed and enabled: SELECT oracle . sysdate (); postgres =# SELECT oracle . sysdate (); sysdate 
 2024 - 06 - 10 16 : 36 : 30 ( 1 row )

