AlloyDB Omni no incluye la extensión orafce, pero puedes agregarla manualmente a una instalación existente de AlloyDB Omni siguiendo las instrucciones de esta página. La extensión orafce proporciona funciones y operadores que emulan un subconjunto de funciones y paquetes de la base de datos de Oracle. Esto simplifica la migración de aplicaciones de Oracle a bases de datos compatibles con PostgreSQL, como AlloyDB Omni.
Antes de comenzar
Asegúrate de haber instalado AlloyDB Omni en tu sistema.
Agrega orafce a tu instalación de AlloyDB Omni
Para agregar la extensión orafce a tu instalación de AlloyDB Omni, sigue estos pasos:
- Busca las etiquetas de versión de AlloyDB Omni instaladas:
Docker
docker run --rm -it google/alloydbomni cat VERSION.txt
Podman
podman run --rm -it google/alloydbomni cat VERSION.txt
El resultado es similar a este:
AlloyDB Omni version: Omniween
Anota el número de versión de AlloyDB Omni, ya que lo necesitarás en el siguiente paso.
- Establece la variable de entorno
OMNI_VERSION
:OMNI_VERSION=VERSION
Reemplaza VERSION por la versión completa del servidor de la base de datos del paso anterior, por ejemplo,
16.3.0
. - Crea un nuevo contenedor de AlloyDB Omni que incluya 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-16-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-16-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 .
Crea un contenedor nuevo con AlloyDB Omni llamado
my-omni-orafce
:docker run --name my-omni-orafce -e POSTGRES_PASSWORD=NEW_PASSWORD -d google/alloydbomni-with-orafce:OMNI_VERSION
Conéctate a tu base de datos con la extensión orafce:
docker exec -it my-omni-orafce psql -h localhost -U postgres
- Habilita orafce:
CREATE EXTENSION IF NOT EXISTS ORAFCE;
Confirma que orafce esté instalado y habilitado:
SELECT oracle.sysdate();
El resultado es similar al siguiente:
postgres=# SELECT oracle.sysdate();
sysdate
---------------------
2024-06-10 16:36:30
(1 row)