ITPub博客

首页 > 数据库 > Oracle > [20260420]再论参数use_large_pages.txt

[20260420]再论参数use_large_pages.txt

原创 Oracle 作者:lfree 时间:2026-04-28 20:07:40 0 删除 编辑

[20260420]再论参数use_large_pages.txt

--//现在服务器内存越来越大,一开始上线最好采用hugepages,而不是以后某个时间再修改,这样无形增加运维的工作量。
--//现在缺省参数use_large_pages缺省等于true,非常容易混淆,并不是一定全部采用HugePage,而是优先使用HugePage,如果不足采
--//用small pages作为补充,oracle实例可以继续启动。此时,Oracle实例就运行在内存上使用混合模式(Mixed Mode)下。

--//发现不知道从什么版本增加了AUTO_ONLY,顺便测试看看,顺便提一下,oracle 21c不支持设置vm.nr_overcommit_hugepages内核参
--//数方式"借用"内存支持hugepages.

--//测试发现只有设置ONLY或者AUTO_ONLY才是全部采用HUGEPAGES。

--//再通过例子详细说明这个参数的其他设置,有一些自己也很容易混淆,顺便解答别人的问题。

1.环境:
SYS@book> @ ver2
==============================
PORT_STRING                   : x86_64/Linux 2.4.xx
VERSION                       : 21.0.0.0.0
BANNER                        : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
BANNER_FULL                   : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
BANNER_LEGACY                 : Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
CON_ID                        : 0
PL/SQL procedure successfully completed.

SYS@book> @ hidez ^sga_target|^sga_max_size
 NUM N_HEX CON_ID NAME         DESCRIPTION         DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
---- ----- ------ ------------ ------------------- ------------- ------------- ------------ ----- ---------
 173    AD      0 sga_max_size max total SGA size  TRUE          1107296256    1107296256   FALSE FALSE
1797   705      0 sga_target   Target size of SGA  FALSE         1107296256    1107296256   FALSE IMMEDIATE
--//1107296256/1024/1024 = 1056
--//换成hugepages等于1056/2 = 528,实际上需要的hugepages=530.

SYS@book> @ pvalid use_large
Display valid values for multioption parameters matching "use_large"...
  PAR# PARAMETER        ORD VALUE        DEFAULT
------ ---------------- --- ------------ -------
   180 use_large_pages    1 TRUE         DEFAULT
       use_large_pages    2 AUTO
       use_large_pages    3 ONLY
       use_large_pages    4 FALSE
       use_large_pages    5 AUTO_ONLY

--//通过kimi查询到的资料:

--//三者的核心区别在于当 HugePages 不足时的处理策略:

--//1. AUTO(推荐,默认行为)

--//策略:优先使用 HugePages,不足时自动回退到常规内存页(small pages)
--//行为:启动时尽量将 SGA 放入 HugePages,剩余部分使用普通内存
--//结果:实例一定能启动,但可能部分 SGA 未使用大页
--//适用场景:希望利用大页提升性能,但不想因配置不足导致启动失败的场景

--//2. AUTO_ONLY(自动适配)

--//策略:只使用 HugePages,但会自动缩小 SGA 以适应可用的 HugePages 数量
--//行为:如果 HugePages 不足以容纳当前 SGA 大小,Oracle 会自动减小 SGA 直到能完全放入 HugePages 为止
--//结果:实例能启动,但 SGA 可能被显著缩小;如果系统完全没有配置 HugePages,SGA 可能被缩到很小
--//适用场景:希望强制使用大页,且接受 SGA 自动缩容的场景(较少使用)

--//3. ONLY(强制严格)

--//策略:必须使用 HugePages,不做任何回退或缩容
--//行为:如果可用的 HugePages 不足以容纳整个 SGA,实例启动失败并报错
--//结果:要么全用大页,要么起不来
--//适用场景:生产环境强制要求大页保障性能一致性,且 HugePages 已精确计算并配置足够的场景

--//补充:
--//有时候觉得AI也是乱分析,根本不是这样的情况。具体看下面的测试
--//顺便提一下oracle缺省设置true,优先使用hugepages,不足使用部分small page。false就是不使用hugepages。

