Kernel.shmall和kernel.shmmax

if any of the current values are larger than the recommended value, then specify the larger value.

If the current value for any parameter is higher than the value listed in this table, then do not change the value of that parameter

如果/etc/sysctl.conf中的kernel.shmmax比推荐的值大 那么使用较大的值

[oracle@jssweb ~]$ getconf PAGE_SIZE 查看页大小

#

kernel.shmall = 2097152 则一共是8G的共享内存总量

SHMALL 单位页

Finally, we look at the SHMALL shared memory kernel parameter. This parameter controls the total amount of shared memory (in pages) that can be used at one time on the system. In short, the value

of this parameter should always be at least:
ceil(SHMMAX/PAGE_SIZE)

Kernel.shmall:共享内存总量,以页为单位。Linux 共享内存页大小为4KB, 共享内
存段的大小都是共享内存页大小的整数倍。一个共享内存段的最大大小是16G,那么需
要共享内存页数是 16GB/4KB=16777216KB/4KB=4194304 (页),也就是64Bit 系统下
16GB 物理内存,设置 kernel.shmall = 4194304 才符合要求(几乎是原来设置2097152
的两倍)。这时可以将shmmax 参数调整到 16G 了,同时可以修改SGA_MAX_SIZE 和
SGA_TARGET 为 12G(您想设置的SGA 最大大小,当然也可以是2G~14G 等,还要协调PGA
参数及OS 等其他内存使用,不能设置太满,比如16G)。

默认是kernel.shmall = 4294967296 足够大了

kernel.shmmax:Shmmax 是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值,shmmax 设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能

导致系统性能的下降,最大值为16GB(在大多数情况下,该值应该比SGA大)。

SHMMAX Available physical memory Defines the maximum allowable size
of one shared memory segment. The SHMMAX setting should be large enough
to hold the entire SGA in one shared memory segment. A low setting can
cause creation of multiple shared memory segments which may lead to
performance degradation

#

kernel.shmall:控制共享内存页数,Linux 共享内存页大小为4KB, 共享内存段的大小都是共享内存页大小的整数倍。一个共享内存段的最大大小是16G,那么需要共享内存页数是 16GB/4KB=16777216KB/4KB=4194304。

kernel.shmmax:Shmmax 是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值,shmmax 设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能

导致系统性能的下降,最大值为16GB(在大多数情况下,该值应该比SGA大)。

kernel.shmmni:共享内存段的最大数量,shmmni 缺省值 4096 ,一般肯定是够用了

kernel.shmall的单位是页。对于X86的linux系统,一页=4k,也就是4096字节。kernel.shmall = 2097152 就是 2097152*4k/1024/1024 = 8G 就是说可用共享内存一共8G。

kernel.sem(SEMMSL SEMMNS SEMOPM SEMMNI)
SEMMSL,每个信号量集中的最大信号量数,应该设置为服务器中各个实例中PROCESSES参数的和+10;

SEMMNS,系统中信号量的最大数,参数应设置为SEMMSL*SEMMNI;

SEMOPM,每个信号量调用所包含的最大操作数;

SEMMNI:系统中信号量集的最大数。

[oracle@jssweb ~]$ cat /etc/sysctl.conf | grep shm
kernel.shmall = 2097152
kernel.shmmax = 536870912

此时kernel.shmmax为512M
kernel.shmall 是8G

kernel.shmall = 2097152 则一共是8G的共享内存总量

SHMMAX

含义:单个共享内存段最大字节数
设置:比SGA略大

SHMALL

含义:系统中共享内存页总数
设置:至少ceil(shmmax/PAGE_SIZE);ORACLE DOC 默认值:2097152*4096=8GB

Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:

Note:

Include lines only for the kernel parameter values that you want to change. For the semaphore parameters (kernel.sem), you must specify all four values. However, if any of the current values are

larger than the minimum value, then specify the larger value.

#

kernel.shmall = 40960
kernel.shmmax = 536870912

kernel.shmall = 40960 转换成是40960*4/1024=160M

SQL> startup
ORA-27102: out of memory
Linux Error: 28: No space left on device

SGA 160M

PGA 16M

kernel.shmall设置为175M就可以启动

kernel.shmall设置为161M 数据库无法启动

kernel.shmall设置为162M 数据库无法启动

kernel.shmall = 2097152 则一共是8G的共享内存总量

[root@jssweb ~]# ipcs -m

—— Shared Memory Segments ——–
key shmid owner perms bytes nattch status
0x00000000 32768 gdm 600 393216 2 dest
0x4cd60004 393217 oracle 640 169869312 16

此时总共的共享内存:162+0.375M

kernel.shmall设置为163M

此时在启用一个实例:
oracle@jssweb dbs]cpspfilejssweb.oraspfileperass.ora[oracle@jsswebdbs] export ORACLE_SID=perass
[oracle@jssweb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 22 07:01:06 2011

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORA-27102: out of memory
Linux Error: 28: No space left on device

报错

这个参数定义了总共共享内存的页数

原文地址:https://www.cnblogs.com/hzcya1995/p/13351210.html