0

I'm working on a project with Oracle, and using a Oracle XE 11 container for testing. But recent developments have ended up with me running up against a brick wall: I need larger table names. Support for large table names was apparently added in version 12, so I'm trying to change out the container I'm using.

I'm setting up the container in Java using testcontainers:

db = new OracleContainer("epiclabs/docker-oracle-xe-11g");

When I look around on Docker Hub for Oracle 12 containers, I get a bunch of results, but every one I've tried so far, if I substitute its name in as the image name in the code above, it spins for 10-20 minutes, then errors out with

ORA-12514, TNS:Listener does not currently know of service requested in connect descriptor

And I have no idea what the problem is here. I have plenty of SQL experience, but next to none with Oracle specifically, and trying to get this Oracle-related project working has been a bit of a disaster so far. Does anyone know what's going wrong and how I can get connected to a Oracle 12 Docker container?

4
  • Aside from your techinical problem, I've always questioned why anyone thinks they need table names longer than 30 characters. Even at 30, the names become so long as to be very unwieldy and hard to follow.
    – EdStevens
    Commented May 21, 2021 at 12:41
  • Please provide complete commands setting up docker container and how are you trying to connect to container once container is up and running.
    – Suresh
    Commented May 21, 2021 at 14:32
  • @EdStevens You're not wrong, but... it's for table names being generated procedurally, for data management tooling, according to a formula that works just fine on other databases. Commented May 21, 2021 at 15:32
  • @Suresh I'm using testcontainers. That one line of code (and the corresponding import statement at the top) is the complete command for setting it up! Commented May 21, 2021 at 15:32

1 Answer 1

0

"Semi-official" images available on hub.docker.com

docker image ls
REPOSITORY         TAG           IMAGE ID       CREATED       SIZE
gvenzl/oracle-xe   18            e1d4dae1771b   4 days ago    3.69GB
gvenzl/oracle-xe   18.4.0        e1d4dae1771b   4 days ago    3.69GB
gvenzl/oracle-xe   latest        e1d4dae1771b   4 days ago    3.69GB
gvenzl/oracle-xe   18-full       13085168429b   12 days ago   6.36GB
gvenzl/oracle-xe   18.4.0-full   13085168429b   12 days ago   6.36GB
gvenzl/oracle-xe   full          13085168429b   12 days ago   6.36GB

docker-compose.yml for persistent database.

version: '3.8'
services:
  database:
    image: gvenzl/oracle-xe:18
    container_name: oracle
    environment:
      - ORACLE_PASSWORD=Welcome_1
    volumes:
      - type: volume
        source: oradata
        target: /opt/oracle/oradata
    ports:
      - 1521:1521
    networks:
      - dbnet
    healthcheck:
      test: sql -L -S sys/Welcome_1@localhost:1521/XEPDB1 as sysdba < /dev/null |grep 'ORA-'; if [[ $$? == 1 ]]; then echo 0; else echo 1; fi
      interval: 1m
      timeout: 10s
      retries: 20
      start_period: 40s
networks:
  dbnet:
volumes:
   oradata:
     driver: local
     driver_opts:
       type: none
       device: $PWD/oradata
       o: bind

Note, make sure "oradata" is rw by oracle user inside container.

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.