--//本文仅仅测试设置ONLY,AUTO,AUTO_ONLY等3种情况。其他true,false不再测试。

2.测试use_large_pages=only:
--//首先关闭数据库。
--//当前数据库参数use_large_pages=only
# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 529
vm.nr_overcommit_hugepages = 20
--//注:要满足需要,我的测试环境需要530.

# sysctl -p /etc/sysctl.d/98-oracle.conf
...
--//注每次修改内核参数文件,必须执行sysctl -p /etc/sysctl.d/98-oracle.conf确认修改内核参数。并且在关闭数据库情况下修改。

SYS@book> startup nomount
ORA-27106: system pages not available to allocate memory
Additional information: 6311
Additional information: 2
Additional information: 3
--//可以无法满足启动需求,报错ORA-27106。

--//查看alter日志:
2026-04-20T15:12:21.412597+08:00
Starting ORACLE instance (normal) (OS id: 4201)
2026-04-20T15:12:21.419471+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA
 ****************************************************
2026-04-20T15:12:21.420248+08:00
ERROR: Failed to get available system pages to allocate memory
2026-04-20T15:12:21.420405+08:00
**********************************************************************
2026-04-20T15:12:21.420480+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA)

2026-04-20T15:12:21.420618+08:00
 Per process system memlock (soft) limit = 128G
2026-04-20T15:12:21.420686+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 1060M
2026-04-20T15:12:21.420812+08:00
 Available system pagesizes:
  4K, 2048K
2026-04-20T15:12:21.420937+08:00
 Supported system pagesize(s):
2026-04-20T15:12:21.421002+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2026-04-20T15:12:21.421139+08:00
     2048K              529             530              529   ORA-27102
2026-04-20T15:12:21.421206+08:00
 Reason for not supporting certain system pagesizes:
2026-04-20T15:12:21.421356+08:00
  4K - Large pagesizes only
2026-04-20T15:12:21.421481+08:00
RECOMMENDATION:
2026-04-20T15:12:21.421555+08:00
 1. Configure system with expected number of pages for every
 supported system pagesize prior to the next instance restart operation.
2026-04-20T15:12:21.450745+08:00
**********************************************************************
2026-04-20T15:12:21.450868+08:00
SGA: Realm creation failed
--//要满足启动需要设置vm.nr_hugepages = 530.

--//修改/etc/sysctl.d/98-oracle.conf文件,vm.nr_hugepages = 530.
# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 530
vm.nr_overcommit_hugepages = 20

# sysctl -p /etc/sysctl.d/98-oracle.conf
....

SYS@book> startup nomount
ORACLE instance started.

Total System Global Area 1107294056 bytes
Fixed Size                  9684840 bytes
Variable Size             654311424 bytes
Database Buffers          436207616 bytes
Redo Buffers                7090176 bytes
--//设置use_large_pages=only,必须设置vm.nr_hugepages大于需要hugepages的数量,才能启动。
--//注:看了以前测试,这里跟11g有一点点不同。以前11g支持通过设置vm.nr_overcommit_hugepages借用内存。
--//我开始以为21c增加use_large_pages=AUTO_ONLY支持这种模式,实际的情况不是,具体看后面测试。

--//查看alter日志:
2026-04-20T15:13:37.368030+08:00
Starting ORACLE instance (normal) (OS id: 4215)
2026-04-20T15:13:37.375010+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA
 ****************************************************
2026-04-20T15:13:37.376165+08:00
**********************************************************************
2026-04-20T15:13:37.376244+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA)

2026-04-20T15:13:37.376388+08:00
 Per process system memlock (soft) limit = 128G
2026-04-20T15:13:37.376460+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 1060M
2026-04-20T15:13:37.376669+08:00
 Available system pagesizes:
  4K, 2048K
2026-04-20T15:13:37.376883+08:00
 Supported system pagesize(s):
2026-04-20T15:13:37.376946+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2026-04-20T15:13:37.377090+08:00
     2048K              530             530              530        NONE
