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

oracle|进程

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_hsbill0000000100000000 53824K read/exec /opt/oracle/product/9.2.0/bin/oracle000000010358E000 872K read/write/exec /opt/oracle/product/9.2.0/bin/oracle0000000103668000 7968K read/write/exec [ heap ]0000000380000000 266240K read/write/exec/shared [ ism shmid=0x64 ]FFFFFFFF7C802000 8K read/write/exec [ anon ]FFFFFFFF7C814000 8K read/write/exec [ anon ]FFFFFFFF7C826000 8K read/write/exec [ anon ]FFFFFFFF7C838000 8K read/write/exec [ anon ]FFFFFFFF7C84A000 8K read/write/exec [ anon ]FFFFFFFF7C85C000 8K read/write/exec [ anon ]FFFFFFFF7C86E000 8K read/write/exec [ anon ]FFFFFFFF7C880000 8K read/write/exec [ anon ]FFFFFFFF7C892000 8K read/write/exec [ anon ]FFFFFFFF7C8A4000 8K read/write/exec [ anon ]FFFFFFFF7C8B6000 8K read/write/exec [ anon ]FFFFFFFF7C8C8000 8K read/write/exec [ anon ]FFFFFFFF7C8D6000 8K read/write/exec [ anon ]FFFFFFFF7C8DA000 8K read/write/exec [ anon ]FFFFFFFF7C8E8000 8K read/write/exec [ anon ]FFFFFFFF7C8EC000 8K read/write/exec [ anon ]FFFFFFFF7C8FA000 8K read/write/exec [ anon ]FFFFFFFF7C8FE000 8K read/write/exec [ anon ]FFFFFFFF7C90C000 8K read/write/exec [ anon ]FFFFFFFF7C910000 8K read/write/exec [ anon ]FFFFFFFF7C91E000 8K read/write/exec [ anon ]FFFFFFFF7CA02000 8K read/write/exec [ anon ]FFFFFFFF7CA10000 8K read/write/exec [ anon ]FFFFFFFF7CA14000 8K read/write/exec [ anon ]FFFFFFFF7CA22000 8K read/write/exec [ anon ]FFFFFFFF7CA26000 8K read/write/exec [ anon ]FFFFFFFF7CA34000 8K read/write/exec [ anon ]FFFFFFFF7CA38000 8K read/write/exec [ anon ]FFFFFFFF7CA46000 8K read/write/exec [ anon ]FFFFFFFF7CA4A000 8K read/write/exec [ anon ]FFFFFFFF7CA58000 8K read/write/exec [ anon ]FFFFFFFF7CA5C000 8K read/write/exec [ anon ]FFFFFFFF7CA6A000 8K read/write/exec [ anon ]FFFFFFFF7CA6E000 8K read/write/exec [ anon ]FFFFFFFF7CA7C000 8K read/write/exec [ anon ]FFFFFFFF7CA80000 8K read/write/exec [ anon ]FFFFFFFF7CA8E000 8K read/write/exec [ anon ]FFFFFFFF7CA92000 8K read/write/exec [ anon ]FFFFFFFF7CAA0000 8K read/write/exec [ anon ]FFFFFFFF7CAA4000 8K read/write/exec [ anon ]FFFFFFFF7CAB2000 8K read/write/exec [ anon ]FFFFFFFF7CAB6000 8K read/write/exec [ anon ]FFFFFFFF7CAC4000 8K read/write/exec [ anon ]FFFFFFFF7CAC8000 8K read/write/exec [ anon ]FFFFFFFF7CAD6000 8K read/write/exec [ anon ]FFFFFFFF7CADA000 8K read/write/exec [ anon ]FFFFFFFF7CAE8000 8K read/write/exec [ anon ]FFFFFFFF7CAEC000 8K read/write/exec [ anon ]FFFFFFFF7CAFA000 8K read/write/exec [ anon ]FFFFFFFF7CAFE000 8K read/write/exec [ anon ]FFFFFFFF7CB0C000 8K read/write/exec [ anon ]FFFFFFFF7CB10000 8K read/write/exec [ anon ]FFFFFFFF7CB1E000 8K read/write/exec [ anon ]FFFFFFFF7CC00000 8K read/write/exec [ anon ]FFFFFFFF7CD00000 24K read/exec /usr/lib/sparcv9/nss_files.so.1FFFFFFFF7CE06000 8K read/write/exec /usr/lib/sparcv9/nss_files.so.1FFFFFFFF7CF00000 8K read/write [ anon ]FFFFFFFF7CF10000 8K read/write [ anon ]FFFFFFFF7CF50000 8K read/write [ anon ]FFFFFFFF7CF60000 16K read/write [ anon ]FFFFFFFF7CF68000 32K read/write [ anon ]FFFFFFFF7D000000 16K read/exec /usr/platform/sun4u/lib/sparcv9/libc_psr.so.1FFFFFFFF7D100000 16K read/exec /usr/lib/sparcv9/libmp.so.2FFFFFFFF7D204000 8K read/write/exec /usr/lib/sparcv9/libmp.so.2FFFFFFFF7D300000 8K read/write/exec [ anon ]FFFFFFFF7D400000 88K read/exec /usr/lib/sparcv9/libm.so.1FFFFFFFF7D516000 8K read/write/exec /usr/lib/sparcv9/libm.so.1FFFFFFFF7D600000 8K read/exec /usr/lib/sparcv9/libkstat.so.1FFFFFFFF7D702000 8K read/write/exec /usr/lib/sparcv9/libkstat.so.1FFFFFFFF7D800000 32K read/exec /usr/lib/sparcv9/librt.so.1FFFFFFFF7D908000 8K read/write/exec /usr/lib/sparcv9/librt.so.1FFFFFFFF7DA00000 32K read/exec /usr/lib/sparcv9/libaio.so.1FFFFFFFF7DB08000 8K read/write/exec /usr/lib/sparcv9/libaio.so.1FFFFFFFF7DC00000 720K read/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DDB4000 56K read/write/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DDC2000 8K read/write/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DF00000 8K read/write/exec [ anon ]FFFFFFFF7E000000 32K read/exec /usr/lib/sparcv9/libgen.so.1FFFFFFFF7E108000 8K read/write/exec /usr/lib/sparcv9/libgen.so.1FFFFFFFF7E200000 672K read/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E3A8000 56K read/write/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E3B6000 40K read/write/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E400000 5328K read/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EA32000 384K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EA92000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EB00000 56K read/exec /usr/lib/sparcv9/libsocket.so.1FFFFFFFF7EC0E000 16K read/write/exec /usr/lib/sparcv9/libsocket.so.1FFFFFFFF7ED00000 8K read/write/exec [ anon ]FFFFFFFF7EE00000 32K read/exec /opt/oracle/product/9.2.0/lib/libskgxn9.soFFFFFFFF7EF06000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxn9.soFFFFFFFF7F000000 8K read/exec /opt/oracle/product/9.2.0/lib/libskgxp9.soFFFFFFFF7F100000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxp9.soFFFFFFFF7F200000 8K read/exec /opt/oracle/product/9.2.0/lib/libodmd9.soFFFFFFFF7F300000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libodmd9.soFFFFFFFF7F400000 8K read/exec /usr/lib/sparcv9/libdl.so.1FFFFFFFF7F500000 8K read/write/exec [ anon ]FFFFFFFF7F600000 152K read/exec /usr/lib/sparcv9/ld.so.1FFFFFFFF7F724000 16K read/write/exec /usr/lib/sparcv9/ld.so.1FFFFFFFF7FFFA000 24K read/write [ stack ] total 337360K$

 

