En esta página, se describe cómo agregar manualmente la extensión orafce a una instalación existente de AlloyDB Omni. La extensión orafce proporciona funciones y operadores que emulan un subconjunto de funciones y paquetes de la base de datos de Oracle. Esta extensión simplifica la migración de aplicaciones de Oracle a bases de datos compatibles con PostgreSQL, como AlloyDB Omni.
Antes de comenzar
Instala 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:
Sigue estos pasos para encontrar las etiquetas de la versión de AlloyDB Omni que instalaste:
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: 16.8.0
Toma nota del número de versión de AlloyDB Omni, ya que lo necesitarás en el siguiente paso.
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 nuevo contenedor con AlloyDB Omni, llamado
my-omni-orafce
:docker build -t google/alloydbomni-with-orafce:latest 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 a este:
postgres=# SELECT oracle.sysdate(); sysdate --------------------- 2024-06-10 16:36:30 (1 row)