oracle / docker-images

Official source of container configurations, images, and examples for Oracle products and projects
https://developer.oracle.com/use-cases/#containers
Universal Permissive License v1.0
6.57k stars 5.43k forks source link

Failed to run oracle 11g-xe in docker container #891

Closed ghost closed 6 years ago

ghost commented 6 years ago

I use this oracle office link to create an oracle/database:11.2.0.2-xe database. https://github.com/oracle/docker-images/blob/master/OracleDatabase/SingleInstance/README.md I can create it successfully.

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
oracle/database     11.2.0.2-xe         2d4c4539e33f        28 minutes ago      1.13GB
rhel-long-running   latest              ca6cbe97a281        9 hours ago         460MB
oraclelinux         7-slim              c94cc930790a        6 weeks ago         117MB
centos              latest              e934aafc2206        8 weeks ago         199MB
rhel                latest              46f00a852698        8 months ago        460MB

But when I run this database using this cmd: docker run --name oracle-11-xe --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=password oracle/database:11.2.0.2-xe

I got some issues here:

ORACLE PASSWORD FOR SYS AND SYSTEM: password

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

SQL*Plus: Release 11.2.0.2.0 Production on Mon Jun 4 11:30:15 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> 
PL/SQL procedure successfully completed.

SQL> SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
System altered.

SQL> 
System altered.

SQL> 
System altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> SQL> 
System altered.

SQL> Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
  Current log# 5 seq# 4 mem# 0: /u01/app/oracle/oradata/XE/redo05.log
      ALTER DATABASE DROP LOGFILE GROUP 1
Deleted Oracle managed file /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_1_fkb8o2dv_.log
Completed:       ALTER DATABASE DROP LOGFILE GROUP 1
      ALTER DATABASE DROP LOGFILE GROUP 2
Deleted Oracle managed file /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_2_fkb8o2nr_.log
Completed:       ALTER DATABASE DROP LOGFILE GROUP 2
Cleared LOG_ARCHIVE_DEST_1 parameter default value
Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0/xe/dbs/arch
ALTER SYSTEM SET db_recovery_file_dest='' SCOPE=BOTH;
Mon Jun 04 11:35:12 2018
Starting background process SMCO
Mon Jun 04 11:35:12 2018
SMCO started with pid=27, OS id=929 
Mon Jun 04 11:39:58 2018
VKTM detected a time drift. Please check trace file for more details.

The docker logs shows the same error:

ORACLE PASSWORD FOR SYS AND SYSTEM: password

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

SQL*Plus: Release 11.2.0.2.0 Production on Mon Jun 4 11:30:15 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> 
PL/SQL procedure successfully completed.

SQL> SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
System altered.

SQL> 
System altered.

SQL> 
System altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> SQL> 
System altered.

SQL> Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
  Current log# 5 seq# 4 mem# 0: /u01/app/oracle/oradata/XE/redo05.log
      ALTER DATABASE DROP LOGFILE GROUP 1
Deleted Oracle managed file /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_1_fkb8o2dv_.log
Completed:       ALTER DATABASE DROP LOGFILE GROUP 1
      ALTER DATABASE DROP LOGFILE GROUP 2
Deleted Oracle managed file /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_2_fkb8o2nr_.log
Completed:       ALTER DATABASE DROP LOGFILE GROUP 2
Cleared LOG_ARCHIVE_DEST_1 parameter default value
Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0/xe/dbs/arch
ALTER SYSTEM SET db_recovery_file_dest='' SCOPE=BOTH;
Mon Jun 04 11:35:12 2018
Starting background process SMCO
Mon Jun 04 11:35:12 2018
SMCO started with pid=27, OS id=929 
Mon Jun 04 11:39:58 2018
VKTM detected a time drift. Please check trace file for more details.

Could anyone give me some help? Thanks

priemd commented 6 years ago

Same issue here. Everything works fine on the the initial 'up', however after a restart I'm experiencing the same exact problem you've detailed above.

