熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

如何察看Oracle進程消耗的內存

2022-06-13   來源: Oracle 

  經常有人問到如何在Unix下確定進程消耗的內存資源以及為何Top工具的顯示非常高
有人說Top的輸出不精確這種說法是不確切的實際上是Top輸出顯示的Oracle進程內存使用包含了SGA部分這也是SGA的意義所在
SGA可以被共享可以被所有進程所訪問在進程的尋址空間裡就包含了SGA的大小

  至於如何更為精確的確定進程的內存消耗本文簡要介紹如下(在QuickIO下你可能無法看到本文描述情況)

  系統平台及數據庫版本

  $ uname a
SunOS billing Generic_ sunu sparc SUNWUltra

  Sun Microsystems Inc   SunOS        Generic Patch   October
$ sqlplus / as sysdba

  SQL*Plus: Release Production on Sun Nov ::

  Copyright (c) Oracle Corporation  All rights reserved

  Connected to:
Oraclei Enterprise Edition Release bit Production
With the Partitioning OLAP and Oracle Data Mining options
JServer Release Production

  SQL> select * from v$version;

  BANNER

Oraclei Enterprise Edition Release bit Production
PL/SQL Release Production
CORE           Production
TNS for Solaris: Version Production
NLSRTL Version Production

  SQL> show sga

  Total System Global Area  bytes
Fixed Size                   bytes
Variable Size             bytes
Database Buffers           bytes
Redo Buffers                 bytes
SQL> exit
Disconnected from Oraclei Enterprise Edition Release bit Production
With the Partitioning OLAP and Oracle Data Mining options
JServer Release Production                     

  Top輸出

  $ top

  load averages:               billing                ::
processes:  sleeping stopped on cpu
CPU states: % idle  % user  % kernel  % iowait  % swap
Memory: G real G free M swap in use G swap free

  PID USERNAME THR PR NCE  SIZE   RES STATE   TIME FLTS    CPU COMMAND
  oracle        K K cpu   :      % top
  oracle          M sleep  :      % oracle
  oracle     M M sleep  :   % oracle
  oracle          M sleep   :      % oracle
  oracle         M sleep  :      % oracle
  oracle        M sleep  :      % oracle
  oracle          M sleep  :      % oracle
  oracle          M sleep  :      % oracle
  oracle          M sleep   :      % oracle
  oracle          M sleep   :      % oracle
  oracle        M K sleep   :      % tnslsnr
  oracle          M sleep   :      % oracle
  oracle          M sleep   :      % oracle
  oracle        K K sleep   :      % ksh
  oracle          M sleep   :      % oracle

  
 

  Pmap輸出及進程內存計算

  $ ps ef|grep ora_
  oracle      :: pts/    : grep ora_
  oracle           Jul ?        : ora_pmon_hsbill
  oracle           Jul ?       : ora_dbw_hsbill
  oracle           Jul ?       : ora_lgwr_hsbill
  oracle           Jul ?       : ora_ckpt_hsbill
  oracle           Jul ?       : ora_smon_hsbill
  oracle           Jul ?        : ora_reco_hsbill
  oracle           Jul ?        : ora_cjq_hsbill
  oracle           Nov ?       : ora_j_hsbill
  oracle           Nov ?       : ora_j_hsbill
  oracle            Nov ?        : ora_j_hsbill
  oracle           Nov ?        : ora_j_hsbill
  oracle         :: ?        : ora_j_hsbill

  $ pmap
:  ora_ckpt_hsbill
  K read/exec         /opt/oracle/product//bin/oracle
E    K read/write/exec   /opt/oracle/product//bin/oracle
   K read/write/exec     [ heap ]