2026-04-20T15:13:37.377153+08:00
 Reason for not supporting certain system pagesizes:
2026-04-20T15:13:37.377214+08:00
  4K - Large pagesizes only
2026-04-20T15:13:37.377274+08:00
**********************************************************************

$ ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 557056     oracle     600        10485760   34
0x00000000 589825     oracle     600        1090519040 34
0x00000000 622594     oracle     600        8388608    34
0xafa94c20 655363     oracle     600        2097152    34

[oracle@centtest IP=56.101 /u01/app/oracle/diag/rdbms/book/book/trace ] $ ipcs -mu
------ Shared Memory Status --------
segments allocated 4
pages allocated 271360
pages resident  265728
pages swapped   0
Swap performance: 0 attempts     0 successes

--//分成4个共享内存段。
--//10485760/2/1024/1024 = 5
--//1090519040/2/1024/1024 = 520
--//8388608/2/1024/1024  = 4
--//2097152/2/1024/1024 = 1
--//5+520+4+1 = 530,正好等于530.

--//修改/etc/sysctl.d/98-oracle.conf文件,vm.nr_hugepages = 520. vm.nr_overcommit_hugepages = 20
# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 520
vm.nr_overcommit_hugepages = 20

# sysctl -p /etc/sysctl.d/98-oracle.conf
...

SYS@book> startup nomount
ORA-27106: system pages not available to allocate memory
Additional information: 6311
Additional information: 1

--//查看alter日志:
Starting ORACLE instance (normal) (OS id: 4385)
2026-04-20T15:17:28.770171+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA
 ****************************************************
2026-04-20T15:17:28.770948+08:00
ERROR: Failed to get available system pages to allocate memory
2026-04-20T15:17:28.771020+08:00
**********************************************************************
2026-04-20T15:17:28.771091+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA)

2026-04-20T15:17:28.771219+08:00
 Per process system memlock (soft) limit = 128G
2026-04-20T15:17:28.771281+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 1060M
2026-04-20T15:17:28.771487+08:00
 Available system pagesizes:
  4K, 2048K
2026-04-20T15:17:28.771615+08:00
 Supported system pagesize(s):
2026-04-20T15:17:28.771676+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2026-04-20T15:17:28.771819+08:00
     2048K              520             530              517   ORA-27102
2026-04-20T15:17:28.771882+08:00
 Reason for not supporting certain system pagesizes:
2026-04-20T15:17:28.771943+08:00
  4K - Large pagesizes only
2026-04-20T15:17:28.772002+08:00
RECOMMENDATION:
2026-04-20T15:17:28.772064+08:00
 1. Configure system with expected number of pages for every
 supported system pagesize prior to the next instance restart operation.
2026-04-20T15:17:28.778124+08:00
**********************************************************************
2026-04-20T15:17:28.778369+08:00
SGA: Realm creation failed
--//可以发现无法启动。符合前面的介绍,就是vm.nr_hugepages必须容纳需要的hugepages数量。
--//还可以发现21c不支持在use_large_pages=auto的情况设置内核参数vm.nr_overcommit_hugepages方式"借用"内存支持hugepages.
--//参考以前帖子:[20170927]hugepages与内核参数nr_overcommit_hugepages.txt

3.测试use_large_pages=auto:
SYS@book> alter system set use_large_pages=auto scope=spfile;
System altered.

SYS@book> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.

--//修改/etc/sysctl.d/98-oracle.conf文件,vm.nr_hugepages = 520. vm.nr_overcommit_hugepages = 20
# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 520
vm.nr_overcommit_hugepages = 20

# sysctl -p /etc/sysctl.d/98-oracle.conf
...

SYS@book> startup nomount
ORACLE instance started.

Total System Global Area 1107294056 bytes
Fixed Size                  9684840 bytes
Variable Size             654311424 bytes
Database Buffers          436207616 bytes
Redo Buffers                7090176 bytes
--//可以正常启动,即使没有设置vm.nr_hugepages = 530.

--//如果仔细看alert信息,可以发现如下信息:
2026-04-20T15:34:07.432920+08:00
Starting ORACLE instance (normal) (OS id: 4913)
2026-04-20T15:34:07.439856+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA
 ****************************************************
