用Docker组合初始化后,Oracle DB中的表不可见
我对Docker没有经验,并与Docker Compose
一起陷入了我的一个实验。我正在尝试旋转Oracle数据库(图像:Gvenzl/Oracle-Xe)。
我还将两个SQL脚本添加到/docker-entrypoint-initdb.d/
目录中,一个创建用户,另一个用于创建表。当我执行Docker组成
命令时,记录显示这些脚本已被拾取,并且确实创建了(第一个脚本)的用户。但是,当我使用SQLDEVEVER连接到运行容器时,我找不到任何地方。
我制作了一个自定义映像,其中使用添加
将这些文件放入正确的目录中(此处未显示,但确认它们在那里)。以下是我正在使用的文件:
docker-compose.yml (仅添加了行号,如果出现问题,请轻松参考)
1 version: "3.8"
2
3 services:
4 db-oracle-xe:
5 build: .
6 restart: on-failure
7 image: oracle-xe:latest
8 environment:
9 ORACLE_PASSWORD: some_pass
10 APP_USER: someuser
11 APP_USER_PASSWORD: some_other_pass
12 volumes:
13 - some-data:/var/docker-data/oracle
14 ports:
15 - "1521:1521"
16
17 volumes:
18 some-data:
0-create-user.sql
CREATE USER TEST;
< strong> 1-create-table.sql
1 create table TEST.SOME_TABLE
2 (
3 ID NUMBER(19) NOT NULL,
4 ADDED_DATE VARCHAR2(255 CHAR),
5 NAME VARCHAR2(255 CHAR) NOT NULL,
6 CREATED_TIME TIMESTAMP NOT NULL,
7 );
我完全陷入困境,很高兴一些反馈或有关我应采取的措施来解决此问题的建议。这可能真的很简单,我在做错什么,所以希望学习形式
I'm not experienced with Docker and got stuck on one of my experiments with docker compose
. I'm trying to spin up an Oracle database (image: gvenzl/oracle-xe).
I also add two SQL scripts to the /docker-entrypoint-initdb.d/
directory, one to create a user and another one to create a table. When I perform the docker compose up
command, the logging shows that these scripts are picked up, and a user (of the first script) is indeed created. However, I cannot find my table anywhere when I connect to the running container with SQLDeveloper.
I have made a custom image where I use ADD
to place these files into the correct directory (not shown here, but confirmed that they are there). Below are the files that I'm using:
docker-compose.yml (just added line numbers for easy reference if something is wrong)
1 version: "3.8"
2
3 services:
4 db-oracle-xe:
5 build: .
6 restart: on-failure
7 image: oracle-xe:latest
8 environment:
9 ORACLE_PASSWORD: some_pass
10 APP_USER: someuser
11 APP_USER_PASSWORD: some_other_pass
12 volumes:
13 - some-data:/var/docker-data/oracle
14 ports:
15 - "1521:1521"
16
17 volumes:
18 some-data:
0-create-user.sql
CREATE USER TEST;
1-create-table.sql
1 create table TEST.SOME_TABLE
2 (
3 ID NUMBER(19) NOT NULL,
4 ADDED_DATE VARCHAR2(255 CHAR),
5 NAME VARCHAR2(255 CHAR) NOT NULL,
6 CREATED_TIME TIMESTAMP NOT NULL,
7 );
I'm completely stuck and would appreciate some feedback or perhaps tips on what I should do to troubleshoot this issue. It might be really simple what I'm doing wrong, so hoping to learn form this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在创建表之前,您需要使用用户名和密码连接。
查看此博客以获取更多详细信息为我
You need to connect with username and password before creating tables.
check this blog for more details , it worked for me