日期:2013-08-19  浏览次数:20483 次


Oracle进程内存结构-如何察看Oracle进程耗费的内存

Last Updated: Sunday, 2004-11-28 11:12 Eygle
    
 
 

经常有人问到如何在Unix下确定进程耗费的内存资源,以及为何Top工具的显示非常高。
有人说Top的输出不精确,这种说法是不确切的。实际上是Top输出显示的Oracle进程内存使用,包含了SGA部分。这也是SGA的意义所在。
SGA可以被共享,可以被所有进程所访问,在进程的寻址空间里就包含了SGA的大小。

至于如何更为精确的确定进程的内存耗费,本文简要引见如下(在QuickIO下,你可能无法看到本文描述情况):


1.系统平台及数据库版本

$ uname -aSunOS billing 5.8 Generic_108528-23 sun4u sparc SUNW,Ultra-4Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001$ sqlplus "/ as sysdba"SQL*Plus: Release 9.2.0.4.0 - Production on Sun Nov 28 10:48:00 2004Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.Connected to:Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.4.0 - ProductionSQL> select * from v$version;BANNER----------------------------------------------------------------Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit ProductionPL/SQL Release 9.2.0.4.0 - ProductionCORE 9.2.0.3.0 ProductionTNS for Solaris: Version 9.2.0.4.0 - ProductionNLSRTL Version 9.2.0.4.0 - ProductionSQL> show sgaTotal System Global Area 253200688 bytesFixed Size 731440 bytesVariable Size 167772160 bytesDatabase Buffers 83886080 bytesRedo Buffers 811008 bytesSQL> exitDisconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit ProductionWith the Partitioning, OLAP and Oracle Data Mining optionsJServer Release 9.2.0.4.0 - Production

 

2.Top输出

 

$ topload averages: 0.12, 0.05, 0.04 billing 10:49:5254 processes: 52 sleeping, 1 stopped, 1 on cpuCPU states: 99.3% idle, 0.0% user, 0.3% kernel, 0.4% iowait, 0.0% swapMemory: 2.0G real, 1.2G free, 404M swap in use, 5.1G swap free PID USERNAME THR PR NCE SIZE RES STATE TIME FLTS CPU COMMAND 10027 oracle 1 58 0 2568K 1680K cpu03 0:00 0 0.09% top 10052 oracle 1 58 0 322M 275M sleep 21:18 0 0.01% oracle 11264 oracle 22 58 0 329M 275M sleep 59:01 0 0.00% oracle 10056 oracle 1 58 0 322M 275M sleep 3:04 0 0.00% oracle 11262 oracle 14 58 0 331M 270M sleep 73:55 0 0.00% oracle 11260 oracle 258 59 0 333M 274M sleep 52:46 0 0.00% oracle 11266 oracle 1 58 0 325M 276M sleep 26:50 0 0.00% oracle 10054 oracle 1 59 0 322M 275M sleep 18:27 0 0.00% oracle 23519 oracle 1 55 0 322M 278M sleep 0:50 0 0.00% oracle 11258 oracle 1 59 0 323M 271M sleep 0:31 0 0.00% oracle 11285 oracle 1 58 0 17.3M 3848K sleep 0:20 0 0.00% tnslsnr 11270 oracle 1 58 0 322M 271M sleep 0:06 0 0.00% oracle 2990 oracle 1 59 0 322M 276M sleep 0:04 0 0.00% oracle 9872 oracle 1 48 0 1880K 1192K sleep 0:00 0 0.00% ksh 23498 oracle 1 58 0 323M 278M sleep 0:00 0 0.00% oracle

 

3.Pmap输出及进程内存计算

 

$ ps -ef|grep ora_ oracle 9881 9872 0 10:49:57 pts/2 0:00 grep ora_ oracle 11258 1 0 Jul 19 ? 0:31 ora_pmon_hsbill oracle 11260 1 0 Jul 19 ? 52:47 ora_dbw0_hsbill oracle 11262 1 0 Jul 19 ? 73:55 ora_lgwr_hsbill oracle 11264 1 0 Jul 19 ? 59:01 ora_ckpt_hsbill oracle 11266 1 0 Jul 19 ? 26:50 ora_smon_hsbill oracle 11268 1 0 Jul 19 ? 0:00 ora_reco_hsbill oracle 11270 1 0 Jul 19 ? 0:06 ora_cjq0_hsbill oracle 10054 1 0 Nov 02 ? 18:27 ora_j001_hsbill oracle 10052 1 0 Nov 02 ? 21:19 ora_j000_hsbill oracle 2990 1 0 Nov 25 ? 0:05 ora_j003_hsbill oracle 10056 1 0 Nov 02 ? 3:04 ora_j002_hsbill oracle 8879 1 0 09:54:32 ? 0:00 ora_j004_hsbill$ pmap 1126411264: ora_ckpt_hsbill000