您好,登錄后才能下訂單哦!
Oracle數(shù)據(jù)庫(kù)在AIX 平臺(tái)下使用大頁(yè)內(nèi)存的實(shí)例分析,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
不管是AIX平臺(tái)還是在Linux平臺(tái)使用大頁(yè)內(nèi)存(Large Page Memory)都是依賴于操作系統(tǒng)的特性。Linux平臺(tái)和AIX平臺(tái)默認(rèn)的頁(yè)面大小都是4K,Linux平臺(tái)的HugePage特性通常每個(gè)頁(yè)面可以調(diào)整為2M;AIX平臺(tái)的Large Page Memory使得單個(gè)頁(yè)面最大可以調(diào)整為16M;下面詳細(xì)討論在AIX平臺(tái)下,Oracle數(shù)據(jù)庫(kù)實(shí)例使用64K和16M兩種規(guī)格的內(nèi)存頁(yè)面,主要討論的是16M的內(nèi)存頁(yè)面。
1.使用64K內(nèi)存頁(yè)面
在oracle用戶的PROFILE文件中加入以下環(huán)境變量的設(shè)置:
export LDR_CNTRL=DATAPSIZE=64K@STACKPSIZE=64K@TEXTPSIZE=64K
在使以上環(huán)境變量生效的情況下重啟Oracle數(shù)據(jù)庫(kù)實(shí)例。
使用前:
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內(nèi)存頁(yè)面
1).在操作系統(tǒng)執(zhí)行如下命令:
#vmo -po v_pinshm=1
#vmo -po maxpin%=80(根據(jù)實(shí)際需要來(lái)設(shè)置)
#chuser capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE oracle(使用lsuser -a capabilities oracle命令可以查看oracle用戶設(shè)置的此屬性)
#vmo -po lgpg_size=16777216 -o lgpg_regions=64(16777216=16M*64=1024M內(nèi)存,lgpg_size根據(jù)實(shí)際的內(nèi)存和數(shù)據(jù)庫(kù)實(shí)例SGA的大小來(lái)設(shè)置)
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,并且重新啟動(dòng)操作系統(tǒng))
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命令對(duì)oracle操作系統(tǒng)用戶屬性的設(shè)置,如果不設(shè)置可能導(dǎo)致出現(xiàn)如下文章中的問(wèn)題:http://space.itpub.net/23135684/viewspace-631065
運(yùn)行下面的命令可以去除16M的頁(yè)面設(shè)置:
#vmo -po lgpg_size=0 -o lgpg_regions=0
2).需要修改oracle用戶的profile文件
#export ORACLE_SGA_PGSZ=16M
Oracle 10.2.0.4,需要設(shè)置這個(gè)參數(shù),參見(jiàn)metalink DOC ID:NOTE:728444.1
3).需要修改數(shù)據(jù)庫(kù)參數(shù)
執(zhí)行以下的SQL語(yǔ)句,主要設(shè)置LOCK_SGA為true:
SQL> alter system set pre_page_sga=true scope=spfile;
SQL> alter system set lock_sga=true scope=spfile;
將LOCK_SGA設(shè)置為T(mén)RUE會(huì)觸發(fā)Oracle數(shù)據(jù)庫(kù)實(shí)例使用Large Page Memory,設(shè)置之后重啟數(shù)據(jù)庫(kù)實(shí)例。
使用16M內(nèi)存頁(yè)面之前:
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內(nèi)存頁(yè)面之后:
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)
如果數(shù)據(jù)庫(kù)被升級(jí)到了10.2.0.4或者10.2.0.5,經(jīng)過(guò)以上配置默認(rèn)可能也不會(huì)使用到大頁(yè),請(qǐng)參考文章:《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
有關(guān)在AIX平臺(tái)使用Large Page Memory的詳細(xì)內(nèi)容參考文章:《How to enable Large Page Feature on AIX-Based Systems [ID 372157.1]》http://space.itpub.net/?uid-23135684-action-viewspace-itemid-742753
結(jié)合METALINK的文章,AIX平臺(tái)下的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
下面是調(diào)整Oracle數(shù)據(jù)庫(kù)實(shí)例參數(shù)后使用Large Page Memory的過(guò)程:
$ 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
服務(wù)器總共有32G的內(nèi)存,Large Page Memory設(shè)置的是16G,Oracle數(shù)據(jù)庫(kù)實(shí)例SGA設(shè)置的也是16G,但數(shù)據(jù)庫(kù)實(shí)例啟動(dòng)的時(shí)候由于粒度的原因占用的空間可能稍微大于16G,那么Large Page Memory空間是不夠用的(這段空間自動(dòng)分配之后就被占據(jù),不被任何程序使用,Oracle實(shí)例無(wú)法使用,空間即被浪費(fèi)),剩余的空間也是不夠的,所以報(bào)內(nèi)存不足。解決辦法是將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個(gè)Large Page Memory都被使用了。
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝您對(duì)億速云的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。