计算后台进程使用的内存资源:

337360K - 266240K = 71,120k

这就是一个进程所消耗的内存.

4.用户进程内存使用举例

 

$ ps -ef|grep LOCAL oracle 10080 9872 0 11:00:25 pts/2 0:00 grep LOCAL oracle 23498 1 0 Nov 25 ? 0:00 oraclehsbill (LOCAL=NO) oracle 23519 1 0 Nov 25 ? 0:50 oraclehsbill (LOCAL=NO)$ pmap 2351923519: oraclehsbill (LOCAL=NO)0000000100000000 53824K read/exec /opt/oracle/product/9.2.0/bin/oracle000000010358E000 872K read/write/exec /opt/oracle/product/9.2.0/bin/oracle0000000103668000 848K read/write/exec [ heap ]0000000380000000 266240K read/write/exec/shared [ ism shmid=0x64 ]FFFFFFFF7CC00000 8K read/write [ anon ]FFFFFFFF7CC10000 8K read/write [ anon ]FFFFFFFF7CC50000 136K read/write [ anon ]FFFFFFFF7CC76000 40K read/write [ anon ]FFFFFFFF7CD00000 8K read/write/exec [ anon ]FFFFFFFF7CE00000 24K read/exec /usr/lib/sparcv9/nss_files.so.1FFFFFFFF7CF06000 8K read/write/exec /usr/lib/sparcv9/nss_files.so.1FFFFFFFF7D000000 16K read/exec /usr/platform/sun4u/lib/sparcv9/libc_psr.so.1FFFFFFFF7D100000 16K read/exec /usr/lib/sparcv9/libmp.so.2FFFFFFFF7D204000 8K read/write/exec /usr/lib/sparcv9/libmp.so.2FFFFFFFF7D300000 8K read/write/exec [ anon ]FFFFFFFF7D400000 88K read/exec /usr/lib/sparcv9/libm.so.1FFFFFFFF7D516000 8K read/write/exec /usr/lib/sparcv9/libm.so.1FFFFFFFF7D600000 8K read/exec /usr/lib/sparcv9/libkstat.so.1FFFFFFFF7D702000 8K read/write/exec /usr/lib/sparcv9/libkstat.so.1FFFFFFFF7D800000 32K read/exec /usr/lib/sparcv9/librt.so.1FFFFFFFF7D908000 8K read/write/exec /usr/lib/sparcv9/librt.so.1FFFFFFFF7DA00000 32K read/exec /usr/lib/sparcv9/libaio.so.1FFFFFFFF7DB08000 8K read/write/exec /usr/lib/sparcv9/libaio.so.1FFFFFFFF7DC00000 720K read/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DDB4000 56K read/write/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DDC2000 8K read/write/exec /usr/lib/sparcv9/libc.so.1FFFFFFFF7DF00000 8K read/write/exec [ anon ]FFFFFFFF7E000000 32K read/exec /usr/lib/sparcv9/libgen.so.1FFFFFFFF7E108000 8K read/write/exec /usr/lib/sparcv9/libgen.so.1FFFFFFFF7E200000 672K read/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E3A8000 56K read/write/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E3B6000 40K read/write/exec /usr/lib/sparcv9/libnsl.so.1FFFFFFFF7E400000 5328K read/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EA32000 384K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EA92000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.soFFFFFFFF7EB00000 56K read/exec /usr/lib/sparcv9/libsocket.so.1FFFFFFFF7EC0E000 16K read/write/exec /usr/lib/sparcv9/libsocket.so.1FFFFFFFF7ED00000 8K read/write/exec [ anon ]FFFFFFFF7EE00000 32K read/exec /opt/oracle/product/9.2.0/lib/libskgxn9.soFFFFFFFF7EF06000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxn9.soFFFFFFFF7F000000 8K read/exec /opt/oracle/product/9.2.0/lib/libskgxp9.soFFFFFFFF7F100000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxp9.soFFFFFFFF7F200000 8K read/exec /opt/oracle/product/9.2.0/lib/libodmd9.soFFFFFFFF7F300000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libodmd9.soFFFFFFFF7F400000 8K read/exec /usr/lib/sparcv9/libdl.so.1FFFFFFFF7F500000 8K read/write/exec [ anon ]FFFFFFFF7F600000 152K read/exec /usr/lib/sparcv9/ld.so.1FFFFFFFF7F724000 16K read/write/exec /usr/lib/sparcv9/ld.so.1FFFFFFFF7FFF2000 56K read/write [ stack ] total 329968K$

