- ORA-845 is raised when Oracle kernel tries to map its SGA and /dev/shm can provide enough space
Table of Contents
Understanding SGA mapping for ASM and RAC instances on Linux using /dev/shm
Check the current memory usage for a running RAC instance # df -h Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 1.1G 923M 55% /dev/shm After ASM, and RAC instance is up we still have about 45% of free space so it looks we have a healthy system. Let's first check what is eating our /dev/shm space running an Oracle RAC database. SQL> select sum(bytes/1024/1024) Current_SGA_SIZE_in_MB from v$sgastat; CURRENT_SGA_SIZE_IN_MB ---------------------- 921.273895 Above select shows the currently allocated space for our RDBMS SGA. SQL> show SGA Total System Global Area 1570009088 bytes Fixed Size 2228704 bytes Variable Size 1207963168 bytes Database Buffers 352321536 bytes Redo Buffers 7495680 bytes --> Total System Global Area shows how much our SGA can grow. Check files created in /dev/shm directory # ls -l /dev/shm -rw-r----- 1 grid oinstall 4194304 Oct 11 16:02 ora_+ASM2_425990_0 -rw-r----- 1 oracle asmadmin 16777216 Oct 11 17:34 ora_GRACE2_3_589831_0 --> Here we can see that ASM instance uses 4Mbyte chunks whereas GRACE2 is using 16Mbyte chunks Let's calculate the space used for out ASM and RAC instance: Number of segments # ls -l /dev/shm | grep oracle | grep 16777216 | wc -l 59 --> Size : 59 * 16 Mbyte = 944 MByte --> After a shutdown of this RAC instance free space in /dev/shm should increase by ~ 900 Mbyte # df -h Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 1.1G 923M 55% /dev/shm SQL> shutdown immediate # df -h Filesystem Size Used Avail Use% Mounted on tmpfs 2.0G 200M 1.9G 10% /dev/shm --> tmpfs used space drops from 1.1G to 200 Mb - this is what we expected to see. Calculate the used space for ASM/Clusterware # ls -l /dev/shm | grep grid | grep 4194304 | wc -l 51 --> Size : 51 * 4 Mbyte = 204 MByte --> After a shutdown of ths ASM instance free space in /dev/shm should increase by ~ 200 Mbyte # $GRID_HOME/bin/crsctl stop crs # df -h tmpfs 2.0G 260K 2.0G 1% /dev/shm --> tmpfs used space drops from 200Mb to 260 Kb - this is what we expected to see. Note : As the SGA space can grow up to MEMORY target we need to calculate the following by running: SQL> show parameter memory_max_target ASM: memory_max_target 272M RDBMS: memory_max_target 1504M In above senario we need about 1.8Gb /dev/shm space. If we don't have enough /dev/shm space ORA-845 will be raised during starting the instance.
But why can cause a reduction of memory ( either using Virtalbox or reducing phys. memory ) lead to an ORA-845 ?
- On OEL 6.3 and 6.4 50% of the available memory is used for /dev/shm by default. If you reduce your memory /dev/shm space is reduced too and as a result you can see ORA-845 during instance startup. For details and how to fix this please read the following link.
References:
http://blog.oracle48.nl/oracle-11g-amm-memory_target-memory_max_target-and-dev_shm/
http://www.hhutzler.de/blog/increase_temp_space/