Persisting data in docker's volume for Oracle database

10,061

Solution 1

from 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.

Solution 2

Accepted answer is not correct for Oracle 11g XE, that is asked in this question.
"/u01/app/oracle" should be mapped with a volume (e.g. -v dbvolume:/u01/app/oracle)

Share:
10,061

Related videos on Youtube

tyomka
Author by

tyomka

Updated on September 16, 2022

Comments

  • tyomka
    tyomka almost 2 years

    I created volume for storing my application database data - docker volume create dbvolume.

    Then I launched my docker container with Oracle XE 11g database image and data volume.

    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

    Stored some entries in database. Stopped and removed container then launched it again, but no data persisted in database.

    How can I get persisted data on subsequent requests to application.

  • tyomka
    tyomka over 6 years
    Yes, this seems correct, just one refinement about Oracle's database versions: for 11g - -v /u01/app/oracle/oradata but for 12c - -v /opt/oracle/oradata