2026-04-20T15:34:07.445128+08:00
DISM started, OS id=4930
~~~~~~~~~~~~~~~~~~~~~~~~
2026-04-20T15:34:07.447241+08:00
**********************************************************************
2026-04-20T15:34:07.447386+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA)

2026-04-20T15:34:07.447612+08:00
 Per process system memlock (soft) limit = 128G
2026-04-20T15:34:07.447724+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 1058M
2026-04-20T15:34:07.447944+08:00
 Available system pagesizes:
  4K, 2048K
2026-04-20T15:34:07.448331+08:00
 Supported system pagesize(s):
2026-04-20T15:34:07.448443+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2026-04-20T15:34:07.448557+08:00
        4K       Configured               4                4        NONE
2026-04-20T15:34:07.448795+08:00
     2048K              529             529              529        NONE
2026-04-20T15:34:07.448914+08:00
**********************************************************************
--//注意看下划线,dism后台进程启动。
$ ps -fp 4930
UID        PID  PPID  C STIME TTY          TIME CMD
root      4930     1  0 15:34 ?        00:00:00 ora_dism_book

--//这样的启动方式比前面少1个hugepages,使用4个4k的small pages。可以发现这种方式的一个特点就是有一个段使用4k的页面.大小16K.
--//实际上也不像kimi介绍那样,实际上通过ora_dism_book后台进程修改内核参数,满足启动需求。
# sysctl  vm.nr_hugepages
vm.nr_hugepages = 529
--//已经修改内核参数vm.nr_hugepages。

--//补充说明,实际上后台进程ora_dism_book执行的就是oradism命令,测试遗漏了,注当前ora_dism_book进程号6241!!
$ ps -ef | grep dis[m]
root      6241     1  0 17:27 ?        00:00:00 ora_dism_book

$ ps -fp 6241  -l
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S root      6241     1  0  80   0 -  4690 pipe_w 17:27 ?        00:00:00 ora_dism_book

$ ps -p 6241  -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S     0  6241     1  0  80   0 -  4690 pipe_w ?        00:00:00 oradism

$ ls -l $(which oradism )
-rwsr-x---. 1 root oinstall 1867552 2021-07-28 02:50:06 /u01/app/oracle/product/21.0.0/dbhome_1/bin/oradism

# lsof /u01/app/oracle/product/21.0.0/dbhome_1/bin/oradism
COMMAND  PID USER  FD   TYPE DEVICE SIZE/OFF     NODE NAME
oradism 6241 root txt    REG   8,17  1867552 17422450 /u01/app/oracle/product/21.0.0/dbhome_1/bin/oradism

--//如果使用strace跟踪会发现报如下错误:
$ strace -ff -o aaa sqlplus -s -l / as sysdba <<<"startup nomount"
ORA-12791: The oradism utility does not have proper permissions.
--//因为strace无法跟踪root用户执行oradism程序。

--//通过ipcs查看:
$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1605632    oracle     600        10485760   34
0x00000000 1638401    oracle     600        1090519040 34
0x00000000 1671170    oracle     600        8388608    34
0xafa94c20 1703939    oracle     600        16384      34 --//4k * 4 = 16K.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ ipcs -mu
------ Shared Memory Status --------
segments allocated 4
pages allocated 270852
pages resident  265217
pages swapped   0
Swap performance: 0 attempts     0 successes

# grep -i hugepage /proc/meminfo
AnonHugePages:     26624 kB
HugePages_Total:     529
HugePages_Free:       11
HugePages_Rsvd:       11
HugePages_Surp:        0
Hugepagesize:       2048 kB

4.测试use_large_pages=auto_only:
--//11g以前没有这样的模式。

SYS@book> alter system set use_large_pages=auto_only scope=spfile;
System altered.

SYS@book> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.

--//修改/etc/sysctl.d/98-oracle.conf文件,vm.nr_hugepages = 520.vm.nr_overcommit_hugepages = 20
# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 520
vm.nr_overcommit_hugepages = 20