从PMAP的输出中我们可以看到进程所调用的库文件等,及其读写状态。

 

本文作者:
eygle,Oracle技术关注者,来自中国最大的Oracle技术论坛itpub.
www.eygle.com是作者的个人站点.你可通过Guoqiang.Gai@gmail.com来联系作者.欢迎技术探讨交流以及链接交换.

原文出处:

http://www.eygle.com/faq/How.To.Get.Process.Memory.Consume.htm

 

时间: 2025-01-30 22:25:20

Oracle进程内存结构-如何察看Oracle进程消耗的内存的相关文章

Oracle体系结构:内存结构和进程结构

oracle|进程|体系 (一)内存结构和进程结构 Oracle数据库的总体结构如下图:  1:Oracle实例(Instance)           在一个服务器中,每一个运行的Oracle数据库都与一个数据库实例相联系,实例是我们 访问数据库的手段.  实例在操作系统中用ORACLE_SID来标识,在Oracle中用参数INSTANCE_NAME来标识, 它们两个的值是相同的.数据库启动时,系统首先在服务器内存中分配系统全局区(SGA), 构成了Oracle的内存结构,然后启动若干个常驻内

Oracle内存结构详解(一) Oracle SGA简介

Oracle的内存配置与oracle性能息息相关.关于内存的配置,是最影响Oracle性能的配置.内存还直接影响到其他两个重要资源的消耗:CPU和IO. 先看Oracle内存存储的主要内容是什么: 程序代码(PLSQL.Java): 关于已经连接的会话的信息,包括当前所有活动和非活动会话: 程序运行时必须的相关信息,例如查询计划: Oracle进程之间共享的信息和相互交流的信息,例如锁: 那些被永久存储在外围存储介质上,被cache在内存中的数据(如redo log条目,数据块). 每个Orac

