docker-oracle-xe-11g icon indicating copy to clipboard operation
docker-oracle-xe-11g copied to clipboard

Persisting Data with Volumes

Open mjdavies opened this issue 6 years ago • 9 comments

HI Everyone

I'm on mac, docker versions are

Server: Docker Engine - Community Engine: Version: 18.09.2

Client: Docker Engine - Community Version: 18.09.2

I've tried what seems to be every conceivable way of persisting data, using -v, or --mount, but nothing seems to be working. I think I must be getting the path to where the data exists inside the container wrong or something.

Is persisting data possible with my versions above and this image? I've got a saved image prior to the image being pulled from docker hub, which was very sad btw, not your fault I know. :-(

Thanks for any tips or suggestions.

mjdavies avatar Feb 25 '19 15:02 mjdavies

Bit more information

Whenever I try to use --mount, when I exec into the container I can't access the database, constantly says it's shutting down or starting up

ORA-01033: ORACLE initialization or shutdown in progress

Here's the alert log

Enter user-name: root@d1956113a860:/# cat /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log: line 1: Tue: command not found /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log: line 2: syntax error near unexpected token (' /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log: line 2: Starting ORACLE instance (normal)'

Whenever I try to use the -v option, it will work first time, so I import some data, stop and remove the container, run it again mapping to the volume, and then I see similar errors, and the database always either shutting down or starting up making it unusable.

mjdavies avatar Feb 25 '19 15:02 mjdavies

I've now tried this within a docker-compose context

version: '2'
services:
  oracle-db:
    build:
      context: .
      dockerfile: oracle.Dockerfile
    container_name: oracle-db
    environment:
      - ORACLE_ALLOW_REMOTE=true
    volumes:
      - oracle:/u01/app/oracle/oradata/XE/
    ports:
      - 49161:1521
volumes:
  oracle:

docker-compose up works beautifully, and I docker exec into the container, and import some data with imp.

Then I run docker-compose down, and docker-compose up again, and this error pops up in the output from the compose command

oracle-db    | Starting Oracle Net Listener.
oracle-db    | Starting Oracle Database 11g Express Edition instance.
oracle-db    |
oracle-db    | ERROR:
oracle-db    | ORA-01033: ORACLE initialization or shutdown in progress
oracle-db    | Process ID: 0
oracle-db    | Session ID: 0 Serial number: 0
oracle-db    |
oracle-db    |
oracle-db    | SP2-0306: Invalid option.
oracle-db    | Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
oracle-db    | where <logon> ::= <username>[/<password>][@<connect_identifier>]
oracle-db    |       <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
oracle-db    | /usr/sbin/startup.sh: ignoring /docker-entrypoint-initdb.d/*

mjdavies avatar Feb 26 '19 11:02 mjdavies

I've run into the same problem - adding a mounted volume over the oradata directory works first time but then after a restart Oracle won't start properly - any ideas @wnameless ?

bjpirt avatar Mar 26 '19 09:03 bjpirt

Hi everyone i found a fix for this problem. Instead of setting the volume path to /u01/app/oracle/XE/oradata set it to /u01/app/oracle and will work. That solutions works for me.

NicolasCailotto avatar Sep 11 '19 12:09 NicolasCailotto

Hi everyone i found a fix for this problem. Instead of setting the volume path to /u01/app/oracle/XE/oradata set it to /u01/app/oracle and will work. That solutions works for me.

It works for me as well. Thanks!!

lda2000 avatar Dec 16 '19 17:12 lda2000

Hi everyone i found a fix for this problem. Instead of setting the volume path to /u01/app/oracle/XE/oradata set it to /u01/app/oracle and will work. That solutions works for me.

It works for me as well. Thanks!!

koryovip avatar May 23 '20 03:05 koryovip

how did you get this to work exactly? Im struggling. would rather data not stored in the container.

VanadiumJade avatar Jan 13 '21 03:01 VanadiumJade

Hi, This is the command I wrote:

docker run -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true -v oracle:/u01/app/oracle wnameless/oracle-xe-11g-r2

lda2000 avatar Jan 13 '21 10:01 lda2000