在Oracle中,经常可以在shared pool/wait event看到simulator字样。那么,这些simulator是干什么用的?
Oracle中存在各种advisor,特别是关于内存调整的advisor,实际上是基于simulator工作的
。 下面以library cache(Kernel General Library cache manager)为例,简要说明工作原理。library cache管理library
objects(cursors、cached stored object definitions (PL/SQL stored procs, table
definitions等))。
KGL simulator用于评估library cache增大后对缓存的影响。评估依据是,当library cache object被移出缓存时,该对象的hash值(及相关信息)被记录在KGL simulator
hash table。 当加载一个对象到library cache时,Oracle会根据hash值检查该对象在KGL simulator hash
table中是否存在,如果存在,就表明该对象是因空间压力而被清除。 这样, KGL simulator hash
table就保存了被清除对象的历史信息。基于这些信息,以及重新加载这些对象所耗费时间,就可以评估调整shared pool时,可能会节省多少时间。
尽管这些信息都是采样获取,仍然会可能占有部分内存;同时,为了维护历史信息,需要获取simulator上的latch。在繁忙的系统上,这些都可能被放大,导致系统更加繁忙。
版本:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
相关内存区域:
SQL> SELECT * FROM v$sgastat WHERE lower(NAME) LIKE '%sim%' ORDER BY
2 NAME;
POOL NAME BYTES
------------ -------------------------- ----------
shared pool kglsim count of pinned he 2832
shared pool kglsim free heap list 72
shared pool kglsim free obj list 72
shared pool kglsim hash table 4104
shared pool kglsim hash table bkts 2097152
shared pool kglsim heap 319792
shared pool kglsim main lru count 75520
shared pool kglsim main lru size 151040
shared pool kglsim object batch 388800
shared pool kglsim pin list arr 288
shared pool kglsim recovery area 1320
shared pool kglsim sga 22188
shared pool kglsim size of pinned mem 5664
shared pool ksim client list 84
shared pool log_simultaneous_copies 992
shared pool sim cache nbufs 640
shared pool sim cache sizes 640
shared pool sim kghx free lists 4
shared pool sim lru segments 1280
shared pool sim segment hits 2560
shared pool sim segment num bufs 1280
shared pool sim state object 24
shared pool sim trace buf 5140
shared pool sim trace buf context 120
shared pool sim_knlasg 1200
shared pool simulator hash buckets 131328
shared pool simulator hash latch 6400
shared pool simulator latch/bucket st 3328
28 rows selected
相关latch:
SQL> select name from v$latch where name like '%sim%';
NAME
--------------------------------------------------
sim partition latch
simulator hash latch
simulator lru latch
相关视图:
SQL> SELECT name FROM v$fixed_table WHERE NAME LIKE 'V$%ADVICE';
NAME
------------------------------
V$SHARED_POOL_ADVICE
V$JAVA_POOL_ADVICE
V$STREAMS_POOL_ADVICE
V$PX_BUFFER_ADVICE
V$SGA_TARGET_ADVICE
V$DB_CACHE_ADVICE
V$MTTR_TARGET_ADVICE
V$PGA_TARGET_ADVICE
8 rows selected
相关参数:
SQL> SELECT i.ksppinm || ':' || i.ksppdesc || '=' || v.ksppstvl
2 FROM x$ksppi i, x$ksppcv v
3 WHERE i.indx = v.indx
4 AND i.ksppinm LIKE '%advice%';
I.KSPPINM||':'||I.KSPPDESC||'=
--------------------------------------------------------------------------------
db_cache_advice :Buffer cache sizing advisory =ON
_db_cache_advice_sample_factor:cache advisory sampling factor =4
_db_cache_advice_batch_size :cache advisory simulation batch size =128
_db_mttr_advice :MTTR advisory =ON
_library_cache_advice :whether KGL advice should be turned on =TRUE
_smm_advice_log_size :overwrites default size of the PGA advice workarea history
_smm_advice_enabled :if TRUE, enable v$pga_advice=TRUE
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/18922393/viewspace-713301/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/18922393/viewspace-713301/