无法从 docker compose 执行 oracle 数据设置脚本

发布于 2025-01-09 04:19:10 字数 880 浏览 1 评论 0原文

我试图在 Oracle 容器启动并运行后设置 Oracle 数据,下面是我的撰写文件:

version: '3'
services:
  oracle:
   image: absolutapps/oracle-12c-ee
   container_name: oracle-docker
  ports:
  - 8080:8080
  - 1521:1521
  environment:
    CASSANDRA_BROADCAST_ADDRESS: 127.0.0.1
    ORACLE_ALLOW_REMOTE: "true"
  volumes:
  - ./scripts/oracle-init.sh:/oracle-init.sh

oracle-init.sh:

#!/usr/bin/env bash
echo "### SETUP EXECUTION! ###"
sqlplus -s "system/oracle@localhost:1521/orcl /scripts/init-oracle.sql"
echo "### SETUP EXECUTED! ###"

init-oracle.sql :

CREATE USER ot_consumer_tryout IDENTIFIED BY ot_consumer_tryout; 谁能帮我看看上面的片段有什么问题。我的 docker 容器开始启动,但 sql 脚本不执行,这是来自终端的日志:

oracle-docker |运行初始化脚本... 甲骨文码头工人 | /oracle.init.d/ 中的初始化脚本:忽略 /oracle.init.d/* 甲骨文码头工人 | 甲骨文码头工人 |完成脚本后我们就可以开始了

I am trying to set up oracle data once my oracle container is up and running, below is my compose file:

version: '3'
services:
  oracle:
   image: absolutapps/oracle-12c-ee
   container_name: oracle-docker
  ports:
  - 8080:8080
  - 1521:1521
  environment:
    CASSANDRA_BROADCAST_ADDRESS: 127.0.0.1
    ORACLE_ALLOW_REMOTE: "true"
  volumes:
  - ./scripts/oracle-init.sh:/oracle-init.sh

oracle-init.sh:

#!/usr/bin/env bash
echo "### SETUP EXECUTION! ###"
sqlplus -s "system/oracle@localhost:1521/orcl /scripts/init-oracle.sql"
echo "### SETUP EXECUTED! ###"

init-oracle.sql :

CREATE USER ot_consumer_tryout IDENTIFIED BY ot_consumer_tryout;
Can anyone help me what is wrong with above snippets. My docker container getting started but sql script does not execute ,here is the log from terminal:

oracle-docker | Running init scripts...
oracle-docker | Init scripts in /oracle.init.d/: Ignoring /oracle.init.d/*
oracle-docker |
oracle-docker | Done with scripts we are ready to go

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隔纱相望 2025-01-16 04:19:10

查看您创建的卷

- ./scripts/oracle-init.sh:/oracle-init.sh

这意味着在您的容器内,该文件位于“/oracle-init.sh”中,但您的
根据您的容器日志,容器可能会在不同的位置期待具有文件夹名称 oracle.init.d 的内容。

oracle-init.sh 正在尝试运行 /scripts/init-oracle.sql ,希望您的映像已经拥有它,否则您还必须将其安装在撰写文件中。

Look at the volume you created

- ./scripts/oracle-init.sh:/oracle-init.sh

which means inside your container the file is in '/oracle-init.sh' but your
container might be expecting in a different location something with folder name oracle.init.d as per your container log.

oracle-init.sh is trying to run /scripts/init-oracle.sql , hope your image already has it otherwise you will have to mount it as well in compose file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文