Monday, June 2, 2014

OEL 6.3 and Oracle11gR2: Memory



OEL 6.3 and Oracle11gR2: Memory


Recently I had to mount six instances on a Linux host.  Everything was fine until I started the fourth instance:
ORA-00845: MEMORY_TARGET not supported on this system
The alert.log file had the following information:
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 1073741824 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 899670016 and used is 2236674048 bytes. Ensure that the mount point is /dev/shm for this directory.

Obliviously the solution is mount a temporary file system with a larger size:
[root@nova Desktop]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_nova-lv_root
                       50G  3.7G   44G   8% /
tmpfs                 2.0G  1.4G  646M  68% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg_nova-lv_u01
                      439G  208G  210G  50% /u01
[root@nova Desktop]# mount -t tmpfs shmfs -o size=12g /dev/shm
[root@nova Desktop]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_nova-lv_root
                       50G  3.7G   44G   8% /
tmpfs                  12G     0   12G   0% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/mapper/vg_nova-lv_u01
                      439G  208G  210G  50% /u01
shmfs                  12G     0   12G   0% /dev/shm
[root@nova Desktop]#
The shared memory file system should be big enough to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values, or Oracle will throw the ORA-00845 error.  By default, a tmpfs partition has its maximum size set to half of the total RAM. Note that the actual memory/swap consumption depends on how much is it filled up, as tmpfs partitions do not consume any memory until it is actually needed.
When changing something with the mount command, the changes are not permanent.  To make the change persistent, the /etc/fstab file must be edited to include the option:
[root@oracle-em ~]# cat /etc/fstab
[..]
tmpfs            /dev/shm         tmpfs   defaults,size=12g        0 0
Note 1:  There is a registered bug on Redhat and OEL that prevents the new size to be loaded from the fstab file (https://bugzilla.redhat.com/show_bug.cgi?id=669700), its solved installing the package mentioned on that link. The Update detail for the bug 669700 is:
“Prior to this update, the /dev/shm file system was mounted by the dracut utility without attributes from the /etc/fstab file. To fix this bug, /dev/shm is now remounted by the rc.sysinit script. As a result, /dev/shm now contains the attributes from /etc/fstab.”
One workaround suggested that could be used instead of the update package is add the following line in the script /etc/rc.d/rc.local:
mount -o remount /dev/shm
Workaround Note 2:  The mount command should not have the size option added or it will show an error:
[root@nova rc.d]# mount -o remount,size=6GB /dev/shm
mount: /dev/shm not mounted already, or bad option

No comments:

Post a Comment

  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...