I am creating a 12c database using sudo docker run -m 4g --name ora12cr1_container -p 1521:1521 -p 5500:5500 -e ORACLE_SID=ora12cr1 -e ORACLE_PDB=pdb1 -v /opt/oracle/oradata oracle/database:12.1.0.2-ee, but it is failing with ORA-04031:
Creating and starting Oracle instance
DBCA_PROGRESS : 29%
DBCA_PROGRESS : 32%
DBCA_PROGRESS : 33%
DBCA_PROGRESS : 34%
DBCA_PROGRESS : 38%
DBCA_PROGRESS : 42%
ORA-04031: unable to allocate 1015832 bytes of shared memory ("shared pool","unknown object","PDB Dynamic He","Alloc/Free SWRF Metric CHBs")
Error while executing "/opt/oracle/product/12.1.0.2/dbhome_1/rdbms/admin/dbmssml.sql". Refer to "/opt/oracle/cfgtoollogs/dbca/ora12cr1/dbmssml0.log" for more details. Error in Process: /opt/oracle/product/12.1.0.2/dbhome_1/perl/bin/perl
DBCA_PROGRESS : DBCA Operation failed.
SQL*Plus: Release 12.1.0.2.0 Production on Mon Oct 17 05:53:50 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> ALTER SYSTEM SET control_files='/opt/oracle/oradata/ora12cr1/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 pdb1 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/spfileora12cr1.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/12.1.0.2/dbhome_1/dbs/orapwora12cr1': No such file or directory
#########################
DATABASE IS READY TO USE!
#########################
I am on Mac.
It looks like the container ran out of memory, @xiaohel. Note that -m only sets the limit for the container, not the minimum. Can you run the following on your Mac when you received that error: memory_pressure
Hi @gvenzl , my system still had a large percentage of memory when the error occurred. The following is the output from memory_pressure:
memory_pressure
The system has 2147483648 (524288 pages with a page size of 4096).
Stats:
Pages free: 983687
Pages purgeable: 29019
Pages purged: 472618
Swap I/O:
Swapins: 860825
Swapouts: 874734
Page Q counts:
Pages active: 1140079
Pages inactive: 696579
Pages speculative: 642505
Pages throttled: 0
Pages wired down: 530900
Compressor Stats:
Pages used by compressor: 197814
Pages decompressed: 681709
Pages compressed: 1285912
File I/O:
Pageins: 30811031
Pageouts: 61654
System-wide memory free percentage: 82%
Anything else I can do to find the reason ?
If this is on a Mac, then showing memory_pressure might not show how much memory is being assigned to the hidden VM that's running Docker itself on the Mac. I haven't looked very deeply into it, but I imagine that VM is possibly running out of memory.
@Djelibeybi Yes, I changed the memory of VM from 2G to 8G(maybe a certain number larger then 2G is enough), it is working like a charm now.
@xiaohel, the database needs 2GB by itself. So 3GB should be enough, in case you want to save some memory.
@Djelibeybi, is there an easy way to figure out inside the conatiner how much memory the container has?
@Djelibeybi, is there an easy way to figure out inside the conatiner how much memory the container has?
Yes. cat /sys/fs/cgroup/memory/memory.limit_in_bytes will show you how much memory the container "sees", i.e. either the host memory or the limited memory provided to the container at runtime.
This requires Docker 1.8 or higher.
Ran into the same problem with Docker on Windows - increasing the memory to 3GB did the trick as recommended by @gvenzl
From the Windows task bar icons, find the Docker icon, right click it, choose 'Settings'. When the 'Settings' window pops up, click 'Advanced' and set memory to 3072 MB.
Most helpful comment
Ran into the same problem with Docker on Windows - increasing the memory to 3GB did the trick as recommended by @gvenzl
From the Windows task bar icons, find the Docker icon, right click it, choose 'Settings'. When the 'Settings' window pops up, click 'Advanced' and set memory to 3072 MB.