jvm系列(二):JVM内存结构

  JVM内存结构   所有的Java开发人员可能会遇到这样的困惑?我该为堆内存设置多大空间呢?OutOfMemoryError的异常到底涉及到运行时数据的哪块区域?该怎么解决呢?其实如果你经常解决服务器性能问题,那么这些问题就会变的非常常见,了解JVM内存也是为了服务器出现性能问题的时候可以快速的了解那块的内存区域出现问题,以便于快速的解决生产故障.   先看一张图,这张图能很清晰的说明JVM内存结构布局. Java的内存结构: JVM内存结构主要有三大块:堆内存.方法区和栈.堆内存是JVM中

concepts阅读总结8——内存结构补充+oracle工具+个别进程

1.内存结构: 关于之前SGA,PGA的介绍我就不多说了,在我的博客里有专门的介绍: http://blog.csdn.net/changyanmanman/article/details/7256255 我们看看各个区域的介绍吧,这是官方的文档,准确性和权威性不言而喻. 2.数据缓存区: 一个新的点,数据缓存区在逻辑上被分成了好几个组,这种分组的内存管理方式减少了多处理器系统中的资源竞争.(共享SQL区也是这样的) 数据缓存区内的缓冲区(buffer)通过两个列表来管理:待写列表(write

Oracle内存结构(一)----SGA的区域信息

oracle SGA的区域信息   SGA(system global area)系统全局区跟一些必须的后台进程合进来称为实例(Instance).说它是全局区是包含了全局变量和数据结构,是系统区是包含了进入整个Oracle Instance的数据结构而不是特定的进程结构.   SGA区域:    SGA大概包括下面四到五种区域: The fixed area The variable area The database blocks area The log buffer The instan

Oracle内存结构(三)----Process Memory的详细信息

oracle The Process Memory: 除了SGA(System Global Area)之外,Oracle进程还使用下面三个全局区: The Process Global Area  (PGA) The User Global Area   (UGA) The Call Global Area   (CGA)   很多人都搞不清楚PGA和UGA两者之间的区别,实际上两者之间的区别跟一个进程和一个会话之间的区别是类似的.尽管说进程和会话之间一般都是一对一的关系,但实际上比这个更复杂

Oracle内存结构详解(六)UGA、CGA及软件代码区

1.UGA (The User Global Area) PGA是一段包含一个Oracle服务或后台进程的数据和控制信息的内存.PGA的大小依赖与系统的配置.在专用服务(Dedicated Server)模式下,一个服务进程与一个用户进程相关,PGA就包括了堆空间和UGA.而UGA(User Global Area用户全局区)由用户会话数据.游标状态和索引区组成.在共享服务(MTS)模式下,一个共享服务进程被多个用户进程共享,此时UGA是Shared Pool或Large Pool的一部分(依赖

Oracle内存结构详解(五) Oracle PGA

PGA(Program Global Area程序全局区)是一块包含一个服务进程的数据和控制信息的内存区域.它是Oracle在一个服务进程启动是创建的,是非共享的.一个Oracle进程拥有一个PGA内存区.一个PGA也只能被拥有它的那个服务进程所访问,只有这个进程中的Oracle代码才能读写它.因此,PGA中的结构是不需要Latch保护的. 我们可以设置所有服务进程的PGA内存总数受到实例分配的总体PGA(Aggregated PGA)限制. 在专有服务器(Dedicated Server)模式

Oracle内存结构详解(三) Oracle管理Share Pool

SGA中的共享池由库缓存(Library Cache).字典缓存(Dictionary Cache).用于并行执行消息的缓冲以及控制结构组成. Shared Pool的大小由参数SHARED_POOL_SIZE决定.9i中,在32位系统下,这个参数的默认值是8M,而64位系统下的默认值位64M.最大为4G. 10g 以后可以通过SGA_TARGET 参数来自动调整. 对于Shared Pool的内存管理,是通过修正过的LRU算法表来实现的. 1.库缓存(Library Cache) Librar