在 docker 卷中为 Oracle 数据库持久化数据

tyo*_*mka 11 persistence volume oracle11g docker

我创建了用于存储我的应用程序数据库数据的卷 - docker volume create dbvolume.

然后我使用 Oracle XE 11g 数据库映像和数据量启动了我的 docker 容器。

docker run --name=OracleXE --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=weblogic1 -v dbvolume:/opt/oracle/oradata oracle/database:11.2.0.2-xe

在数据库中存储了一些条目。停止并删除容器,然后再次启动它,但数据库中没有数据持久化。

如何在对应用程序的后续请求中获取持久数据。

Kil*_*ian 7

来自https://github.com/oracle/docker-images/tree/master/OracleDatabase

-v /opt/oracle/oradata
              The data volume to use for the database.
              Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
              If omitted the database will not be persisted over container recreation.
Run Code Online (Sandbox Code Playgroud)

  • 是的,这似乎是正确的,只是对 Oracle 数据库版本的一项改进:对于 11g - ```-v /u01/app/oracle/oradata`` 但对于 12c - ```-v /opt/oracle/oradata`` ` (4认同)