# sysctl -p /etc/sysctl.d/98-oracle.conf
....

SYS@book> startup nomount
ORACLE instance started.

Total System Global Area 1107294056 bytes
Fixed Size                  9684840 bytes
Variable Size             654311424 bytes
Database Buffers          436207616 bytes
Redo Buffers                7090176 bytes

--//alert记录如下:
2026-04-20T15:55:32.651626+08:00
Starting ORACLE instance (normal) (OS id: 5750)
2026-04-20T15:55:32.658559+08:00
****************************************************
 Sys-V shared memory will be used for creating SGA
 ****************************************************
2026-04-20T15:55:32.664221+08:00
DISM started, OS id=5827
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-04-20T15:55:32.665872+08:00
**********************************************************************
2026-04-20T15:55:32.665955+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA)

2026-04-20T15:55:32.666102+08:00
 Per process system memlock (soft) limit = 128G
2026-04-20T15:55:32.666171+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 1060M
2026-04-20T15:55:32.666301+08:00
 Available system pagesizes:
  4K, 2048K
2026-04-20T15:55:32.666499+08:00
 Supported system pagesize(s):
2026-04-20T15:55:32.666576+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2026-04-20T15:55:32.666721+08:00
     2048K              530             530              530        NONE
2026-04-20T15:55:32.666790+08:00
 Reason for not supporting certain system pagesizes:
2026-04-20T15:55:32.666858+08:00
  4K - Large pagesizes only
2026-04-20T15:55:32.666925+08:00
**********************************************************************
--//注意看下划线启动dism后台进程。

$ ps -fp 5827
UID        PID  PPID  C STIME TTY          TIME CMD
root      5827     1  0 15:55 ?        00:00:00 ora_dism_book

--//通过ipcs查看:
$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1736704    oracle     600        10485760   34
0x00000000 1769473    oracle     600        1090519040 34
0x00000000 1802242    oracle     600        8388608    34
0xafa94c20 1835011    oracle     600        2097152    34

$ ipcs -mu
------ Shared Memory Status --------
segments allocated 4
pages allocated 271360
pages resident  265728
pages swapped   0
Swap performance: 0 attempts     0 successes

# sysctl  vm.nr_hugepages
vm.nr_hugepages = 530
--//如果你对比前面use_large_pages=AUTO和use_large_pages=ONLY的测试,实际上结合两者的特点。首先全部共享内存段使用hugepages。
--//满足设置vm.nr_hugepages = 520不足的情况通过修改内核参数,满足sga需求,启动oracle数据库。

# grep -i hugepage /proc/meminfo
AnonHugePages:     28672 kB
HugePages_Total:     530
HugePages_Free:       11
HugePages_Rsvd:       11
HugePages_Surp:        0
Hugepagesize:       2048 kB
--//虽然初始设置vm.nr_hugepages = 520。顺便提一下如果关闭不会回收。

SYS@book> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.

# grep -i hugepage /proc/meminfo
AnonHugePages:     14336 kB
HugePages_Total:     530
HugePages_Free:      530
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

# sysctl  vm.nr_hugepages
vm.nr_hugepages = 530
--//根本不是什么sga会自动回缩。

5.小结:
--//1.USE_LARGE_PAGES = ONLY(强制严格),设置vm.nr_hugepages必须大于需求的hugepages数量。并且全部共享内存段使用hegepages。
--//2.USE_LARGE_PAGES = AUTO,如果hugepages不足通过启动DISM修改内核vm.nr_hugepages满足启动需求。而且有1个特点,如果这种情
--//况出现,其中1个共享内存段使用4K的页面表。如果hugepages充足,不会启动dism后台进程。但是还是有1个共享内存段使用4K的页面
--//表,大家可以自行测试。
--//3.USE_LARGE_PAGES = AUTO_ONLY,结合ONLY与AUTO的特点。如果hugepages不足通过启动DISM修改内核vm.nr_hugepages满足启动需求。
--//如果hugepages充足,不会启动dism后台进程,大家可以自行测试。但是全部共享内存段使用hegepages。
--//4.对于oracle 21,设置vm.nr_overcommit_hugepages已经无用,oracle在USE_LARGE_PAGES任何参数,都不会借用"内存"。