K read/write/exec/shared  [ ism shmid=x ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCC      K read/write/exec     [ anon ]
FFFFFFFFCE      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCB      K read/write/exec     [ anon ]
FFFFFFFFCC      K read/write/exec     [ anon ]
FFFFFFFFCD      K read/write/exec     [ anon ]
FFFFFFFFCDA      K read/write/exec     [ anon ]
FFFFFFFFCE      K read/write/exec     [ anon ]
FFFFFFFFCEC      K read/write/exec     [ anon ]
FFFFFFFFCFA      K read/write/exec     [ anon ]
FFFFFFFFCFE      K read/write/exec     [ anon ]
FFFFFFFFCC      K read/write/exec     [ anon ]
FFFFFFFFC      K read/write/exec     [ anon ]
FFFFFFFFCE      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCAA      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCAC      K read/write/exec     [ anon ]
FFFFFFFFCAA      K read/write/exec     [ anon ]
FFFFFFFFCAE      K read/write/exec     [ anon ]
FFFFFFFFCAC      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCAE      K read/write/exec     [ anon ]
FFFFFFFFCA      K read/write/exec     [ anon ]
FFFFFFFFCAA      K read/write/exec     [ anon ]
FFFFFFFFCAA      K read/write/exec     [ anon ]
FFFFFFFFCAB      K read/write/exec     [ anon ]
FFFFFFFFCAB      K read/write/exec     [ anon ]
FFFFFFFFCAC      K read/write/exec     [ anon ]
FFFFFFFFCAC      K read/write/exec     [ anon ]
FFFFFFFFCAD      K read/write/exec     [ anon ]
FFFFFFFFCADA      K read/write/exec     [ anon ]
FFFFFFFFCAE      K read/write/exec     [ anon ]
FFFFFFFFCAEC      K read/write/exec     [ anon ]
FFFFFFFFCAFA      K read/write/exec     [ anon ]
FFFFFFFFCAFE      K read/write/exec     [ anon ]
FFFFFFFFCBC      K read/write/exec     [ anon ]
FFFFFFFFCB      K read/write/exec     [ anon ]
FFFFFFFFCBE      K read/write/exec     [ anon ]
FFFFFFFFCC      K read/write/exec     [ anon ]
FFFFFFFFCD     K read/exec         /usr/lib/sparcv/nss_filesso
FFFFFFFFCE      K read/write/exec   /usr/lib/sparcv/nss_filesso
FFFFFFFFCF      K read/write          [ anon ]
FFFFFFFFCF      K read/write          [ anon ]
FFFFFFFFCF      K read/write          [ anon ]
FFFFFFFFCF     K read/write          [ anon ]
FFFFFFFFCF     K read/write          [ anon ]
FFFFFFFFD     K read/exec         /usr/platform/sunu/lib/sparcv/libc_psrso
FFFFFFFFD     K read/exec         /usr/lib/sparcv/libmpso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libmpso
FFFFFFFFD      K read/write/exec     [ anon ]
FFFFFFFFD     K read/exec         /usr/lib/sparcv/libmso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libmso
FFFFFFFFD      K read/exec         /usr/lib/sparcv/libkstatso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libkstatso
FFFFFFFFD     K read/exec         /usr/lib/sparcv/librtso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/librtso
FFFFFFFFDA     K read/exec         /usr/lib/sparcv/libaioso
FFFFFFFFDB      K read/write/exec   /usr/lib/sparcv/libaioso
FFFFFFFFDC    K read/exec         /usr/lib/sparcv/libcso
FFFFFFFFDDB     K read/write/exec   /usr/lib/sparcv/libcso
FFFFFFFFDDC      K read/write/exec   /usr/lib/sparcv/libcso
FFFFFFFFDF      K read/write/exec     [ anon ]
FFFFFFFFE     K read/exec         /usr/lib/sparcv/libgenso
FFFFFFFFE      K read/write/exec   /usr/lib/sparcv/libgenso
FFFFFFFFE    K read/exec         /usr/lib/sparcv/libnslso
FFFFFFFFEA     K read/write/exec   /usr/lib/sparcv/libnslso
FFFFFFFFEB     K read/write/exec   /usr/lib/sparcv/libnslso
FFFFFFFFE   K read/exec         /opt/oracle/product//lib/libjoxso
FFFFFFFFEA    K read/write/exec   /opt/oracle/product//lib/libjoxso
FFFFFFFFEA      K read/write/exec   /opt/oracle/product//lib/libjoxso
FFFFFFFFEB     K read/exec         /usr/lib/sparcv/libsocketso
FFFFFFFFECE     K read/write/exec   /usr/lib/sparcv/libsocketso
FFFFFFFFED      K read/write/exec     [ anon ]
FFFFFFFFEE     K read/exec         /opt/oracle/product//lib/libskgxnso
FFFFFFFFEF      K read/write/exec   /opt/oracle/product//lib/libskgxnso
FFFFFFFFF      K read/exec         /opt/oracle/product//lib/libskgxpso
FFFFFFFFF      K read/write/exec   /opt/oracle/product//lib/libskgxpso
FFFFFFFFF      K read/exec         /opt/oracle/product//lib/libodmdso
FFFFFFFFF      K read/write/exec   /opt/oracle/product//lib/libodmdso
FFFFFFFFF      K read/exec         /usr/lib/sparcv/libdlso
FFFFFFFFF      K read/write/exec     [ anon ]
FFFFFFFFF    K read/exec         /usr/lib/sparcv/ldso
FFFFFFFFF     K read/write/exec   /usr/lib/sparcv/ldso
FFFFFFFFFFFA     K read/write          [ stack ]
         total   K
$       
 

  計算後台進程使用的內存資源:

  K K = k

  這就是一個進程所消耗的內存

  用戶進程內存使用舉例

  $ ps ef|grep LOCAL
  oracle     :: pts/    : grep LOCAL
  oracle           Nov ?        : oraclehsbill (LOCAL=NO)
  oracle           Nov ?        : oraclehsbill (LOCAL=NO)
$ pmap
:  oraclehsbill (LOCAL=NO)
  K read/exec         /opt/oracle/product//bin/oracle
E    K read/write/exec   /opt/oracle/product//bin/oracle
    K read/write/exec     [ heap ]
K read/write/exec/shared  [ ism shmid=x ]
FFFFFFFFCC      K read/write          [ anon ]
FFFFFFFFCC      K read/write          [ anon ]
FFFFFFFFCC    K read/write          [ anon ]
FFFFFFFFCC     K read/write          [ anon ]
FFFFFFFFCD      K read/write/exec     [ anon ]
FFFFFFFFCE     K read/exec         /usr/lib/sparcv/nss_filesso
FFFFFFFFCF      K read/write/exec   /usr/lib/sparcv/nss_filesso
FFFFFFFFD     K read/exec         /usr/platform/sunu/lib/sparcv/libc_psrso
FFFFFFFFD     K read/exec         /usr/lib/sparcv/libmpso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libmpso
FFFFFFFFD      K read/write/exec     [ anon ]
FFFFFFFFD     K read/exec         /usr/lib/sparcv/libmso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libmso
FFFFFFFFD      K read/exec         /usr/lib/sparcv/libkstatso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/libkstatso
FFFFFFFFD     K read/exec         /usr/lib/sparcv/librtso
FFFFFFFFD      K read/write/exec   /usr/lib/sparcv/librtso
FFFFFFFFDA     K read/exec         /usr/lib/sparcv/libaioso
FFFFFFFFDB      K read/write/exec   /usr/lib/sparcv/libaioso
FFFFFFFFDC    K read/exec         /usr/lib/sparcv/libcso
FFFFFFFFDDB     K read/write/exec   /usr/lib/sparcv/libcso
FFFFFFFFDDC      K read/write/exec   /usr/lib/sparcv/libcso
FFFFFFFFDF      K read/write/exec     [ anon ]
FFFFFFFFE     K read/exec         /usr/lib/sparcv/libgenso
FFFFFFFFE      K read/write/exec   /usr/lib/sparcv/libgenso
FFFFFFFFE    K read/exec         /usr/lib/sparcv/libnslso
FFFFFFFFEA     K read/write/exec   /usr/lib/sparcv/libnslso
FFFFFFFFEB     K read/write/exec   /usr/lib/sparcv/libnslso
FFFFFFFFE   K read/exec         /opt/oracle/product//lib/libjoxso
FFFFFFFFEA    K read/write/exec   /opt/oracle/product//lib/libjoxso
FFFFFFFFEA      K read/write/exec   /opt/oracle/product//lib/libjoxso
FFFFFFFFEB     K read/exec         /usr/lib/sparcv/libsocketso
FFFFFFFFECE     K read/write/exec   /usr/lib/sparcv/libsocketso
FFFFFFFFED      K read/write/exec     [ anon ]
FFFFFFFFEE     K read/exec         /opt/oracle/product//lib/libskgxnso
FFFFFFFFEF      K read/write/exec   /opt/oracle/product//lib/libskgxnso
FFFFFFFFF      K read/exec         /opt/oracle/product//lib/libskgxpso
FFFFFFFFF      K read/write/exec   /opt/oracle/product//lib/libskgxpso
FFFFFFFFF      K read/exec         /opt/oracle/product//lib/libodmdso
FFFFFFFFF      K read/write/exec   /opt/oracle/product//lib/libodmdso
FFFFFFFFF      K read/exec         /usr/lib/sparcv/libdlso
FFFFFFFFF      K read/write/exec     [ anon ]
FFFFFFFFF    K read/exec         /usr/lib/sparcv/ldso
FFFFFFFFF     K read/write/exec   /usr/lib/sparcv/ldso
FFFFFFFFFFF     K read/write          [ stack ]
         total   K
$       
 

  從PMAP的輸出中我們可以看到進程所調用的庫文件等及其讀寫狀態


From:http://tw.wingwit.com/Article/program/Oracle/201311/17228.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.