sqlplus不在docker中

时间:2019-01-30 15:08:11

标签: linux oracle docker

我的问题是在我的docker oracle数据库中找不到sqlplus。 你能帮助我吗。 我一直在sh:sqlplus:找不到命令 我试图做一个码头工人数据库; 我是Docker的初学者 我尝试过:

ENV ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1/bin/sqlplus
RUN echo 'export ORACLE_HOME=u01/app/oracle/product/12.2.0/dbhome_1/bin/sqlplus' >> etc/bash.bashrc
RUN echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc

FROM registry-innersource.soprasteria.com/sib/docker/db-oracle-12.2.0.1

# Set Environment Variables
ENV SYS_USER SYS
ENV SYS_PASSW password
ENV JAVA_HOME /jdk1.8.0_201
ENV ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1/bin/sqlplus

COPY DB_SIB_SET_OS_COMMON_VARIABLES.sh /u01/oracle/
COPY 2_create_tablespaces.sh /u01/oracle/
COPY 3_setup_SIB.sh /u01/oracle/
COPY apache-jmeter-5.0 /u01/jmeter/
COPY JmeterScenario /u01/jmeter/JmeterScenario
COPY jdk-8u201-linux-x64.tar.gz /u01/java/
COPY Environment /Environment
COPY _util /_util
USER root
RUN chmod a+xr /u01/java/
RUN chmod 777 /_util

RUN echo 'export ORACLE_HOME=u01/app/oracle/product/12.2.0/dbhome_1/bin/sqlplus' >> etc/bash.bashrc
RUN echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc

RUN u01/oracle/1_initialise_SIB.sh 2>&1 | tee /tmp/1_initialise_SIB.log
RUN u01/oracle/2_create_tablespaces.sh 2>&1 | tee /tmp/2_create_tablespaces.log
RUN u01/oracle/3_setup_SIB.sh 2>&1 | tee /tmp/3_setup_SIB.log
USER root
RUN chmod a+xr /u01/java/
RUN chmod 777 /_util
RUN tar xzf /u01/java/jdk-8u201-linux-x64.tar.gz

#RUN u01/jmeter/bin/jmeter -n -t u01/jmeter/JmeterScenario/Load_CSBroadcasts_FR.jmx

the error is always :
sh: sqlplus: command not found

1 个答案:

答案 0 :(得分:0)

假设registry-innersource.soprasteria.com/sib/docker/db-oracle-12.2.0.1映像中的Oracle安装已完成并且路径正确,则Oracle环境变量将为:

ENV ORACLE_BASE=/u01/app/oracle
ENV ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
ENV PATH=$PATH:/u01/app/oracle/product/12.2.0/dbhome_1/bin
ENV TNS_ADMIN=/u01/app/oracle/product/12.2.0/dbhome_1/network/admin

评论Dockerfile可能是:

FROM registry-innersource.soprasteria.com/sib/docker/db-oracle-12.2.0.1

ENV ORACLE_BASE=/u01/app/oracle
ENV ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
ENV TNS_ADMIN=/u01/app/oracle/product/12.2.0/dbhome_1/network/admin
ENV PATH=$PATH:/u01/app/oracle/product/12.2.0/dbhome_1/bin

RUN echo 'export ORACLE_BASE=/u01/app/oracle' >> /etc/bash.bashrc
RUN echo 'export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1' >> /etc/bash.bashrc
RUN echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /etc/bash.bashrc
RUN echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc

# Set Environment Variables
ENV SYS_USER SYS
ENV SYS_PASSW password
ENV JAVA_HOME /jdk1.8.0_201

COPY DB_SIB_SET_OS_COMMON_VARIABLES.sh /u01/oracle/
COPY 2_create_tablespaces.sh /u01/oracle/
COPY 3_setup_SIB.sh /u01/oracle/
COPY apache-jmeter-5.0 /u01/jmeter/
COPY JmeterScenario /u01/jmeter/JmeterScenario
COPY jdk-8u201-linux-x64.tar.gz /u01/java/
COPY Environment /Environment
COPY _util /_util
USER root
RUN chmod a+xr /u01/java/
RUN chmod 777 /_util

RUN /u01/oracle/1_initialise_SIB.sh 2>&1 | tee /tmp/1_initialise_SIB.log
RUN /u01/oracle/2_create_tablespaces.sh 2>&1 | tee /tmp/2_create_tablespaces.log
RUN /u01/oracle/3_setup_SIB.sh 2>&1 | tee /tmp/3_setup_SIB.log
USER root
RUN chmod a+xr /u01/java/
RUN chmod 777 /_util
RUN tar xzf /u01/java/jdk-8u201-linux-x64.tar.gz

注意:删除了重复的RUN附加到/etc/bash.bashrc的内容。另外,无法找到sqlplus命令是配置错误,需要了解Oracle数据库/操作系统配置,而不是docker才能知道(该错误不是docker所特有的)。