如何查看系统进程占用内存 如何察看Oracle进程消耗的内存
如何察看Oracle进程消耗的内存
经常有人问到如何在Unix下确定进程消耗的内存资源 以及为何Top工具的显示非常高 有人说Top的输出不精确 这种说法是不确切的 实际上是Top输出显示的Oracle进程内存使用 包含了SGA部分 这也是SGA的意义所在 SGA可以被共享 可以被所有进程所访问 在进程的寻址空间里就包含了SGA的大小
至于如何更为精确的确定进程的内存消耗 本文简要介绍如下(在QuickIO下 你可能无法看到本文描述情况)
系统平台及数据库版本
$ uname aSunOS billing Generic_ sun u sparc SUNW Ultra
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:Oracle i Enterprise Edition Release bit ProductionWith the Partitioning OLAP and Oracle Data Mining optionsJServer Release Production
SQL> select * from v$version;
BANNER Oracle i Enterprise Edition Release bit ProductionPL/SQL Release ProductionCORE ProductionTNS for Solaris: Version ProductionNLSRTL Version Production
SQL> show sga
Total System Global Area bytesFixed Size bytesVariable Size bytesDatabase Buffers bytesRedo Buffers bytesSQL> exitDisconnected from Oracle i Enterprise Edition Release bit ProductionWith the Partitioning OLAP and Oracle Data Mining optionsJServer Release Production
Top输出
$ top
load averages: billing : : processes: sleeping stopped on cpuCPU states: % idle % user % kernel % iowait % swapMemory: G real G free M swap in use G swap free
PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU MAND oracle K K cpu : % top oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M M sleep : % oracle oracle M K sleep : % tnslsnr oracle M M sleep : % oracle oracle M M sleep : % oracle oracle K K sleep : % ksh oracle M 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 ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C A K read/write/exec [ anon ]FFFFFFFF C C K read/write/exec [ anon ]FFFFFFFF C E K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C A K read/write/exec [ anon ]FFFFFFFF C B K read/write/exec [ anon ]FFFFFFFF C C K read/write/exec [ anon ]FFFFFFFF C D K read/write/exec [ anon ]FFFFFFFF C DA K read/write/exec [ anon ]FFFFFFFF C E K read/write/exec [ anon ]FFFFFFFF C EC K read/write/exec [ anon ]FFFFFFFF C FA K read/write/exec [ anon ]FFFFFFFF C FE K read/write/exec [ anon ]FFFFFFFF C C K read/write/exec [ anon ]FFFFFFFF C K read/write/exec [ anon ]FFFFFFFF C E K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA A K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA C K read/write/exec [ anon ]FFFFFFFF CA A K read/write/exec [ anon ]FFFFFFFF CA E K read/write/exec [ anon ]FFFFFFFF CA C K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CA E K read/write/exec [ anon ]FFFFFFFF CA K read/write/exec [ anon ]FFFFFFFF CAA K read/write/exec [ anon ]FFFFFFFF CAA K read/write/exec [ anon ]FFFFFFFF CAB K read/write/exec [ anon ]FFFFFFFF CAB K read/write/exec [ anon ]FFFFFFFF CAC K read/write/exec [ anon ]FFFFFFFF CAC K read/write/exec [ anon ]FFFFFFFF CAD K read/write/exec [ anon ]FFFFFFFF CADA K read/write/exec [ anon ]FFFFFFFF CAE K read/write/exec [ anon ]FFFFFFFF CAEC K read/write/exec [ anon ]FFFFFFFF CAFA K read/write/exec [ anon ]FFFFFFFF CAFE K read/write/exec [ anon ]FFFFFFFF CB C K read/write/exec [ anon ]FFFFFFFF CB K read/write/exec [ anon ]FFFFFFFF CB E K read/write/exec [ anon ]FFFFFFFF CC K read/write/exec [ anon ]FFFFFFFF CD K read/exec /usr/lib/sparcv /nss_files so FFFFFFFF CE K read/write/exec /usr/lib/sparcv /nss_files so FFFFFFFF CF K read/write [ anon ]FFFFFFFF CF K read/write [ anon ]FFFFFFFF CF K read/write [ anon ]FFFFFFFF CF K read/write [ anon ]FFFFFFFF CF K read/write [ anon ]FFFFFFFF D K read/exec /usr/platform/sun u/lib/sparcv /libc_psr so FFFFFFFF D K read/exec /usr/lib/sparcv /libmp so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libmp so FFFFFFFF D K read/write/exec [ anon ]FFFFFFFF D K read/exec /usr/lib/sparcv /libm so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libm so FFFFFFFF D K read/exec /usr/lib/sparcv /libkstat so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libkstat so FFFFFFFF D K read/exec /usr/lib/sparcv /librt so FFFFFFFF D K read/write/exec /usr/lib/sparcv /librt so FFFFFFFF DA K read/exec /usr/lib/sparcv /libaio so FFFFFFFF DB K read/write/exec /usr/lib/sparcv /libaio so FFFFFFFF DC K read/exec /usr/lib/sparcv /libc so FFFFFFFF DDB K read/write/exec /usr/lib/sparcv /libc so FFFFFFFF DDC K read/write/exec /usr/lib/sparcv /libc so FFFFFFFF DF K read/write/exec [ anon ]FFFFFFFF E K read/exec /usr/lib/sparcv /libgen so FFFFFFFF E K read/write/exec /usr/lib/sparcv /libgen so FFFFFFFF E K read/exec /usr/lib/sparcv /libnsl so FFFFFFFF E A K read/write/exec /usr/lib/sparcv /libnsl so FFFFFFFF E B K read/write/exec /usr/lib/sparcv /libnsl so FFFFFFFF E K read/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EA K read/write/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EA K read/write/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EB K read/exec /usr/lib/sparcv /libsocket so FFFFFFFF EC E K read/write/exec /usr/lib/sparcv /libsocket so FFFFFFFF ED K read/write/exec [ anon ]FFFFFFFF EE K read/exec /opt/oracle/product/ /lib/libskgxn soFFFFFFFF EF K read/write/exec /opt/oracle/product/ /lib/libskgxn soFFFFFFFF F K read/exec /opt/oracle/product/ /lib/libskgxp soFFFFFFFF F K read/write/exec /opt/oracle/product/ /lib/libskgxp soFFFFFFFF F K read/exec /opt/oracle/product/ /lib/libodmd soFFFFFFFF F K read/write/exec /opt/oracle/product/ /lib/libodmd soFFFFFFFF F K read/exec /usr/lib/sparcv /libdl so FFFFFFFF F K read/write/exec [ anon ]FFFFFFFF F K read/exec /usr/lib/sparcv /ld so FFFFFFFF F K read/write/exec /usr/lib/sparcv /ld so FFFFFFFF FFFA 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 ]FFFFFFFF CC K read/write [ anon ]FFFFFFFF CC K read/write [ anon ]FFFFFFFF CC K read/write [ anon ]FFFFFFFF CC K read/write [ anon ]FFFFFFFF CD K read/write/exec [ anon ]FFFFFFFF CE K read/exec /usr/lib/sparcv /nss_files so FFFFFFFF CF K read/write/exec /usr/lib/sparcv /nss_files so FFFFFFFF D K read/exec /usr/platform/sun u/lib/sparcv /libc_psr so FFFFFFFF D K read/exec /usr/lib/sparcv /libmp so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libmp so FFFFFFFF D K read/write/exec [ anon ]FFFFFFFF D K read/exec /usr/lib/sparcv /libm so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libm so FFFFFFFF D K read/exec /usr/lib/sparcv /libkstat so FFFFFFFF D K read/write/exec /usr/lib/sparcv /libkstat so FFFFFFFF D K read/exec /usr/lib/sparcv /librt so FFFFFFFF D K read/write/exec /usr/lib/sparcv /librt so FFFFFFFF DA K read/exec /usr/lib/sparcv /libaio so FFFFFFFF DB K read/write/exec /usr/lib/sparcv /libaio so FFFFFFFF DC K read/exec /usr/lib/sparcv /libc so FFFFFFFF DDB K read/write/exec /usr/lib/sparcv /libc so FFFFFFFF DDC K read/write/exec /usr/lib/sparcv /libc so FFFFFFFF DF K read/write/exec [ anon ]FFFFFFFF E K read/exec /usr/lib/sparcv /libgen so FFFFFFFF E K read/write/exec /usr/lib/sparcv /libgen so FFFFFFFF E K read/exec /usr/lib/sparcv /libnsl so FFFFFFFF E A K read/write/exec /usr/lib/sparcv /libnsl so FFFFFFFF E B K read/write/exec /usr/lib/sparcv /libnsl so FFFFFFFF E K read/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EA K read/write/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EA K read/write/exec /opt/oracle/product/ /lib/libjox soFFFFFFFF EB K read/exec /usr/lib/sparcv /libsocket so FFFFFFFF EC E K read/write/exec /usr/lib/sparcv /libsocket so FFFFFFFF ED K read/write/exec [ anon ]FFFFFFFF EE K read/exec /opt/oracle/product/ /lib/libskgxn soFFFFFFFF EF K read/write/exec /opt/oracle/product/ /lib/libskgxn soFFFFFFFF F K read/exec /opt/oracle/product/ /lib/libskgxp soFFFFFFFF F K read/write/exec /opt/oracle/product/ /lib/libskgxp soFFFFFFFF F K read/exec /opt/oracle/product/ /lib/libodmd soFFFFFFFF F K read/write/exec /opt/oracle/product/ /lib/libodmd soFFFFFFFF F K read/exec /usr/lib/sparcv /libdl so FFFFFFFF F K read/write/exec [ anon ]FFFFFFFF F K read/exec /usr/lib/sparcv /ld so FFFFFFFF F K read/write/exec /usr/lib/sparcv /ld so FFFFFFFF FFF K read/write [ stack ] total K$
lishixinzhi/Article/program/Oracle/201311/17228