Ash Buffer是SGA里的一塊循環(huán)使用的內(nèi)存區(qū)域,用于存放MMON捕捉到的active session信息,MMNL每隔60min將Ash buffer的內(nèi)容經(jīng)過(guò)過(guò)
Ash Buffer是SGA里的一塊循環(huán)使用的內(nèi)存區(qū)域,用于存放MMON捕捉到的active session信息,MMNL每隔60min將Ash buffer的內(nèi)容經(jīng)過(guò)過(guò)濾后dump到AWR,對(duì)應(yīng)的視圖是DBA_HIST_ACTIVE_SESS_HISTORY,以騰出Ash buffer空間用于之后的采集。Ash Buffer的大小在instance啟動(dòng)時(shí)就已經(jīng)決定了,并且在instance運(yùn)行期間不能被動(dòng)態(tài)調(diào)整,那么Ash Buffer的大小是由哪些因素決定的?
關(guān)于ASH buffer的大小MOS 243132.1上有如下描述
Size of ASH Circular Buffer = Max [Min [ #CPUs * 2 MB, 5% of Shared Pool Size, 30MB ], 1MB ]
###看下實(shí)際環(huán)境里和ash buffer有關(guān)的參數(shù)
SQL> show parameter cpu_count
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer 16
SQL> show parameter shared_pool_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size big integer 1312M
---計(jì)算一下ash buffer應(yīng)該為多少大小
Max [Min [ 16 * 2 MB, 5%*1312M, 30MB ], 1MB ]=30MB
---實(shí)際Ash buffer大小可以從v$sgastat、v$ash_info獲得,均為32MB,和公式提供的稍有差別,選擇32MB作為Ash Buffer
select * from v$sgastat where;
POOL NAME BYTES
------------ -------------------------- ----------
shared pool ASH buffers 33554432
select total_size,fixed_size,sampling_interval from v$ash_info;
TOTAL_SIZE FIXED_SIZE SAMPLING_INTERVAL
---------- ---------- -----------------
33554432 33554432 1000
###更改一下cpu_count
alter system set cpu_count=8 scope=spfile;
startup force
show parameter cpu_count
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer 8
---按照公式Size of ASH Circular Buffer = Max [Min [ #CPUs * 2 MB, 5% of Shared Pool Size, 30MB ], 1MB ]計(jì)算
Ash buffer=Max [Min [ 8 * 2 MB, 5%*1312M, 30MB ], 1MB ]=16MB
---下面的查詢(xún)結(jié)果應(yīng)驗(yàn)了上面的計(jì)算
select total_size,fixed_size,sampling_interval from v$ash_info;
TOTAL_SIZE FIXED_SIZE SAMPLING_INTERVAL
---------- ---------- -----------------
16777216 16777216 1000
select * from v$sgastat where;
POOL NAME BYTES
------------ -------------------------- ----------
shared pool ASH buffers 16777216
###"_ash_size"隱含參數(shù)控制ash buffer的大小
公式Size of ASH Circular Buffer = Max [Min [ #CPUs * 2 MB, 5% of Shared Pool Size, 30MB ], 1MB ]里的1MB是_ash_size的默認(rèn)值
---_ash_size的默認(rèn)值為1MB
select ksppinm,ksppstvl from x$ksppi x, x$ksppcv y where (x.indx = y.indx) and ksppinm like '_ash_size%'
KSPPINM KSPPSTVL
------------------------------ ------------------------------
_ash_size 1048618
---我們把_ash_size改大,改成64MB
alter system set "_ash_size"=67108864 scope=spfile;
startup force
---計(jì)算一下此時(shí)的Ash buffer值
ASH Circular Buffer = Max [Min [ 8 * 2 MB, 5%*1315M, 30MB ], 64MB ]=64MB
---下面的查詢(xún)結(jié)果應(yīng)驗(yàn)了上面的計(jì)算
SQL> select total_size,fixed_size,sampling_interval from v$ash_info;
TOTAL_SIZE FIXED_SIZE SAMPLING_INTERVAL
---------- ---------- -----------------
67108864 67108864 1000
SQL> select * from v$sgastat where;
POOL NAME BYTES
------------ -------------------------- ----------
shared pool ASH buffers 67108864
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com