[20170406]查詢佔用記憶體情況.txt

lfree發表於2017-04-06

[20170406]查詢佔用記憶體情況.txt

--//昨天看了連結, buffer cache.
--//google找到如下指令碼:

col component format a32
select min(BASEADDR), max(BASEADDR), count(1) Granules, sum(a.gransize)/1048576 MB, a.GRANFLAGS, component, a.GRANSTATE
from x$ksmge a, x$kmgsct b
where a.grantype = b.grantype (+)
group by a.GRANFLAGS, component, a.GRANSTATE
order by 1,2
/

MIN(BASEADDR)    MAX(BASEADDR)      GRANULES         MB  GRANFLAGS COMPONENT                        GRANSTATE
---------------- ---------------- ---------- ---------- ---------- -------------------------------- ----------------
0000000060C00000 000000007A000000        102        408          4 DEFAULT buffer cache             ALLOC
000000007A400000 000000007A400000          1          4          4 java pool                        ALLOC
000000007A800000 000000007B000000          3         12          4 large pool                       ALLOC
000000007B400000 0000000085C00000         43        172          4 shared pool                      ALLOC

--//註上面的MAX(BASEADDR)不是某種型別的邊界,而是最大的BASEADDR ,在加上gransize才是邊界,
--//看COMPONENT='java pool',那行就很容易理解.

--//gransize=4*1024*1024=4194304
--//4194304 = 0x400000
--//0x7A400000+0x400000= 0x7A800000.

SYS@book> select GRANTYPE,COMPONENT from x$kmgsct;
  GRANTYPE COMPONENT
---------- --------------------------------
         1 shared pool
         2 large pool
         3 java pool
         4 streams pool
         5 SGA Target
         7 DEFAULT buffer cache
         8 KEEP buffer cache
         9 RECYCLE buffer cache
        10 DEFAULT 2K buffer cache
        11 DEFAULT 4K buffer cache
        12 DEFAULT 8K buffer cache
        13 DEFAULT 16K buffer cache
        14 DEFAULT 32K buffer cache
        15 Shared IO Pool
        16 PGA Target
        17 ASM Buffer Cache
16 rows selected.

--//按照上面的例子很容易自己寫一個:
select a.BASEADDR, a.gransize, a.GRANFLAGS, b.component, a.GRANSTATE
from x$ksmge a, x$kmgsct b
where a.grantype = b.grantype (+)
order by 1,2
/

--//另外注意這些記憶體不一定是連續的,如果你使用自動記憶體管理就會出現.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2136689/,如需轉載,請註明出處,否則將追究法律責任。

相關文章