gpt4 book ai didi

linux - 在 docker 中找不到 sqlplus

转载 作者:太空宇宙 更新时间:2023-11-04 05:47:12 24 4
gpt4 key购买 nike

我的问题是在我的 docker oracle 数据库中找不到 sqlplus。你能帮助我吗。我总是 sh: sqlplus: 找不到命令我尝试做一个docker数据库;我是 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

最佳答案

假设 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

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

关于linux - 在 docker 中找不到 sqlplus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54443637/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com