Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persisting Data with Volumes #119

Open
mjdavies opened this issue Feb 25, 2019 · 9 comments
Open

Persisting Data with Volumes #119

mjdavies opened this issue Feb 25, 2019 · 9 comments

Comments

@mjdavies
Copy link

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
Copy link
Author

mjdavies commented Feb 25, 2019

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
Copy link
Author

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/*

@bjpirt
Copy link

bjpirt commented Mar 26, 2019

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 ?

@NicolasCailotto
Copy link

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.

@lda2000
Copy link

lda2000 commented Dec 16, 2019

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!!

1 similar comment
@koryovip
Copy link

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!!

@VanadiumJade
Copy link

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

@lda2000
Copy link

lda2000 commented Jan 13, 2021

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

@kennychennetman
Copy link

Hi, is there anyone fix this issue? I'd just like to share a work around using k8s environment:

  1. create a pvc and define a mount point for a temporary folder (e.g. /tmp/app) in the yaml at the first running
  2. apply the yaml and finish your setups, for example creating DB, tables and account, etc.
  3. execute inside the pod to copy the entire directory of /u01/app/oracle to /tmp/app/oracle with archive mode: cp -a /u01/app/oracle /tmp/app
  4. delete the pod using kubectl delete -f file.yaml
  5. modify the yaml to change the mount point back to /u01/app, and apply it again

okay, now will be the tricky part:

  1. check the logs of the server pod to find the line 'Starting Oracle Net Listener' straight after a Stopping, ignore all the ERRORs
  2. if not found, then delete the pod directly using 'kubectl delete pod' command (not via -f file.yaml), and check the log again. (note: the pod name may varied if the pod is handled by a deployment)
  • repeat these two steps till to find the Starting line exists

I know this is not a proper way to solve this issue, just a work around as I mentioned. I really keen to hear a final solution from you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants