I am trying to set up an Oracle database in Docker, and once the database is up and running, I can exec into sqlplus just fine, but if I try to connect with another application like Oracle SQL Developer or SQuirreL, either it will stall out while trying to connect, or it will manage to connect and then all future queries will stall. What is wrong with this?

Here is how I set up the container: I used the docker image available from Oracle on Docker Hub.

Here is the command I ran to create the container:

docker run --name someName -p 1521:1521 -p 5500:5500 -e ORACLE_SID=SOMESID -e ORACLE_PDB=SOMEPDBNAME -e ORACLE_PWD=12345 -it 12a359cd0528

Here are the commands I ran once the container was up and running:

docker exec -it npsIG /bin/bash
sqlplus / as sysdba
alter session set "_ORACLE_SCRIPT"=true;
create user username identified by 12345;
grant dba to username;

At this point, sometimes I can connect on the created user, sometimes it just stalls out. If I manage to connect on the created user, no further queries will process.

  • This is for a local dev environment. Our application supports MSSQL, Oracle, and DB2, and while MSSQL is fine 90% of the time, in this instance I need Oracle and am more interested in getting a working database set up than security since 1. It will not be publically exposed or even exposed to other machines on the local network, and 2. Will only be running for the duration of testing.
    – Katherine1
    Aug 12, 2019 at 13:00
  • 1
    Sounds like there are not enough resources on the Docker host to run the Oracle database server.
    – mustaccio
    Sep 1, 2020 at 20:41

1 Answer 1


IF that is actually your script, then after you connect "/ as sysdba", then sqlplus is simply waiting for input. It doesn't see the 'alter session', etc, because those aren't being redirected into sqlplus. Rather, they are simply treated as the next command for the shell to process after sqlplus exits.

Try this:

sqlplus / as sysdba <<EOF 
alter session set "_ORACLE_SCRIPT"=true;
create user username identified by 12345; 
grant dba to username; exit

BTW, you should not be using 'as sysdba' if you can accomplish the same thing with a less privileged user, such as SYSTEM. Connecting to oracle as SYS is like connecting to Linux as root. You are running with scissors, knives, and blowtorches, all without a net.

  • No, I was running each line manually. The user was created. It's just locking up either when I try to connect with the user, or after connecting with the user. And I'm not overly concerned with security. This is for a local dev environment, not a production server. It just needs to be a quick and dirty setup that works for the duration of testing.
    – Katherine1
    Aug 12, 2019 at 12:57
  • What I'm looking for: I need a functioning Oracle Database set up with docker. I need to be able to run the SQL scripts to set up said database (an admin account I can ideally connect to through a program like Oracle SQL Developer or SQuirreL), and a user for the application to utilize. Said users need to not lock up while connecting to the database or running even the most basic query.
    – Katherine1
    Aug 12, 2019 at 13:04
  • If there's a problem with an Oracle database, then the first place you should look is in that database's Alert log.
    – Phill W.
    Apr 30, 2021 at 12:18

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.