gvenzl commented 6 years ago

Sorry but what is the actual problem here? The database is up and running and ready for you to use.

doonto commented 6 years ago

Hi,

Could my issue be related to this... The same, build is ok, but when I run the container I get this:

# docker run --name 11.2.0.2-xe --shm-size=1g -p 1521:1521 -p 8080:8080 -p 5500:5500 -e ORACLE_SID=ORCL -e ORACLE_PWD=master_user oracle/database:11.2.0.2-xe

ORACLE PASSWORD FOR SYS AND SYSTEM: master_user

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press <Enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 18 18:25:28 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> BEGIN DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); END;

*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> SQL>       ALTER DATABASE ADD LOGFILE GROUP 4 ('/u01/app/oracle/oradata/ORCL/redo04.log') SIZE 50m
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER DATABASE ADD LOGFILE GROUP 5 ('/u01/app/oracle/oradata/ORCL/redo05.log') SIZE 50m
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER DATABASE ADD LOGFILE GROUP 6 ('/u01/app/oracle/oradata/ORCL/redo06.log') SIZE 50m
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER SYSTEM SWITCH LOGFILE
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER SYSTEM SWITCH LOGFILE
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER SYSTEM CHECKPOINT
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER DATABASE DROP LOGFILE GROUP 1
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL>       ALTER DATABASE DROP LOGFILE GROUP 2
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> SQL>       ALTER SYSTEM SET db_recovery_file_dest=''
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> Disconnected
mv: cannot stat '/u01/app/oracle/product/11.2.0/xe/dbs/spfileORCL.ora': No such file or directory
mv: cannot stat '/u01/app/oracle/product/11.2.0/xe/dbs/orapwORCL': No such file or directory
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
QMNC started with pid=24, OS id=663
Completed: ALTER DATABASE OPEN
Tue Sep 18 18:25:26 2018
db_recovery_file_dest_size of 10240 MB is 0.98% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Starting background process CJQ0
Tue Sep 18 18:25:26 2018
CJQ0 started with pid=25, OS id=677

If I connect via ssh to a container: docker container run --rm -it container_name sh

and try what I can google on this error: set oracle_sid=DATABASE NAME sqlplus /nolog conn sys/sys as sysdba shutdown abort startup

I get: SQL> conn sys/sys as sysdba ERROR: ORA-12547: TNS:lost contact

I don't use the buildDockerImage.sh, because my host os is win, I build the container using a command from there and slightly modified Dokerfile docker build --force-rm=true --no-cache=true --shm-size=1G -t oracle/database:11.2.0.2-xe -f Dockerfile .

In the Dockerfile I changed these lines: ORACLE_SID=ORCL \ .... RUN chmod -R a=rwX $ORACLE_BASE/ && \

btw:

Server Version: 18.09.0-ce-beta1
Storage Driver: overlay2
doonto commented 6 years ago

I found the issue #307 and increased the docker memory to 6gbб then to 10gb with pruning all the containers, images, volumes, but the result is still the same.

doonto commented 6 years ago

@gvenzl I would really appreciate any suggestions...

just made docker container (image, volume) prune, cleaned the images and took the docker info:

# docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 1 Server Version: 18.09.0-ce-beta1 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e runc version: 69663f0bd4b60df09991c08812a60108003fa340 init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 4.9.125-linuxkit Operating System: Docker for Windows OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 9.726GiB Name: linuxkit-00155d2c590c ID: BWU5:WBOT:L37D:34LJ:AABI:EGB6:CDFA:NRQ3:SQM6:GQT5:UX4D:EQEY Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 22 Goroutines: 46 System Time: 2018-09-25T15:00:52.1465567Z EventsListeners: 1 Registry: https://index.docker.io/v1/ Labels: Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine

ghost commented 6 years ago

No longer a problem. So close this. Thanks your investigations.

astrolemonade commented 4 years ago

How was this solved @guawazi-glitch ?? I am experiencing the same errors