I can run and connect the default oracle setup like so:
docker run -d \
--name oracleXE \
-e ORACLE_ALLOW_REMOTE=true \
-e ORACLE_ENABLE_XDB=true \
-p 49161:1521 \
-p 49162:8080 \
oracleinanutshell/oracle-xe-11g
However, when I try to mount volumes to persist the data I run into problems. I have tried to mount just /u01/app/oracle/oradata (like answered here: Persisting data in docker's volume for Oracle database). But then I get some connection returned -1 error.
IO Error: Got minus one from a read call, connect lapse 1 ms., Authentication lapse 0 ms. Got minus one from a read call
And when I mount all the volumes (like asked here: Is there a better way to run oracle database with docker in a development environment?), then I get the famous listener error:
Listener refused the connection with the following error: ORA-12528, TNS:listener: all appropriate instances are blocking new connections:
# Create a folder in a known location for you
mkdir -p .data/oragle11gXE/admin
mkdir -p .data/oragle11gXE/diag
mkdir -p .data/oragle11gXE/fast_recovery_area
mkdir -p .data/oragle11gXE/oradata
docker run -d \
--name oracleXE \
-e ORACLE_ALLOW_REMOTE=true \
-e ORACLE_ENABLE_XDB=true \
-v `pwd`/.data/oragle11gXE/admin:/u01/app/oracle/admin \
-v `pwd`/.data/oragle11gXE/diag:/u01/app/oracle/diag \
-v `pwd`/.data/oragle11gXE/fast_recovery_area:/u01/app/oracle/fast_recovery_area \
-v `pwd`/.data/oragle11gXE/oradata:/u01/app/oracle/oradata \
-p 49161:1521 \
-p 49162:8080 \
oracleinanutshell/oracle-xe-11g
How am I supposed to persist data?
I have even tried to copy the entire /u01/app directory over to my local machine and mount that as a volume, but this results in the -1 IO error as well.
EDIT 1:
I have tried to copy only the XE folder to my local host and mount it using -v ${pwd}/.data/oragle11gXE:/u01/app/oracle/oradata
Then I get the error message
[08006][1033] ORA-01033: ORACLE initialization or shutdown in progress
I can login into the container start SQL plus and can see that the database is mounted and active, I can not alter it to open as the command just fails pointing to a log file which is a binary.
SQL> select status, database_status from v$instance;
STATUS DATABASE_STATUS
------------ -----------------
MOUNTED ACTIVE
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-00314: log 1 of thread 1, expected sequence# 3 doesn't match 1
ORA-00312: online log 1 thread 1:
'/u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_1_g6c5nhsl_.log'
When I mount the local path to an alternate /u01/app/oracle/oradata2
, I can not see any difference
root@b615ff50b724:/u01/app/oracle# ls -l oradata/XE
total 1182052
-rw-r----- 1 oracle dba 9748480 Apr 20 17:29 control.dbf
-rw-r----- 1 oracle dba 671096832 Apr 20 17:23 sysaux.dbf
-rw-r----- 1 oracle dba 377495552 Apr 20 17:23 system.dbf
-rw-r----- 1 oracle dba 20979712 Apr 20 17:24 temp.dbf
-rw-r----- 1 oracle dba 26222592 Apr 20 17:23 undotbs1.dbf
-rw-r----- 1 oracle dba 104865792 Apr 20 17:23 users.dbf
root@b615ff50b724:/u01/app/oracle# ls -l oradata2/XE
total 1182040
-rw-r----- 1 oracle dba 9748480 Apr 20 17:28 control.dbf
-rw-r----- 1 oracle dba 671096832 Apr 20 17:23 sysaux.dbf
-rw-r----- 1 oracle dba 377495552 Apr 20 17:23 system.dbf
-rw-r----- 1 oracle dba 20979712 Apr 20 17:24 temp.dbf
-rw-r----- 1 oracle dba 26222592 Apr 20 17:23 undotbs1.dbf
-rw-r----- 1 oracle dba 104865792 Apr 20 17:23 users.dbf
root@b615ff50b724:/u01/app/oracle# ls -l oradata2
it is delivered with a set of init db files. when you overwrite them with the mount nothing happens and you have to start from scratch. connect as sysdba define the tablespaces etc.
I saved those files by starting from scratch. then shutdown then save the oradata files into the external folder. But then you start the database in stopped state.
startup; (sys as sysdba/oracle) causes
ORA-03113: end-of-file on communication channel -- after the mount...
second startup;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
ah more info...
working on it.
its antique oracle. dont forget. they didnt know about containers. only about service contracts and licenses ;)