wnameless / docker-oracle-xe-11g

Dockerfile of Oracle Database Express Edition 11g Release 2
Apache License 2.0
1.34k stars 800 forks source link

running sqlplus in the container (but from a script). #109

Open bkbonner opened 5 years ago

bkbonner commented 5 years ago

We'd like to run sqlplus in the container from a script. Is there an easy way to do this?

When I run:

docker exec -i -t <container> /bin/bash

I can run sqlplus at the command line.

However, if I try to run:

docker exec -i -t dbtemp /bin/bash -c "sqlplus"

I get : /bin/bash: sqlplus: command not found

I'm looking for some advice on how to handle this. Thanks.

bkbonner commented 5 years ago

nvmd. I looked at the setup.sh. and tried the following:

docker exec -i -t -w /tmp dbtemp /bin/bash -c 'export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe; export ORACLE_SID=XE; echo exit | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus system/oracle @initialize.sql'

where dbtemp is the name of my container, /tmp is where I copy my scripts, and initialize.sql is a script I copied under the /tmp directory.

It would be nice if there was an 'initenv' that initialized the ORACLE_HOME and exported the appropriate stuff separate from this that we could call the script to set things up....so it would be maintained consistently by the image.

gerbil commented 5 years ago

/bin/bash: /u01/app/oracle/product/11.2.0/xe/bin/sqlplus: No such file or directory /bin/bash: sqlplus: No such file or directory

env: ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe ORACLE_SID=XE