--//5.视乎无论USE_LARGE_PAGES设置什么,启动实例时都会调用oradism,简单测试方法如下:
$ strace -ff -o aaa sqlplus -s -l / as sysdba <<<"startup nomount"
ORA-12791: The oradism utility does not have proper permissions.
--//注:执行报错是因为分叉的进程调用oradism需要root权限。
$ ls -l $(which oradism )
-rwsr-x---. 1 root oinstall 1867552 2021-07-28 02:50:06 /u01/app/oracle/product/21.0.0/dbhome_1/bin/oradism

--//补充看看oradebug ipc的转储,USE_LARGE_PAGES = AUTO_ONLY
SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug ipc
IPC information written to the trace file

*** 2026-04-20T16:25:46.010352+08:00 (CDB$ROOT(1))
Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags            00001fb7
realmflags           0003ffff
mapsize              00001000
protectsize          00001000
lcmsize              00001000
seglen               00001000
largestsize  0000040000000000
smallestsize 0000000001000000
stacklimit     0x7ffe457f4ab2
stackdir                   -1
mode                      600
magic                acc01ade
 Dump of unix-generic realm handle `/u01/app/oracle/product/21.0.0/dbhome_1book', flags = 00000500
  key 2947107872 actual_key 2947107872 num_areas 4 num_subareas 4
  primary shmid: 2228227 primary sanum 3 version 3
  deferred alloc: FALSE (0) def_post_create: FALSE (0) exp_memlock: 1060M
 Area #0 `Fixed Size' containing Subareas 2-2
  Total size 000000000093c768 Minimum Subarea size 00000000
   Area  Subarea    Shmid    Segment Addr    Stable Addr    Actual Addr
      0        2  2129920 0x00000060000000 0x00000060000000 0x00000060000000
               Subarea size     Segment size   Req_Protect  Cur_protect
                          000000000093d000 0000000000a00000 default       readwrite
 Area #1 `Variable Size' containing Subareas 0-0
  Total size 0000000041000000 Minimum Subarea size 01000000
   Area  Subarea    Shmid    Segment Addr    Stable Addr    Actual Addr
      1        0  2162689 0x00000061000000 0x00000061000000 0x00000061000000
               Subarea size     Segment size   Req_Protect  Cur_protect
                          0000000041000000 0000000041000000 default       readwrite
 Area #2 `Redo Buffers' containing Subareas 1-1
  Total size 00000000006c3000 Minimum Subarea size 00001000
   Area  Subarea    Shmid    Segment Addr    Stable Addr    Actual Addr
      2        1  2195458 0x000000a2000000 0x000000a2000000 0x000000a2000000
               Subarea size     Segment size   Req_Protect  Cur_protect
                          00000000006c3000 0000000000800000 default       readwrite
 Area #3 `skgm overhead' containing Subareas 3-3
  Total size 0000000000004000 Minimum Subarea size 00000000
   Area  Subarea    Shmid    Segment Addr    Stable Addr    Actual Addr
      3        3  2228227 0x000000a3000000 0x000000a3000000 0x000000a3000000
               Subarea size     Segment size   Req_Protect  Cur_protect
                          0000000000004000 0000000000200000 default       readwrite

$ ./lookup.awk skgm
skgm : operating system dependent kernel generic memory (os dependent)
                          
--//第一部分是'固定大小',即固定SGA ;第二部分是'可变大小',包含共享池和缓冲缓存;第三部分是'重做缓冲区';第四部分是
--//'SKGM开销',即该实例共享内存结构的索引。

6.收尾还原:
SYS@book> alter system set use_large_pages=only scope=spfile;
System altered.

# grep ^vm /etc/sysctl.d/98-oracle.conf
vm.nr_hugepages = 530
vm.nr_overcommit_hugepages = 20

# sysctl -p /etc/sysctl.d/98-oracle.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
vm.nr_hugepages = 530
vm.nr_overcommit_hugepages = 20

--//重启数据库略。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-3116905/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7970755