linux大内存页设置for 11g

2021年10月12日 541点热度 1人点赞 0条评论

最近遇见一个虚机老库11g,主机CPU居高不下,有时甚至无法登录,无法快速建立数据连接。
分析发现较多的应用SQL存在问题,同时发现数据库配置方面也存在问题,分析排查alertlog日志,发现没有配置大内存页。
更多关于大内存页的信息可在本站搜索"大内存页"。

以下是本次操作调整的记录,留作参考。
如下是上次启动的日志提示:

Wed Sep 29 14:31:01 2021
Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 64 KB

Total Shared Global Region in Large Pages = 0 KB (0%)

Large Pages used by this instance: 0 (0 KB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 0 (0 KB)
Large Page size = 2048 KB

RECOMMENDATION:
  Total System Global Area size is 35 GB. For optimal performance,
  prior to the next instance restart:
  1. Increase the number of unused large pages by
 at least 17921 (page size 2048 KB, total size 35 GB) system wide to
  get 100% of the System Global Area allocated with large pages
  2. Large pages are automatically locked into physical memory.
 Increase the per process memlock (soft) limit to at least 35 GB to lock
 100% System Global Area's large pages into physical memory
********************************************************************

可见共享内存没有放入大页;大页单位尺寸是2M标准大小。建议提示,应该将35G的SGA完全使用大内存页,需要17921个大内存页。并且,大内存页应锁定到物理内存。
查看此时的大页情况如下:

cat /proc/meminfo|grep -i page
AnonPages:       1104092 kB
PageTables:     13077080 kB
AnonHugePages:     24576 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

计算并修改配置,使之生效:

SQL> show parameter sga
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 35G
sga_target                           big integer 35G

HugePages_Total=35*1024/2+1=17921

cat >> /etc/security/limits.conf << EOF
oracle soft memlock unlimited
oracle hard memlock unlimited
EOF

cat >> /etc/sysctl.conf << EOF
vm.nr_hugepages=17921
EOF

sysctl -p

===改后:

[root@sxtsdb:~]cat /proc/meminfo|grep -i page
AnonPages:         37084 kB
PageTables:        14112 kB
AnonHugePages:      8192 kB
HugePages_Total:   17921
HugePages_Free:    17921
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

===启库:

Mon Oct 11 22:40:44 2021
Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = UNLIMITED

Total Shared Global Region in Large Pages = 35 GB (100%)

Large Pages used by this instance: 17921 (35 GB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 17921 (35 GB)
Large Page size = 2048 KB
********************************************************************

===第二天忙时内存情况:

cat /proc/meminfo|grep -i page
AnonPages:       2028420 kB
PageTables:       231312 kB
AnonHugePages:     45056 kB
HugePages_Total:   17921
HugePages_Free:     1209
HugePages_Rsvd:     1209
HugePages_Surp:        0
Hugepagesize:       2048 kB

此时CPU空闲70-80%左右,基本达到正常。

liking

我是雪人

文章评论