Skip to main content

ABOUT SHMALL, SHMMAX AND SHMMNI KERNAL PARAMETER

SHMALL => MAXIMUM SHARED MEMORY ALLOCATED THAT THE SERVER CAN USE APART FROM THE PROCESSES UNIX TO RUN.

SHMMAX => WHAT SHOULD BE THE MAXIMUM SIZE THAT EACH SHARED MEMORY CAN HAVE IN PHYSICAL RAM.

SHMMNI => This parameter sets the system-wide maximum number of shared memory segments.

using below we ca check and edit these parameters

KERNAL PARAMETERS: LOCATION:  /PROC/SYS/KERNAL

cd /prod/sys/kermal

 
:-) ls -ltr shm*

-rw-r--r-- 1 root root 0 May 15 05:46 shmmax

-rw-r--r-- 1 root root 0 May 15 09:23 shmmni

-rw-r--r-- 1 root root 0 May 15 09:23 shmall

sysctl -a | grep shm


TO CHANGE KERNAL PARAMETERS:


sysctl -w kernal.shmmax="xxxxxx"

vi /etc/sysctl.conf  => edit and save the file.

run sysctl -p command after editing the file. the changes will affect without restarting the server.


SHMMAX and SHMALL are two key shared memory parameters that directly impact the way by which Oracle creates an SGA. While trying to create an SGA during a database startup, Oracle chooses from one of the 3 memory management models a) one-segment or b) contiguous-multi segment or c) non-contiguous multi-segment. The adoption of any of these models is dependent on the size of SGA and values defined for the shared memory parameters in the Linux kernel, most importantly SHMMAX.


While trying to create an SGA during a database startup, Oracle chooses from one of the 3 memory management models a) one-segment or b) contiguous-multi segment or c) non-contiguous multi-segment. The adoption of any of these models is dependent on the size of SGA and values defined for the shared memory parameters in the Linux kernel, most importantly SHMMAX.

What’s the optimal value for SHMALL?

As SHMALL is the total size of Shared Memory Segments System-wide, it should always be less than the Physical Memory on the System and should be greater than the sum of SGA’s of all the oracle databases on the server. Once this value (sum of SGA’s) hit the limit, i.e. the value of shmall, then any attempt to start a new database (or even an existing database with a resized SGA) will result in an “out of memory” error (below). This is because there won’t be any more shared memory segments that Linux can allocate for SGA.

 
ORA-27102: out of memory

Linux-x86_64 Error: 28: No space left on device.

 
What’s the optimal value for SHMMAX?

Oracle makes use of one of the 3 memory management models to create the SGA during database startup and it does this in the following sequence. First Oracle attempts to use the one-segment model and if this fails, it proceeds with the next one which’s the contiguous multi-segment model and if that fails too, it goes with the last option which is the non-contiguous multi-segment model.

So during startup, it looks for shmmax parameter and compares it with the initialization parameter *.sga_target. If shmmax > *.sga_target, then oracle goes with a one-segment model approach where the entire SGA is created within a single shared memory segment.

But the above attempt (one-segment) fails if SGA size otherwise *.sga_target > shmmax, then Oracle proceeds with the 2nd option – contiguous multi-segment model. Contiguous allocations, as the name indicates are a set of shared memory segments that are contiguous within the memory and if it can find such a set of segments then the entire SGA is created to fit in within this set.

But if it cannot find a set of contiguous allocations then last of the 3 options is chosen – non-contiguous multi-segment allocation and in this Oracle has to grab the free memory segments fragmented between used spaces.

So let’s say if you know the max size of SGA of any database on the server stays below 1GB, you can set shmmax to 1 GB. But say if you have SGA sizes for different databases spread between 512MB to 2GB, then set shmmax to 2Gigs and so on.

Comments

Popular posts from this blog

Issues and Solutions for Oracle 19c Grid Infrastructure Installation

     Common Issues and Solutions for Oracle 19c Grid Infrastructure Installation •       Check Log Files for Details Oracle installation issues often provide valuable clues in the log files. If the installer seems stuck or fails, check the following logs: ▪ Install log : /u01/app/oraInventory/logs/installActions<date>.log •       ▪ Grid Infrastructure log : $ORACLE_BASE/cfgtoollogs/ •         •       These logs can provide error messages and help identify the exact issue. •         •        Check Permissions and Ownership Verify that the Oracle Grid Infrastructure installation directories have the correct ownership and permissions. •        For example: •        Make sure the grid user has permission to write to the directories where the i...

CHANGING DBID FOR ORACLE DATABASE 11G

C:\Users\computer>sqlplus SQL*Plus: Release 11.1.0.7.0 - Production on Thu Sep 10 21:03:33 2013 Copyright (c) 1982, 2008, Oracle.  All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select dbid from v$database;       DBID ---------- 2188161033 SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options C:\Users\computer>nid DBNEWID: Release 11.1.0.7.0 - Production on Thu Sep 10 21:04:44 2013 Copyright (c) 1982, 2007, Oracle.  All rights reserved. Keyword     Description                    (Default) ---------------------------------------------------- TARGET ...

How to Improve Oracle Data Pump Performance - IMPDP

  How to Improve Oracle Data Pump Performance:- Use Parallelism : Set the PARALLEL parameter to at least 2 * number of CPUs . This allows multiple worker processes to perform tasks simultaneously, speeding up both export and import processes. Example: PARALLEL=4 for a system with 2 CPUs. Perform Import Using NETWORK_LINK : Use the NETWORK_LINK parameter to import data directly from the source database. This method is particularly helpful when space is constrained, as it streams the data without needing to generate dump files on the source. It can also reduce time compared to exporting and then importing, as data is streamed directly from the source to the target database. Disable Archivelog Mode (Standalone Databases) : For standalone databases, temporarily disable archive logging during the import process. Import operations can generate a lot of redo logs, slowing down the import. Disabling...