11G hugepage的use_large_pages参数

11G 增加参数use_large_pages,可以灵活使用hugepages.

如果参数为True(默认值),那么当系统的HugePage被使用尽,只有small pages的情况下,SGA也会继续运行。此时,Oracle实例就运行在内存使用混合模式(Mixed Mode)下。

如果参数为是Only,从含义上,表示Oracle实例只会使用HugePage作为内存使用。如果系统在AMM模式或者HugePage用尽的时候,数据库就不能启动或者报错。

还有一个参数设置use_large_pages=auto.

下面就三个参数进行测试一下区别:

1.use_large_pages=TRUE

SQL> show parameter use_large_pages

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
use_large_pages                      string      TRUE

vm.nr_hugepages = 20,将hugepages设为很小的值,测试数据库能否正常开启。虚拟机的数据库的sga也很小,只有300M.

[oracle@qht131 ~]$  grep Huge /proc/meminfo
AnonHugePages:     14336 kB
HugePages_Total:      20
HugePages_Free:       20
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
[oracle@qht131 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 6 09:24:31 2020

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size                  2227944 bytes
Variable Size             192938264 bytes
Database Buffers          113246208 bytes
Redo Buffers                4747264 bytes
Database mounted.
Database opened.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@qht131 ~]$  grep Huge /proc/meminfo
AnonHugePages:     18432 kB
HugePages_Total:      20
HugePages_Free:        8
HugePages_Rsvd:        8
HugePages_Surp:        0
Hugepagesize:       2048 kB

不过log提示如下,建议将largepagesize设置为131(262M)。

****************** Large Pages Information *****************

Total Shared Global Region in Large Pages = 40 MB (13%)

Large Pages used by this instance: 20 (40 MB)
Large Pages unused system wide = 0 (0 KB) (alloc incr 4096 KB)
Large Pages configured system wide = 20 (40 MB)
Large Page size = 2048 KB

RECOMMENDATION:
  Total Shared Global Region size is 302 MB. For optimal performance,
  prior to the next instance restart increase the number
  of unused Large Pages by atleast 131 2048 KB Large Pages (262 MB)
  system wide to get 100% of the Shared
  Global Region allocated with Large pages
***********************************************************

2.use_large_pages=ONLY

SQL> alter system set use_large_pages=only;
alter system set use_large_pages=only
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


SQL> alter system set use_large_pages=only scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-27137: unable to allocate large pages to create a shared memory segment
Linux-x86_64 Error: 12: Cannot allocate memory

use_large_pages参数必须要重启才能生效,改成only以后,数据库Open失败。

做这个测试的时候忘记先备份spfile了,不得不从alert_orcl.log中恢复参数,手动重建pfile。

SQL> startup nomount pfile='/u01/app/oracle/product/11203/dbs/initorcl.ora';
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size                  2227944 bytes
Variable Size             104857880 bytes
Database Buffers          201326592 bytes
Redo Buffers                4747264 bytes

SQL> create spfile from  pfile='/u01/app/oracle/product/11203/dbs/initorcl.ora';

File created.

3.测试use_large_pages=AUTO,预期是系统如果nr_hugepages设置过小,数据需要增大的hugepagesize时会自动扩大Hugepage的值。

当前值还是20: vm.nr_hugepages=20

[oracle@qht131 dbs]$  cat /proc/meminfo | grep -i  page
AnonPages:        149620 kB
PageTables:        24472 kB
AnonHugePages:     36864 kB
HugePages_Total:      20
HugePages_Free:        5
HugePages_Rsvd:        5
HugePages_Surp:        0
Hugepagesize:       2048 kB

重启数据库看是否能启动

SQL>  alter system set use_large_pages=auto scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size                  2227944 bytes
Variable Size             125829400 bytes
Database Buffers          180355072 bytes
Redo Buffers                4747264 bytes
Database mounted.
Database opened.

SQL> show parameter use_large_pages

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
use_large_pages                      string      AUTO

日志文件如下:

Starting ORACLE instance (normal)
WARNING: -------------------------------
WARNING: oradism did not start up correctly.
----------------------------------------
oradism creation failed for unknown reasons 0 8 500
Oradism Spawned failed for largepages allocation
****************** Large Pages Information *****************
Parameter use_large_pages = AUTO

Total Shared Global Region in Large Pages = 40 MB (13%)

Large Pages used by this instance: 20 (40 MB)
Large Pages unused system wide = 0 (0 KB) (alloc incr 4096 KB)
Large Pages configured system wide = 20 (40 MB)
Large Page size = 2048 KB
Time taken to allocate Large Pages = 0.000000 sec

RECOMMENDATION:
  Total Shared Global Region size is 302 MB. For optimal performance,
  prior to the next instance restart increase the number
  of unused Large Pages by atleast 131 2048 KB Large Pages (262 MB)
  system wide to get 100% of the Shared
  Global Region allocated with Large pages
***********************************************************

日志有一个Warning,oradism didn't startup correctly.数据库虽然启动成功了,但是没有达到预期的效果,当前的hugepages_total还是20。由于上面的warning,oradism进程启动失改,导致没有自动的扩大hugepages的尺寸。

[oracle@qht131 trace]$ cat /proc/meminfo | grep -i  page
AnonPages:        149396 kB
PageTables:        24300 kB
AnonHugePages:     34816 kB
HugePages_Total:      20
HugePages_Free:        8
HugePages_Rsvd:        8
HugePages_Surp:        0
Hugepagesize:       2048 kB

DISM是Solaris的组件,我的系统是rehdhat,估计是要手动安装些组件。

 DISM stands for Dynamic Intimate Shared Memory and it is the Solaris component that allows Automatic memory management on Linux and Solaris.DISM is turned on by default for Oracle Database 11.2.0.1 on Oracle Solaris, which makes it important for Database Administrators (DBAs) to understand its capabilities and behavior. as it relates to the memory_target parameters.

关于dism的官方文档:

https://www.oracle.com/technetwork/articles/systems-hardware-architecture/using-dynamic-intimate-memory-sparc-168402.pdf

所以在Linuxt系统将参数 use_large_pages设为TURE和AUTO效果是一样的,默认还是用TRUE吧。

 

http://blog.itpub.net/267265/viewspace-2101170/

http://blog.itpub.net/267265/viewspace-2145480/

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值