Chapter 7.
15
Setting Shared Memory
Shared memory allows processes to access common structures and data by placing them in shared
memory segments. It is the fastest form of inter-process communication available since no kernel
involvement occurs when data is passed between the processes. In fact, data does not need to be
copied between the processes.
Oracle uses shared memory segments for the Shared Global Area (SGA) which is an area of
memory that is shared by Oracle processes. The size of the SGA has a significant impact to Oracle's
performance since it holds database buffer cache and much more.
To see all shared memory settings, execute:
$ ipcs -lm
7.1. Setting SHMMAX Parameter
This parameter defines the maximum size in bytes of a single shared memory segment that a Linux
process can allocate in its virtual address space. For example, if you use the Red Hat Enterprise
Linux 3
smp
kernel on a 32 bit platform (x86), then the virtual address space for a user process is
3 GB. If you use the Red Hat Enterprise Linux 3
hugemem
kernel on a 32 bit platform (x86), then
the virtual address space for a user process is almost 4GB. Hence, setting
SHMMAX
to 4GB - 1 byte
(4294967295 bytes) on a smp kernel on a 32 bit architecture will not increase the maximum size of a
shared memory segment to 4 GB -1. Even setting
SHMMAX
to 4 GB - 1 byte using the
hugemem
kernel
on a 32 bit architecture will not enable a process to get such a large shared memory segment. In fact,
the upper limit for a shared memory segment for an Oracle 10g R1 SGA using the
hugemem
kernel is
roughly 3.42 GB (~3.67 billion bytes) since virtual address space is also needed for other things like
shared libraries. This means if you have three 2 GB shared memory segments on a 32 bit system, no
process can attach to more than one shared memory segment at a time. Also note if you set
SHMMAX
to 4294967296 bytes (4*1024*1024*1024=4GB) on a 32 bit system, then
SHMMAX
will essentially
bet set to 0 bytes since it wraps around the 4GB value. This means that
SHMMAX
should not exceed
4294967295 on a 32 bit system. On x86-64 platforms,
SHMMAX
can be much larger than 4GB since the
virtual address space is not limited by 32 bits.
Since the SGA is comprised of shared memory,
SHMMAX
can potentially limit the size of the SGA.
SHMMAX
should be slightly larger than the SGA size. If
SHMMAX
is too small, you can get error
messages similar to this one:
ORA-27123: unable to attach to shared memory segment
It is highly recommended that the shared memory fits into the Big Pages or Huge Pages pool, see
Chapter 14, Large Memory Optimization, Big Pages, and Huge Pages
.
To increase the default maximum SGA size on x86 Red Hat Enterprise Linux 2.1 systems without
VLM, refer to
Chapter 15, Growing the Oracle SGA to 2.7 GB in x86 Red Hat Enterprise Linux 2.1
Without VLM
.
To increase the default maximum SGA size on x86 Red Hat Enterprise Linux 3, 4 and 5 systems
without VLM, refer to
Chapter 16, Growing the Oracle SGA to 2.7/3.42 GB in x86 Red Hat Enterprise
Linux 3, 4 and 5 Without VLM
..
To determine the maximum size of a shared memory segment, run:
Summary of Contents for CLUSTER SUITE FOR ENTERPRISE LINUX 5.1
Page 7: ...Part I Tuning and Optimizing Red Hat Enterprise Linux for Oracle Database 9i and 10g ...
Page 8: ......
Page 10: ...4 ...
Page 16: ...10 ...
Page 28: ...22 ...
Page 30: ...24 ...
Page 36: ...30 ...
Page 42: ...36 ...
Page 54: ...48 ...
Page 60: ...54 ...
Page 68: ...62 ...
Page 72: ...66 ...
Page 88: ...82 ...
Page 90: ...84 ...
Page 92: ...86 ...
Page 94: ...88 ...
Page 98: ...92 ...
Page 108: ...102 ...
Page 112: ...106 ...
Page 120: ...114 ...
Page 122: ......
Page 128: ...122 ...
Page 132: ...126 ...
Page 134: ...128 ...
Page 142: ...136 ...
Page 146: ...140 ...
Page 156: ...150 ...
Page 160: ...154 ...