Before you begin
Ensure that you meet the following system requirements:
-
You've installed AlloyDB Omni on your system.
-
You've installed the AlloyDB Omni CLI on your system.
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:
sudo alloydb version
The output is similar to the following:
AlloyDB Omni CLI version: 1.0 AlloyDB Omni database server version: 15.5.2
Take note of the database server 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.2
. - Create a new AlloyDB Omni container that includes Orafce:
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 gcr . io / alloydb - omni / pg - service : $ { OMNI_VERSION } COPY -- from = postgres / usr / lib / postgresql / 15 / lib / orafce . so / lib / orafce . so COPY -- from = postgres / usr / share / postgresql / 15 / extension / orafce * / 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 gcr . io / alloydb - omni / pg - service - with - orafce : $ OMNI_VERSION .
- Stop the database server:
sudo alloydb database-server stop
- Open
/var/alloydb/config/dataplane.conf
in a text editor. - Modify the line that defines the
PG_IMAGE
variable so that it refers to the container that you built in a previous step:PG_IMAGE=gcr.io/alloydb-omni/pg-service-with-orafce
- Start AlloyDB Omni:
sudo alloydb database-server start
- Connect to your database:
sudo docker exec -it pg-service psql -h localhost -U postgres
- Enable Orafce:
CREATE EXTENSION IF NOT EXISTS ORAFCE ;
- Confirm that Orafce is installed and enabled:
SELECT oracle . sysdate ();