akridge / oracle-apex-docker-stack

Deploy a complete Oracle Database XE, ORDS, & APEX stack on Docker using Docker Compose
10 stars 7 forks source link

apxchpwd.sql #2

Open mvonline opened 1 year ago

mvonline commented 1 year ago

to run apxchpwd.sql and change the admin password from auto-ords-reg we must define remote tns?

akridge commented 1 year ago

@mvonline Thanks for trying these out. Good question.

If you want to access those scripts, since ords/apex & the database are in separate containers, the easiest solution is to make a shared vol for the apex files so the database container can access the files.

So just update compose file for each container like so

    volumes:
      - apex-vol:/opt/oracle/apex

Full example:

services:
  auto-xe-reg:
    container_name: auto-xe-reg
    image: gvenzl/oracle-xe
    ports: 
      - 1521:1521
    environment:
      - ORACLE_PASSWORD=PASSWORDHERE
    volumes:
      - apex-vol:/opt/oracle/apex
    hostname: database
    healthcheck:
      test: ["CMD", "healthcheck.sh"]
      interval: 30s
      timeout: 10s
      retries: 100
  auto-ords-reg:
    container_name: auto-ords-reg
    restart: always
    depends_on:
      auto-xe-reg:
        condition: service_healthy
    volumes:
      - ./ords_secrets:/opt/oracle/variables
      - apex-vol:/opt/oracle/apex
      - ords-config-reg:/etc/ords/config
    ports:
      - 8181:8181
    image: container-registry.oracle.com/database/ords:latest
volumes:
  ords-config-reg:
    name: ords-config-reg
  apex-vol:
    name: apex-vol
networks:
  default:
    name: database-network

Then when you are ready to run "apxchpwd.sql" just exec into the database container like so:

docker exec -it auto-xe-reg bash
cd /opt/oracle/apex/23.1.0/
sqlplus / as sysdba
ALTER SESSION SET CONTAINER = XEPDB1;
@apxchpwd.sql
mvonline commented 1 year ago

Thanks. Will try.