ORA-27102: out of memory

ORA-27102: out of memory

𝓓𝓸𝓷 Lv6

安装Oracle数据库时,报ORA-27102: out of memory错误

一、out of memory错误

在使用DBCA建库时,提示ORA-27102: out of memory错误

image-20250310105215472

二、原因

数据库内核参数shmall的值设置得过低,导致数据库安装失败,出现ORA-27102: out of memory‌报错提示

三、解决方法

1.查看系统内存

free命令检查系统内存,发现内存充足

1
2
3
4
5
6
7
8
9
# free -g
total used free shared buff/cache available
Mem: 31 1 18 2 11 27
Swap: 16 0 16

# free -b
total used free shared buff/cache available
Mem: 33566666752 1671766016 19445817344 2252005376 12449083392 29413380096
Swap: 17184059392 0 17184059392
2.检查系统内核中内存参数设置

系统内核参数与内存相关的有两个:kernel.shmall和kernel.shmmax,其中只有kernel.shmall参数设置不当才会引起内存不足的错误提示,合理的shmall设置可以减少数据库在启动和运行时对内存的过度分配,从而提高系统的整体性能和稳定性

1
2
3
4
# more /etc/sysctl.conf 

kernel.shmall = 2097152
kernel.shmmax = 17179869184
3.设置合理的内存参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(1) 计算shmmax和shmall参数值
shmmax=物理内存(bytes)/2 -1
shmall=物理内存(bytes)/pagesize(getconf PAGESIZE)

# getconf PAGESIZE
4096

pagesize: 4096
shmmax值: 33566666752/2-1 = 16783333375
shmal值: 33566666752/4096 = 8194987

(2) 修改内核配置文件调整内存参数:
# vi /etc/sysctl.conf

kernel.shmall = 8194987
kernel.shmmax = 16783333375

(3) 让内核参数生效:
# sysctl -p

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8194987
kernel.shmmax = 16783333375
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

(4) 重新安装数据库

四、科普Oracle内存参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1.  kernel.shmmax :
是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值。设置应该足够大,能在一个共享内存段下容纳下整个的 SGA , 设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降。至于导致系统下降的主要原因为在实例启动以及 ServerProcess 创建的时候,多个小的共享内存段可能会导致当时轻微的系统性能的降低 ( 在启动的时候需要去创建多个虚拟地址段,在进程创建的时候要让进程对多个段进行“识别”,会有一些影响 ) ,但是其他时候都不会有影响。

官方建议值:

32 位 linux 系统:可取最大值为 4GB ( 4294967296bytes ) -1byte ,即 4294967295 。建议值为多于内存的一半,所以如果是 32 为系统,一般可取值为 4294967295 。 32 位系统对 SGA 大小有限制,所以 SGA 肯定可以包含在单个共享内存段中。

64 位 linux 系统:可取的最大值为物理内存值 -1byte ,建议值为多于物理内存的一半,一般取值大于 SGA_MAX_SIZE 即可,可以取物理内存 -1byte 。  

内存为 12G 时,该值为 12*1024*1024*1024-1 = 12884901887

内存为 16G 时,该值为 16*1024*1024*1024-1 = 17179869183

内存为 32G 时,该值为 32*1024*1024*1024-1 = 34359738367

内存为 64G 时,该值为 64*1024*1024*1024-1 = 68719476735

内存为 128G 时,该值为 128*1024*1024*1024-1 = 137438953471



2.  kernel.shmall :
该参数控制可以使用的共享内存的总页数。 Linux 共享内存页大小为 4KB, 共享内存段的大小都是共享内存页大小的整数倍。

一个共享内存段的最大大小是 16G ,那么需要共享内存页数是 16GB/4KB==4194304 (页),

当内存为 12G 时, kernel.shmall = 3145728

当内存为 16G 时, kernel.shmall = 4194304

当内次为 32G 时, kernel.shmall = 8388608

当内存为 64G 时, kernel.shmall = 16777216

当内存为 128G 时, kernel.shmall = 33554432

五、Minimum Parameter Settings for Installation

官方文档:https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/minimum-parameter-settings-for-installation.html#GUID-CDEB89D1-4D48-41D9-9AC2-6AD9B0E944E3

Use this table to set parameters manually if you cannot use the fixup scripts.

Note:

  • Unless otherwise specified, the kernel parameter and shell limit values shown in the following table are minimum values only. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system. See the operating system documentation for more information about tuning kernel parameters.
  • If the current value for any parameter is greater than the value listed in this table, then the Fixup scripts do not change the value of that parameter.

Table A-1 Minimum Operating System Resource Parameter Settings

Parameter Value File
semmslsemmnssemopm****semmni 25032000100128 /proc/sys/kernel/sem
shmall Greater than or equal to the value of shmmax, in pages. /proc/sys/kernel/shmall
shmmax Half the size of physical memory in bytesSee My Oracle Support Note 567506.1 for additional information about configuring shmmax. /proc/sys/kernel/shmmax
shmmni 4096 /proc/sys/kernel/shmmni
panic_on_oops 1 /proc/sys/kernel/panic_on_oops
file-max 6815744 /proc/sys/fs/file-max
aio-max-nr 1048576Note: This value limits concurrent outstanding requests and should be set to avoid I/O subsystem failures. /proc/sys/fs/aio-max-nr
ip_local_port_range Minimum: 9000Maximum: 65500 /proc/sys/net/ipv4/ip_local_port_range
rmem_default 262144 /proc/sys/net/core/rmem_default
rmem_max 4194304 /proc/sys/net/core/rmem_max
wmem_default 262144 /proc/sys/net/core/wmem_default
wmem_max 1048576 /proc/sys/net/core/wmem_max
  • Title: ORA-27102: out of memory
  • Author: 𝓓𝓸𝓷
  • Created at : 2025-03-10 11:23:18
  • Updated at : 2025-03-10 16:17:38
  • Link: https://www.zhangdong.me/oracle-ora-27102.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论