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

Miss understanding of procedure to set up a persistent database. #155

Closed
loan-mgt opened this issue Oct 31, 2022 · 7 comments
Closed

Miss understanding of procedure to set up a persistent database. #155

loan-mgt opened this issue Oct 31, 2022 · 7 comments

Comments

@loan-mgt
Copy link

Hi, I've been amazed by the quality and ease of use of the docker’s image.

I am testing out the persistent database, but i didn't manage to make it work. I’ve created the following folder /opt/oracle/oradata but when the container is created with this command docker run -d -p 1521:1521 --name DB2 -e ORACLE_PASSWORD=123 -v oracle-volume:/opt/oracle/oradata gvenzl/oracle-xe:21.3.0 nothing appears in the folder. I’ve tried adding tables to the database and deleting the container and rebuilding one but the tables were not conserved.

What am i doing wrong?

@mprins
Copy link

mprins commented Oct 31, 2022

if you want to use a directory /opt/oracle/oradata on your docker host to map to /opt/oracle/oradata in the container you have to use a bind mount and not a named volume

read https://docs.docker.com/storage/volumes/

@loan-mgt
Copy link
Author

Thanks perfect,
For anyone looking for some detail, your docker volume are save a the following path /var/lib/docker/volumes/

the argument -v <volume name>:<container trajet path>
will create the volume if not existent and will mount to the target container path.
exemple -v oracle-volume:/opt/oracle/oradata
in this case if the volume does not exist it will create it and save the database there. If it exists it will directly read from it and run the database from it.

for more information follow the link from @mprins https://docs.docker.com/storage/volumes/

@codrutpopescu
Copy link

For me bind volume doesn't work. It might be because I'm on macOS M1 and I'm using colima. If anyone knows how to fix this please let me know. Hopefully Oracle will release the rumoured aarch64 Oracle DB soon.

brew install colima
brew install docker
brew install docker-compose
brew reinstall qemu

colima start --arch x86_64 --memory 4
colima list
mkdir -p /Users/codrut/oradata

docker run -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle2022! -v /Users/codrut/oradata:/opt/oracle/oradata --name oraxe gvenzl/oracle-xe

docker logs -f oraxe
CONTAINER: starting up...
CONTAINER: first database startup, initializing...
CONTAINER: uncompressing database data files, please wait...
CONTAINER: done uncompressing database data files, duration: 215 seconds.
mv: failed to preserve ownership for '/opt/oracle/oradata/dbconfig/XE/spfileXE.ora': Permission denied
mv: failed to preserve ownership for '/opt/oracle/oradata/dbconfig/XE/orapwXE': Permission denied
mv: failed to preserve ownership for '/opt/oracle/oradata/dbconfig/XE/listener.ora': Permission denied
mv: failed to preserve ownership for '/opt/oracle/oradata/dbconfig/XE/tnsnames.ora': Permission denied
mv: failed to preserve ownership for '/opt/oracle/oradata/dbconfig/XE/sqlnet.ora': Permission denied
CONTAINER: starting up Oracle Database...

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 31-OCT-2022 21:18:36

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Starting /opt/oracle/product/21c/dbhomeXE/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 21.0.0.0.0 - Production
System parameter file is /opt/oracle/homes/OraDBHome21cXE/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/af3c2e91a965/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date                31-OCT-2022 21:18:36
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /opt/oracle/homes/OraDBHome21cXE/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/af3c2e91a965/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
ORACLE instance started.

Total System Global Area 1241512272 bytes
Fixed Size		    9685328 bytes
Variable Size		  570425344 bytes
Database Buffers	  654311424 bytes
Redo Buffers		    7090176 bytes
Database mounted.
Database opened.

CONTAINER: Resetting SYS and SYSTEM passwords.
   ALTER USER SYS    IDENTIFIED BY "Oracle2022!"
*
ERROR at line 1:
ORA-01990: error opening password file ''

@lvitaly
Copy link

lvitaly commented Nov 5, 2022

@altitudedashboard, unfortunately, I faced the same issue on my apple m1. Did you find a solution?

@lvitaly
Copy link

lvitaly commented Nov 7, 2022

looks like the same issue abiosoft/colima#54

@codrutpopescu
Copy link

thanks! I'll give it a try

@codrutpopescu
Copy link

Doesn't work for me:

mkdir ~/oraxe
docker run -d -p 1521:1521 -e ORACLE_PASSWORD=Oracle2022! -v /Users/codrut/oraxe:/opt/oracle --name oraxe gvenzl/oracle-xe
Unable to find image 'gvenzl/oracle-xe:latest' locally
latest: Pulling from gvenzl/oracle-xe
59e0972d3a0b: Pull complete 
b374bb1192d1: Pull complete 
Digest: sha256:874785df54bbfa78bd6315b1affae5a16d496d43e9a9a35539f0915105475062
Status: Downloaded newer image for gvenzl/oracle-xe:latest
1a0d4a360f524b99ffc3d0a18816fd926ebe77d389d1871bb63e2acde931c0ce
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "container-entrypoint.sh": executable file not found in $PATH: unknown.

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

4 participants