oracle/docker-images

Commit to image and restart of container provokes "ORA-01034: ORACLE not available"

Closed this issue · 6 comments

I followed instructions at https://github.com/oracle/docker-images/blob/master/OracleDatabase/README.md to build and run a container with Oracle 12.1.0.2 SE 2:

docker run --name oracle-12.1.0.2-se2 \
-p 41521:1521 -p 45500:5500 \
-e ORACLE_SID=ORCL \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_CHARACTERSET=AL32UTF8 \
oracle/database:12.1.0.2-se2

The database containerized in oracle-12.1.0.2-se2 works as expected.

Afterwards I did some project specific administration/configuration and bootstrapping (e.g. creation of users, tablespaces, etc.) on the database and wanted to persist those changes into a ready-to-use custom base image:

docker stop oracle-12.1.0.2-se2
docker commit oracle-12.1.0.2-se2 myproject/oracle-12.1.0.2-se2

I'm able to successfully restart and use container oracle-12.1.0.2-se2 without any problems but when I try to run a container from the new image myproject/oracle-12.1.0.2-se2 (which should have the same content as container oracle-12.1.0.2-se2) I get the following errors and the database startup is aborted:

$ docker run --name myproject-oracle -p 41521:1521 -p 45500:5500 myproject/oracle-12.1.0.2-se2
ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: XXX

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-FEB-2017 08:05:05

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

Starting /opt/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/0557caf65570/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                08-FEB-2017 08:05:09
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/0557caf65570/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCL.log" for further details.

Unique database identifier check passed.

/opt/oracle/oradata/ has enough space. Required space is 7665 MB , available space is 41760 MB.
/ has enough space. Required space is 0 MB , available space is 41760 MB.
File Validations Successful.
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 2%
DBCA_PROGRESS : 27%
Creating and starting Oracle instance
DBCA_PROGRESS : 29%
DBCA_PROGRESS : 32%
DBCA_PROGRESS : 33%
DBCA_PROGRESS : 34%
DBCA_PROGRESS : 38%
DBCA_PROGRESS : 42%
DBCA_PROGRESS : 43%
DBCA_PROGRESS : 45%
Completing Database Creation
DBCA_PROGRESS : 48%
DBCA_PROGRESS : 51%
DBCA_PROGRESS : 53%
DBCA_PROGRESS : 62%
DBCA_PROGRESS : 64%
DBCA_PROGRESS : 72%
Creating Pluggable Databases
DBCA_PROGRESS : 78%
DBCA_PROGRESS : 100%
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ORCL.
Database Information:
Global Database Name:ORCL
System Identifier(SID):ORCL

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 8 08:06:00 2017

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

Connected to an idle instance.

SQL>    ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCL/control01.ctl' scope=spfile
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL>    ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL> Disconnected
mv: cannot stat '/opt/oracle/product/12.1.0.2/dbhome_1/dbs/spfileORCL.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/12.1.0.2/dbhome_1/dbs/orapwORCL': No such file or directory
#########################
DATABASE IS READY TO USE!
#########################
DBRM seeing time stalls or reversals; scheduling suspended.
DBRM no longer seeing time stalls or reversals; scheduling resumed.
Wed Feb 08 07:50:56 2017
DBRM seeing time stalls or reversals; scheduling suspended.
Wed Feb 08 07:51:11 2017
DBRM no longer seeing time stalls or reversals; scheduling resumed.
Wed Feb 08 07:52:41 2017
Shutting down instance (immediate)
Stopping background process SMCO
Shutting down instance: further logons disabled

Environment:

  • Oracle 12.1.0.2.0 SE 2
  • Docker 1.13.0
  • Mac OS 10.12.3

Hi @akloeber
I would start with checking database creation logs and database alert log.
It seems that your database was not created correctly.
Here /opt/oracle/cfgtoollogs/dbca/ORCL. something is missing. This should looks like: /opt/oracle/cfgtoollogs/dbca/ORCL/ORCL.log

@akloeber, did you follow the instructions provided in OracleDatabase/samples/prebuiltdb? You will have to comment the VOLUME instruction in order to create your own prebuilt image, otherwise the files will end up in a data volume which won't be accessible anymore after restart.

@gvenzl Thanks a lot! Removing the VOLUME command solved the issue.

@gvenzl Thanks a lot! Removing the VOLUME command solved the issue.

@akloeber Sorry for waking up an old ghost but where did you find the VOLUME command to remove?

@gullij In my case I removed the VOLUME command from OracleDatabase/SingleInstance/dockerfiles/12.2.0.1/Dockerfile