[20170313]11G use_large_pages参数.txt
--11G 增加参数use_large_pages,可以灵活使用hugepages.
1.环境:
SYS@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> @ &r/hide use_large_pages
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
--------------- ---------------------------------------------- ---------------------- ---------------------- ----------------------
use_large_pages Use large pages if available (TRUE/FALSE/ONLY) TRUE TRUE TRUE
--//你查询参数use_large_pages,描述上说明Use large pages if available (TRUE/FALSE/ONLY),缺省就是true,如果设置false,实际上就不用.
如果参数为True,那么当系统的HugePage被使用尽,只有small pages的情况下,SGA也会继续运行。此时,Oracle实例就运行在内存使用
混合模式(Mixed Mode)下。
如果参数为是Only,从含义上,表示Oracle实例只会使用HugePage作为内存使用。如果系统在AMM模式或者HugePage用尽的时候,数据库
就不能启动或者报错。
如果参数为是false,就不使用HugePage.
--//可以参考链接:http://blog.itpub.net/267265/viewspace-2101170/
2.实际上还有一个参数设置use_large_pages=auto.
SYS@book> alter system set use_large_pages=auto scope=spfile;
System altered.
--//关闭数据库
--//修改/etc/sysctl.conf内容如下:
vm.nr_hugepages = 105
# sysctl -p
# cat /proc/meminfo | grep -i hugepage
AnonHugePages: 0 kB
HugePages_Total: 105
HugePages_Free: 105
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
3.重启数据库:
Starting ORACLE instance (normal)
Specified value of sga_max_size is too small, bumping to 637534208
DISM started, OS id=52701
~~~~~~~~~~~~~~~~~~~~~~~~~
************************ Large Pages Information *******************
Parameter use_large_pages = AUTO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 610 MB (100%)
Large Pages used by this instance: 305 (610 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 305 (610 MB)
Large Page size = 2048 KB
Time taken to allocate Large Pages = 0.015337 sec
********************************************************************
--//注意看下划线行,出现DISM started, OS id=52701,可以修改内核参数vm.nr_hugepages,满足实例需要的页面数量.
# cat /proc/meminfo | grep -i hugepage
AnonHugePages: 0 kB
HugePages_Total: 305
HugePages_Free: 98
HugePages_Rsvd: 98
HugePages_Surp: 0
Hugepagesize: 2048 kB
--//你可以发现HugePages_Total=305从原来设置的105.
4.简单探究
--//启动数据库,oracle的进程如何实现改动内核参数呢?
--//看看进程号52701是什么?
$ ps -p 52701 -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 52701 1 0 80 0 - 3338 pipe_w ? 00:00:00 oradism
$ ls -l $(which oradism)
-rwsr-x--- 1 root oinstall 71790 2013-08-24 10:51:02 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/oradism
--//注意oradism的owner = root. 也就是这个进程启动时具有root权限,改动了内核参数.
4.修改回来:
--//修改/etc/sysctl.conf内容如下:
vm.nr_hugepages = 305
# sysctl -p
--//重新关闭并启动数据库:
************************ Large Pages Information *******************
Parameter use_large_pages = AUTO
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 610 MB (100%)
Large Pages used by this instance: 305 (610 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 305 (610 MB)
Large Page size = 2048 KB
Time taken to allocate Large Pages = 0.000000 sec
********************************************************************
--//你可以发现并没有启动dism进程.
$ ps -lef | grep oradis[m]
--//也没有查询到相关信息,说明如果在hugepages设置足够的情况下,use_large_pages = AUTO不会启动oradism进程修改参数.