您好,登录后才能下订单哦!
Oracle数据库在AIX 平台下使用大页内存的实例分析,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
不管是AIX平台还是在Linux平台使用大页内存(Large Page Memory)都是依赖于操作系统的特性。Linux平台和AIX平台默认的页面大小都是4K,Linux平台的HugePage特性通常每个页面可以调整为2M;AIX平台的Large Page Memory使得单个页面最大可以调整为16M;下面详细讨论在AIX平台下,Oracle数据库实例使用64K和16M两种规格的内存页面,主要讨论的是16M的内存页面。
1.使用64K内存页面
在oracle用户的PROFILE文件中加入以下环境变量的设置:
export LDR_CNTRL=DATAPSIZE=64K@STACKPSIZE=64K@TEXTPSIZE=64K
在使以上环境变量生效的情况下重启Oracle数据库实例。
使用前:
halpar1:[/home/oracle]$ps -efZ | grep ora
oracle 340174 1 0 22:27:07 - 0:00 4K 4K 4K 4K ora_mmnl_ordb
oracle 405740 1 0 22:27:27 - 0:00 4K 4K 4K 4K ora_q001_ordb
oracle 409848 1 1 22:27:07 - 0:00 4K 4K 4K 4K ora_ckpt_ordb
oracle 463038 1 0 22:27:06 - 0:00 4K 4K 4K 4K ora_lgwr_ordb
oracle 499916 704560 0 22:26:57 pts/0 0:00 4K 4K 4K 4K -ksh
oracle 508116 1 0 22:27:06 - 0:00 4K 4K 4K 4K ora_dbw0_ordb
oracle 524472 1 0 22:27:06 - 0:00 4K 4K 4K 4K ora_mman_ordb
oracle 549010 1 0 22:27:06 - 0:00 4K 4K 4K 4K ora_psp0_ordb
oracle 577616 1 0 22:27:06 - 0:00 4K 4K 4K 4K ora_pmon_ordb
oracle 589946 1 0 22:27:07 - 0:00 4K 4K 4K 4K ora_smon_ordb
使用后:
halpar1:[/]#ps -efZ | grep ora
oracle 340180 1 0 22:43:02 - 0:00 64K 64K 64K 4K ora_psp0_ordb
oracle 405742 1 0 22:43:22 - 0:00 64K 64K 64K 4K ora_q000_ordb
oracle 409850 1 0 22:43:03 - 0:00 64K 64K 64K 4K ora_d000_ordb
oracle 463040 1 0 22:43:03 - 0:00 64K 64K 64K 4K ora_mmnl_ordb
oracle 499916 704560 0 22:26:57 pts/0 0:00 4K 4K 4K 4K -ksh
oracle 508118 1 0 22:43:03 - 0:00 64K 64K 64K 4K ora_mmon_ordb
oracle 524474 1 15 22:43:03 - 0:00 64K 64K 64K 4K ora_cjq0_ordb
oracle 549012 1 0 22:43:02 - 0:00 64K 64K 64K 4K ora_reco_ordb
oracle 577618 1 0 22:43:02 - 0:00 64K 64K 64K 4K ora_smon_ordb
oracle 589948 1 0 22:43:02 - 0:00 64K 64K 64K 4K ora_ckpt_ordb
2.使用16M内存页面
1).在操作系统执行如下命令:
#vmo -po v_pinshm=1
#vmo -po maxpin%=80(根据实际需要来设置)
#chuser capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE oracle(使用lsuser -a capabilities oracle命令可以查看oracle用户设置的此属性)
#vmo -po lgpg_size=16777216 -o lgpg_regions=64(16777216=16M*64=1024M内存,lgpg_size根据实际的内存和数据库实例SGA的大小来设置)
Setting lgpg_size to 16777216 in nextboot file
Setting lgpg_regions to 64 in nextboot file
Warning :although the change concerns a dynamic ...
optimally restore these settings at reboot(建议做bosboot,并且重新启动操作系统)
Setting lgpg_size to 16777216
Setting lgpg_regions to 64
#bosboot -a
注意:Oracle Database 10.2.0.4及其以上的版本必须完成chuser capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE oracle命令对oracle操作系统用户属性的设置,如果不设置可能导致出现如下文章中的问题:http://space.itpub.net/23135684/viewspace-631065
运行下面的命令可以去除16M的页面设置:
#vmo -po lgpg_size=0 -o lgpg_regions=0
2).需要修改oracle用户的profile文件
#export ORACLE_SGA_PGSZ=16M
Oracle 10.2.0.4,需要设置这个参数,参见metalink DOC ID:NOTE:728444.1
3).需要修改数据库参数
执行以下的SQL语句,主要设置LOCK_SGA为true:
SQL> alter system set pre_page_sga=true scope=spfile;
SQL> alter system set lock_sga=true scope=spfile;
将LOCK_SGA设置为TRUE会触发Oracle数据库实例使用Large Page Memory,设置之后重启数据库实例。
使用16M内存页面之前:
halpar1:[/]#svmon
size inuse free pin virtual
memory 1048576 637640 447815 445323 288587
pg space 262144 2841
work pers clnt other
pin 109892 0 2849 70438
in use 288587 0 86909
PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 245336 2841 102907 158427
m 64 KB - 8135 0 5017 8135
L 16 MB 64 0 0 64 0(值为0)
使用16M内存页面之后:
halpar1:[/]#svmon
size inuse free pin virtual
memory 1048576 691573 393883 446308 473636
pg space 262144 3088
work pers clnt other
pin 241949 0 2849 70438
in use 473636 0 86865
PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 247605 3088 102916 160740
m 64 KB - 11364 0 5078 11364
L 16 MB 64 32 0 64 32(值为非0)
如果数据库被升级到了10.2.0.4或者10.2.0.5,经过以上配置默认可能也不会使用到大页,请参考文章:《AIX: Upgraded To 10.2.0.4 (or 10.2.0.5) And Large Page Memory Is No Longer Used [ID 728444.1] 》 http://space.itpub.net/?uid-23135684-action-viewspace-itemid-742754
有关在AIX平台使用Large Page Memory的详细内容参考文章:《How to enable Large Page Feature on AIX-Based Systems [ID 372157.1]》http://space.itpub.net/?uid-23135684-action-viewspace-itemid-742753
结合METALINK的文章,AIX平台下的16M Large Page Memory配置如下:
# oslevel -s
6100-07-05-1228
# vmo -L v_pinshm
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
v_pinshm 0 0 0 0 1 boolean D
--------------------------------------------------------------------------------
# vmo -po v_pinshm=1
Setting v_pinshm to 1 in nextboot file
Setting v_pinshm to 1
# vmo -L v_pinshm
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
v_pinshm 1 0 1 0 1 boolean D
--------------------------------------------------------------------------------
# vmo -L maxpin%
NAME CUR DEF BOOT MIN MAX UNIT TYPE
DEPENDENCIES
--------------------------------------------------------------------------------
maxpin% 80 80 80 1 100 % memory D
pinnable_frames
memory_frames
--------------------------------------------------------------------------------
# lsuser -a capabilities oracle
oracle capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE,CAP_NUMA_ATTACH
# lsuser -a capabilities grid
grid capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE,CAP_NUMA_ATTACH
# lsattr -El mem0
ent_mem_cap I/O memory entitlement in Kbytes False
goodsize 31488 Amount of usable physical memory in Mbytes False
mem_exp_factor Memory expansion factor False
size 31488 Total amount of physical memory in Mbytes False
var_mem_weight Variable memory capacity weight False
# vmo -p -o lgpg_regions=1024 -o lgpg_size=16777216
Setting lgpg_size to 16777216 in nextboot file
Setting lgpg_regions to 1024 in nextboot file
Warning: although the change concerns a dynamic tunable, bosboot should be run to optimally restore these settings at reboot
Setting lgpg_size to 16777216
Setting lgpg_regions to 1024
# vmo -o lru_file_repage=0
Setting lru_file_repage to 0
Warning: a restricted tunable has been modified
# bosboot -a
bosboot: Boot image is 51228 512 byte blocks.
# vmstat -l
System configuration: lcpu=16 mem=31488MB
kthr memory page faults cpu large-page
----- ----------- ------------------------ ------------ ----------- -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa alp flp
1 1 899643 7522 0 0 0 47 63 0 21 2107 579 0 0 99 0 0 1024
# svmon
size inuse free pin virtual mmode
memory 8060928 8042431 18497 4724020 902447 Ded
pg space 2621440 3418
work pers clnt other
pin 292772 0 0 236944
in use 902447 0 2945680
PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 3372319 3418 310180 426639
m 64 KB - 29738 0 13721 29738
L 16 MB 1024 0 0 1024 0
下面是调整Oracle数据库实例参数后使用Large Page Memory的过程:
$ sql
SQL*Plus: Release 11.2.0.3.0 Production on Thu Sep 6 15:00:51 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter system set sga_max_size=16g scope=spfile;
System altered.
SQL> alter system set sga_target=16g scope=spfile;
System altered.
SQL> alter system set pre_page_sga=true scope=spfile;
System altered.
SQL> alter system set lock_sga=true scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORA-27102: out of memory
IBM AIX RISC System/6000 Error: 12: Not enough space
服务器总共有32G的内存,Large Page Memory设置的是16G,Oracle数据库实例SGA设置的也是16G,但数据库实例启动的时候由于粒度的原因占用的空间可能稍微大于16G,那么Large Page Memory空间是不够用的(这段空间自动分配之后就被占据,不被任何程序使用,Oracle实例无法使用,空间即被浪费),剩余的空间也是不够的,所以报内存不足。解决办法是将lgpg_regions增加1即可:
# vmo -p -o lgpg_regions=1025 -o lgpg_size=16777216
Setting lgpg_size to 16777216 in nextboot file
Setting lgpg_regions to 1025 in nextboot file
Warning: although the change concerns a dynamic tunable, bosboot should be run to optimally restore these settings at reboot
Setting lgpg_size to 16777216
Setting lgpg_regions to 1025
SQL> startup
ORACLE instance started.
Total System Global Area 1.7103E+10 bytes
Fixed Size 2238616 bytes
Variable Size 771753832 bytes
Database Buffers 1.6307E+10 bytes
Redo Buffers 21716992 bytes
Database mounted.
Database opened.
# svmon
size inuse free pin virtual mmode
memory 8060928 5732976 2327952 4683897 5139434 Ded
pg space 2621440 3736
work pers clnt other
pin 4446953 0 0 236944
in use 5139434 0 593542
PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 1096480 3736 309289 502938
m 64 KB - 27381 0 11013 27381
L 16 MB 1025 1025 0 1025 1025
# vmstat -l
System configuration: lcpu=16 mem=31488MB
kthr memory page faults cpu large-page
----- ----------- ------------------------ ------------ ----------- -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa alp flp
1 1 5139300 2328085 0 0 0 0 0 0 18 1853 568 0 0 99 0 1025 0
从上面的命令可以看出1025个Large Page Memory都被使用了。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。