Skip to content

Oracle 12c EE - ORA-04035: unable to allocate 4096 bytes of shared memory in shared object cache "JOXSHM" of size "1073741824" #223

@marcelo-ochoa

Description

@marcelo-ochoa

Using Oracle 12c EE version throws ORA-04035: unable to allocate 4096 bytes of shared memory in shared object cache "JOXSHM" of size "1073741824" due noexec flag in mount option for /dev/shm. This is caused when using the Oracle internal JVM.
According to Oracle dev team the issue is fixed re-mounting /dev/shm with exec flag so at docker run time running as root is fixed by calling:

# fix ORA-04035: unable to allocate 4096 bytes of shared memory in shared object cache "JOXSHM" of size "1073741824"
mount -o remount,exec /dev/shm

At Dockerfile.ee script the effective user is oracle, so I propose fix that using another script running as root user which call finally runOracle.sh script, for example:
Dockerfile

USER	root

VOLUME ["/opt/oracle/oradata"]
EXPOSE	1521 5500

CMD	[ "sh" , "-c" ,  "/home/oracle/manage-oracle.sh" ]

where manage-oracle.sh call sysctl command and then runOracle.sh as user oracle.

mount -o remount,exec /dev/shm

echo "export ORACLE_SID=$ORACLE_SID" >>/home/oracle/.bashrc
echo "export ORACLE_PDB=$ORACLE_PDB" >>/home/oracle/.bashrc
su - oracle -c "$ORACLE_BASE/runOracle.sh"

Also docker run command must include --shm-size=8g --privileged=true flags, for example:

#!/bin/bash
docker run -ti --rm --shm-size=8g --privileged=true --name test --hostname test \
-p 1521:1521 -p 5500:5500 -p 9099:9099 \
-e ORACLE_SID=TEST \
-e ORACLE_PDB=PDB1 \
-v /home/data/db/12cR1:/u01/app/oracle/oradata \
oracle/database:12.1.0.2-ee

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions