Subscribe YouTube Channel For More Live Tutorials

We face error with memory_target needs larger /dev/shm while Oracle Database upgrades

The memory_target parameter in databases like Oracle relies on the available shared memory in /dev/shm. If your /dev/shm size is too small, increasing it should resolve the error. Here’s how you can expand /dev/shm:

Using command df -h find the current size of the /dev/shm

Error Found as follows :

Error :

2024-11-13T06:07:43.797805+05:30 WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 1207959552 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 893349888 and used is 0 bytes. Ensure that the mount point is /dev/shm for this directory. 2024-11-13T06:07:43.841377+05:30 memory_target needs larger /dev/shm

Here the Recommended Size is 1.125GB(1207959552 bytes) and Current Size is 832MB

What is /dev/shm in Oracle?

It is an in-memory mounted file system (tmpfs) and is very fast, but non-persistent when Linux is rebooted. Shared memory ( /dev/shm ) allows Linux programs to efficiently pass data between each other.Writing to /dev/shm reduces the memory available to the OS and may cause compute node to go Out Of Memory (OOM), which will kill your processes and interrupt your job and/or crash the compute node itself.

The cause of this error is an insufficient /dev/shm allocation.  The total memory size of the SGA and PGA, which sets the initialization parameter MEMORY_TARGET or MEMORY_MAX_TARGET, cannot be greater than the shared memory file system (/dev/shm) on your operating system.

Steps to fix memory_target needs larger /dev/shm

Verify /etc/fstab entry with /dev/shm . If no entry add it manually using vi editor

Remount /dev/shm: After updating /etc/fstab, remount /dev/shm to apply the new size:

#mount -o remount /dev/shm

Verify the New Size: Run the df -h /dev/shm command again to confirm the size has increased.

Restart Database: If /dev/shm was increased while the database was running, restart the database for changes to take effect.

This should set and persist the new size for /dev/shm across reboots.

Using Docker to fix

If you are inside a Docker container, you can increase /dev/shm size by passing ‘–shm-size=2.00gb’ to ‘docker run’ (or add it to the run_options list in a Ray cluster config). Make sure to set this to more than 30% of available RAM.