docker-oracle-xe-11g icon indicating copy to clipboard operation
docker-oracle-xe-11g copied to clipboard

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

Open bkbonner opened this issue 6 years ago • 2 comments

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 avatar Oct 17 '18 20:10 bkbonner

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.

bkbonner avatar Oct 17 '18 20:10 bkbonner

/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

gerbil avatar Oct 26 '18 12:10 gerbil