AlloyDB Omni does not include the orafce extension, 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.
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
docker run --rm -it google/alloydbomni cat VERSION.txt
Podman
podman run --rm -it google/alloydbomni cat VERSION.txt
The output is similar to the following:
AlloyDB Omni version: 15.7.0
Take note of the AlloyDB Omni version number; you need it in the next step.
- Set the
OMNI_VERSION
environment variable:OMNI_VERSION=VERSION
Replace VERSION with the complete database server version from the previous step—for example,
15.5.3
. - Create a new AlloyDB Omni container that includes orafce:
Linux
mkdir ~/alloydb-omni-orafce
tee -a ~/alloydb-omni-orafce/Dockerfile << EOF ARG OMNI_VERSION FROM google/alloydbomni:${OMNI_VERSION} 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/* EOF
cd ~/alloydb-omni-orafce
sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-orafce:$OMNI_VERSION .
macOS
mkdir ~/alloydb-omni-orafce
tee -a ~/alloydb-omni-orafce/Dockerfile << EOF ARG OMNI_VERSION FROM google/alloydbomni:${OMNI_VERSION} 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/* EOF
cd ~/alloydb-omni-orafce
sudo docker 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
:docker 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:
docker 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();
The output looks similar to the following:postgres=# SELECT oracle.sysdate(); sysdate --------------------- 2024-06-10 16:36:30 (1 row)