시작하기 전에
시스템에 AlloyDB Omni를 설치했는지 확인합니다.
단일 서버
AlloyDB Omni 설치에 Orafce 추가
AlloyDB Omni 설치에 Orafce 확장 프로그램을 추가하려면 다음 단계를 따르세요.
- 설치된 AlloyDB Omni 버전 라벨을 찾습니다.
  Dockerdocker run --rm -it google/alloydbomni cat VERSION.txt Podmanpodman run --rm -it google/alloydbomni cat VERSION.txt 출력은 다음과 비슷합니다. AlloyDB Omni version: 15.5.5 AlloyDB Omni 버전 번호를 기록해 둡니다. 다음 단계에서 필요합니다. 
- OMNI_VERSION환경 변수를 설정합니다.- OMNI_VERSION=VERSION - VERSION을 이전 단계의 전체 데이터베이스 서버 버전으로 바꿉니다(예: - 15.5.5).
-  Orafce가 포함된 새 AlloyDB Omni 컨테이너를 만듭니다.
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 .
- AlloyDB Omni가 포함된 새 컨테이너를 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 
- Orafce 확장 프로그램으로 데이터베이스에 연결합니다.
Dockerdocker exec -it my-omni-orafce psql -h localhost -U postgres Podmanpodman exec -it my-omni-orafce psql -h localhost -U postgres 
- Orafce 사용 설정:
CREATE EXTENSION IF NOT EXISTS ORAFCE; 
- Orafce가 설치되고 사용 설정되었는지 확인합니다.
SELECT oracle.sysdate(); postgres=# SELECT oracle.sysdate(); sysdate --------------------- 2024-06-10 16:36:30 (1 row)