Shared Memory Management on Oracle Solaris for Oracle Databases
Oracle Database Use Shared Memory from the Operating System for Its operations. SGA is the main memory component of an Oracle Database. The allocated SGA will only use configured Shared Memory for Oracle user. The memory requirements for Application and Database are continuously growing so the current Databases supports dynamic resizing of memory of Database Servers.
Shared Memory is an efficient means of passing data between multiple processes. One Process will create a memory area and this memory area can be access by other process If its permitted.
On Oracle Solaris kernel parameter “max-shm-memory” is configured for the sizing of your shared Memory. This parameter will allow resizing of SGA. For example, if this parameter is configured to 2GB than you cannot resize your memory_max_target parameter exceeding this size. BY default, 25% of memory will be allocated for Max Shared memory kernel parameter.
The kernel parameter “max-shm-memory” can be modified online using “prctl” utility, this feature is available from solaris-10 and later OS.
We need to set this parameter before Installing the database(pre-requisite). The size of this kernel parameter can be decided based on the number of users/transactions and the size of SGA.
Oracle Database uses three different types of Shared memory. The following are the three types of shared memory models used by an Oracle Database (OSM, DISM & ISM):
1. OSM — Optimized Shared Memory
2. DISM — Dynamic Intimate Shared Memory
3. Intimate Shared Memory
In this article we will see working of OSM and DISM.
OSM-Optimized Shared Memory:
Optimized shared memory model is Introduced from Oracle database version 12c on Oracle Solaris 10 1/13 or later and Oracle Solaris 11 SRU 7.5 or later systems to implement Automatic Memory Management.
Optimized Shared memory (OSM) allows to resize the SGA without restarting the Database Instance. OSM is NUMA optimized and it does not use “oradism” process for shared memory management. By default, OSM will be enabled if Database version is 12c and running on “ Oracle Solaris 10 1/13 or later and Oracle Solaris 11 SRU 7.5 or later”.
Benefits of Using OSM:
- Works with Oracle Database 12c Automatic Memory management
- Dynamic NUMA aware granule Bases memory
- Start up Oracle Instances 2 X Faster
- Dynamically resize SGA without rebooting Database Instances
Starting from Oracle Solaris 10 it Introduced new option for configuring Your kernel parameters using “project resources”, Configuring kernel parameters using projects is very simple and it does not require reboot of Server. Prior to Oracle Solaris 10 you have to configure all kernel parameters in “/etc/system” and for this parameters to be effective reboot is required.
Oracle recommends to use projects for configuring kernel parameters on Oracle Solaris 10 and later systems. This will allow you to resize/configure your kernel parameters online without rebooting the system.
DISM — Dynamic Intimate shared memory:
This shared memory model also provides dynamic resizing of SGA component and it is used in versions prior to 12c. DISM uses oracle process “oradism” for performing changes to the Operating system shared memory.
If DISM is not configured properly then database performance can be degraded.
How Optimized Shared Memory (OSM) actually works:
Environment: Oracle Database 12cR1 (220.127.116.11.0) on Oracle Solaris 11.2 (X86–64)
As the database version is 12c and OS version is 11.2 by default it will use OSM. If your OS version/Database version are lower than above specified then it will not use OSM, It may use DISM/ISM based on the database and OS version.
OSM will be active if we set parameter “memory_max_target” higher to parameter “memory_target”
Check process for database:
oracle@soltest2:~$ ps -ef | grep smonoracle 19432 1 0 10:59:51 ? 0:00 ora_smon_solcdb
Database “solcdb” is running.
To verify OSM is active use command “ipcs -dm”:
oracle@soltest2:~$ ipcs -dm
IPC status from <running system> as of Wednesday, December 24, 2018 11:00:31 AM AST
T ID KEY MODE OWNER GROUP ALLOC
m 83886090 0x0 — rw-r — — — oracle dba 1035890688
m 83886089 0x96d03374 — rw-r — — — oracle dba 16777216
From the above output if ALLOC column contains hyphen “-” then it means it’s not using OSM and it may use DISM/ISM bases on the database version. If ALLOC column contains an Integer value then OSM is active.
Verify the size of the SGA and Allocated shared memory:
The allocated shared memory size is same as the configured “memory_max_target” parameter.
To determine shared memory is in use:
Here ISMATCH column will specify how many process is associated with shared memory. But here it will not specify whether these process are using OSM/DISM/ISM.
Now we will try to resize the parameter “”memory_max_target”
Not allowed to change the parameter as it is exceeding the size of allocated shared memory for the user “oracle”
Change parameter using spfile:
Restart Oracle Instance:
The memory target parameter is not changed. But if we see Oracle will have allocated fixed shared memory 1200M for “memory_max_target”
Now we can resize SGA online up to 1200M.
How DISM/ISM works:
Oracle Database 11gR2 (18.104.22.168) is running on the same server with OS Oracle Solaris 11.2. As the database version is 11gR2 Oracle Solaris will not use Optimized shared memory model. By default it will use DISM.
Let’s see how does it works:
Use “ipcs -dm” command to check active shared memory model
Here “ALLOC” column contains hyphen “-” which means Optimized shared memory is not in use.
There are 43 process associated with the shared memory.
To find Shared memory is ISM/DISM:
ora_dism_<SID> process will manage the Dynamic Intimate shared memory.
Resizing SGA with DISM:
Modify it in spfile:
- Restart database and verify the memory_max_target
We cannot Increase the memory_target value more than the value of memory_max_target parameter.
Modifying Kernel parameter for shared memory online using projects:
Check configured shared memory value:
To modify shared memory value online:
You need to login using new terminal session for this parameter to be effective. It will not be effective in the same session.
Optimized shared memory option is introduced from Oracle Database 12c. Database Initialization parameter “memory_max_target” and OS kernel parameter “ max-shm-memory” should be configured appropriately. If this parameter is configured as per the future requirements, then restart DB/OS is not required for resizing your SGA.
Syed Zaheer is an Oracle ACE and currently working as a Senior Oracle Application Specialist. He has a decade of experience in the implementation and management of Oracle E-Business suite, Oracle HA Stack, Oracle Fusion Middle-ware & Oracle Databases. He has extensive experience in working with Oracle Enterprise Linux and Oracle Solaris. He is an Apress author of “Practical Oracle E-Business suite — An Implementation & management Guide”.He is an active member of Oracle technology forums and Oracle awarded him the status of “GURU” for his contributions.He is also an active member of the Toad World community. He has published many articles on OTN & Toadworld community network. He is Oracle certified in Operating Systems, Application, Databases, Engineered systems and Middle ware.
Zaheer has been part of 30+ successful E-Business suite Implementations/Upgrades/Migrations from version 11i to version R12.2.x.
He has domain knowledge in diversified business verticals including financials, FMCG,manufacturing, and consulting. He is an active blogger since 2008 and has published 100+ unique articles on his blog (http://appsdbaworkshop.com) He was a speaker multiple international Oracle conferences — MEOUG, OUGF and TROUG.