1.1 症状
在华为云centos7.2系统上安装oracle11g2040,把sga设置为物理内存40%,启动时报错如下:
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information: -1744830464
Additional information: 1
1.2 分析
分析:Changes
shmall is too small, most likely is set to the default setting of 2097152
vi /etc/sysctl.conf
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576Cause
shmall is the total amount of shared memory, in pages, that the system can use at one time.
shmall是系统在所有页同一时间使用的共享内存段的总数
kernel.shmall 参数是控制共享内存页数。该参数大小为物理内存除以pagesize;
1.3 解决办法
Solution
解决办法
Set shmall equal to the sum of all the SGAs on the system, divided by the page size.
设定shmall的值为等同于在系统中所有SGA占用内存大小除以分页大小的得出的最后的值
The page size can be determined using the following command:
用以下命令得到分页的大小
$ getconf PAGE_SIZE
4096
For example, if the sum of all the SGAs on the system is 16Gb and the result of
'$ getconf PAGE_SIZE' is 4096 (4Kb) then set shmall to 4194304 pages
16GB/4KB=16777216KB/4KB=4194304 (页)
例如,如果系统中所有SGA的综合为16Gb,然后getconf PAGE_SIZE 得出的结果是4096(4k),那么shmall就设定为4194304页(我直接设置为物理内存/分页的大小)
1.3.1 改变参数shmmax
Shmmax 是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值,shmmax 设置应该足够大,能在一个共享内存段下容纳下整个的SGA ,设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降 。
Oralce 建议 SHMMAX > SGA(SGA_MAX_SIZE),这样在任何时候都不会有甚至轻微的性能下降的隐患。
我本次把SHMMAX设置为30G,因为内存为64G,sga我设置为了26G。
1.3.2 改变参数shmall
kernel.shmall 参数是控制共享内存页数。该参数大小为物理内存除以pagesize;
我直接设置为物理内存/分页的大小
16GB/4KB=16777216KB/4KB=4194304 (页)*4=16777216
root用户:
# vi /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
kernel.shmmax = 32212254720
kernel.shmmni = 4096
kernel.shmall = 16777216
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
~
使改变生效:
[root@oa-oracle ~]# sysctl -p
kernel.shmmax = 32212254720
kernel.shmmni = 4096
kernel.shmall = 16777216
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
NOTE:
以上命令无须重启
切换到oracle用户,重新执行startup命令
修改/etc/sysctl.conf 是一个永久的解决办法(适用于开机时间)
If for some reason you DO NOT want to change the system wide configuration, you can do it
on the fly by directly changing the kernel pseudo FS AKA procfs.
如果出于某种原因不详对系统大范围改动配置,可以直接改变内核的pseudo FS AKA procfs.
# echo "4194304" > /proc/sys/kernel/shmall
使用大页不会改变配置shmall的计算结果
以上翻译仅供参考
References
NOTE:169706.1 - Oracle Database on Unix AIX,HP-UX,Linux,Mac OS X,Solaris,Tru64 Unix Operating Systems Installation and Configuration Requirements Quick Reference (8.0.5 to 11.2)
NOTE:851598.1 - Master Note of Linux OS Requirements for Database Server
NOTE:1351051.2 - Information Center: Install and Configure Database Server/Client Installations
Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Standard Edition
Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
64-BIT; 64BIT; HUGEPAGES; INSTALL & CONFIGURE; LINUX; NO SPACE LEFT ON DEVICE; OUT OF MEMORY; START INSTANCE
ORA-27102
Copyright (c) 2007, 2010, Oracle. All rights reserved. Legal Notices and Terms of Use | Privacy Statement