分享
 
 
 

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

王朝oracle·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

经常有人问到如何在Unix下确定进程消耗的内存资源,以及为何Top工具的显示非常高。

有人说Top的输出不精确,这种说法是不确切的。实际上是Top输出显示的Oracle进程内存使用,包含了SGA部分。这也是SGA的意义所在。

SGA可以被共享,可以被所有进程所访问,在进程的寻址空间里就包含了SGA的大小。

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

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

$ uname -a

SunOS billing 5.8 Generic_108528-23 sun4u sparc SUNW,Ultra-4

Sun 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 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

PL/SQL Release 9.2.0.4.0 - Production

CORE 9.2.0.3.0 Production

TNS for Solaris: Version 9.2.0.4.0 - Production

NLSRTL Version 9.2.0.4.0 - Production

SQL> show sga

Total System Global Area 253200688 bytes

Fixed Size 731440 bytes

Variable Size 167772160 bytes

Database Buffers 83886080 bytes

Redo Buffers 811008 bytes

SQL> exit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

2.Top输出

$ top

load averages: 0.12, 0.05, 0.04 billing 10:49:52

54 processes: 52 sleeping, 1 stopped, 1 on cpu

CPU states: 99.3% idle, 0.0% user, 0.3% kernel, 0.4% iowait, 0.0% swap

Memory: 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 -efgrep 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 11264

11264: ora_ckpt_hsbill

0000000100000000 53824K read/exec /opt/oracle/product/9.2.0/bin/oracle

000000010358E000 872K read/write/exec /opt/oracle/product/9.2.0/bin/oracle

0000000103668000 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.1

FFFFFFFF7CE06000 8K read/write/exec /usr/lib/sparcv9/nss_files.so.1

FFFFFFFF7CF00000 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.1

FFFFFFFF7D100000 16K read/exec /usr/lib/sparcv9/libmp.so.2

FFFFFFFF7D204000 8K read/write/exec /usr/lib/sparcv9/libmp.so.2

FFFFFFFF7D300000 8K read/write/exec [ anon ]

FFFFFFFF7D400000 88K read/exec /usr/lib/sparcv9/libm.so.1

FFFFFFFF7D516000 8K read/write/exec /usr/lib/sparcv9/libm.so.1

FFFFFFFF7D600000 8K read/exec /usr/lib/sparcv9/libkstat.so.1

FFFFFFFF7D702000 8K read/write/exec /usr/lib/sparcv9/libkstat.so.1

FFFFFFFF7D800000 32K read/exec /usr/lib/sparcv9/librt.so.1

FFFFFFFF7D908000 8K read/write/exec /usr/lib/sparcv9/librt.so.1

FFFFFFFF7DA00000 32K read/exec /usr/lib/sparcv9/libaio.so.1

FFFFFFFF7DB08000 8K read/write/exec /usr/lib/sparcv9/libaio.so.1

FFFFFFFF7DC00000 720K read/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DDB4000 56K read/write/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DDC2000 8K read/write/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DF00000 8K read/write/exec [ anon ]

FFFFFFFF7E000000 32K read/exec /usr/lib/sparcv9/libgen.so.1

FFFFFFFF7E108000 8K read/write/exec /usr/lib/sparcv9/libgen.so.1

FFFFFFFF7E200000 672K read/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E3A8000 56K read/write/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E3B6000 40K read/write/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E400000 5328K read/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EA32000 384K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EA92000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EB00000 56K read/exec /usr/lib/sparcv9/libsocket.so.1

FFFFFFFF7EC0E000 16K read/write/exec /usr/lib/sparcv9/libsocket.so.1

FFFFFFFF7ED00000 8K read/write/exec [ anon ]

FFFFFFFF7EE00000 32K read/exec /opt/oracle/product/9.2.0/lib/libskgxn9.so

FFFFFFFF7EF06000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxn9.so

FFFFFFFF7F000000 8K read/exec /opt/oracle/product/9.2.0/lib/libskgXP9.so

FFFFFFFF7F100000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxp9.so

FFFFFFFF7F200000 8K read/exec /opt/oracle/product/9.2.0/lib/libodmd9.so

FFFFFFFF7F300000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libodmd9.so

FFFFFFFF7F400000 8K read/exec /usr/lib/sparcv9/libdl.so.1

FFFFFFFF7F500000 8K read/write/exec [ anon ]

FFFFFFFF7F600000 152K read/exec /usr/lib/sparcv9/ld.so.1

FFFFFFFF7F724000 16K read/write/exec /usr/lib/sparcv9/ld.so.1

FFFFFFFF7FFFA000 24K read/write [ stack ]

total 337360K

$

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

337360K - 266240K = 71,120k

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

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

$ ps -efgrep 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 23519

23519: oraclehsbill (LOCAL=NO)

0000000100000000 53824K read/exec /opt/oracle/product/9.2.0/bin/oracle

000000010358E000 872K read/write/exec /opt/oracle/product/9.2.0/bin/oracle

0000000103668000 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.1

FFFFFFFF7CF06000 8K read/write/exec /usr/lib/sparcv9/nss_files.so.1

FFFFFFFF7D000000 16K read/exec /usr/platform/sun4u/lib/sparcv9/libc_psr.so.1

FFFFFFFF7D100000 16K read/exec /usr/lib/sparcv9/libmp.so.2

FFFFFFFF7D204000 8K read/write/exec /usr/lib/sparcv9/libmp.so.2

FFFFFFFF7D300000 8K read/write/exec [ anon ]

FFFFFFFF7D400000 88K read/exec /usr/lib/sparcv9/libm.so.1

FFFFFFFF7D516000 8K read/write/exec /usr/lib/sparcv9/libm.so.1

FFFFFFFF7D600000 8K read/exec /usr/lib/sparcv9/libkstat.so.1

FFFFFFFF7D702000 8K read/write/exec /usr/lib/sparcv9/libkstat.so.1

FFFFFFFF7D800000 32K read/exec /usr/lib/sparcv9/librt.so.1

FFFFFFFF7D908000 8K read/write/exec /usr/lib/sparcv9/librt.so.1

FFFFFFFF7DA00000 32K read/exec /usr/lib/sparcv9/libaio.so.1

FFFFFFFF7DB08000 8K read/write/exec /usr/lib/sparcv9/libaio.so.1

FFFFFFFF7DC00000 720K read/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DDB4000 56K read/write/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DDC2000 8K read/write/exec /usr/lib/sparcv9/libc.so.1

FFFFFFFF7DF00000 8K read/write/exec [ anon ]

FFFFFFFF7E000000 32K read/exec /usr/lib/sparcv9/libgen.so.1

FFFFFFFF7E108000 8K read/write/exec /usr/lib/sparcv9/libgen.so.1

FFFFFFFF7E200000 672K read/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E3A8000 56K read/write/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E3B6000 40K read/write/exec /usr/lib/sparcv9/libnsl.so.1

FFFFFFFF7E400000 5328K read/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EA32000 384K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EA92000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libjox9.so

FFFFFFFF7EB00000 56K read/exec /usr/lib/sparcv9/libsocket.so.1

FFFFFFFF7EC0E000 16K read/write/exec /usr/lib/sparcv9/libsocket.so.1

FFFFFFFF7ED00000 8K read/write/exec [ anon ]

FFFFFFFF7EE00000 32K read/exec /opt/oracle/product/9.2.0/lib/libskgxn9.so

FFFFFFFF7EF06000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxn9.so

FFFFFFFF7F000000 8K read/exec /opt/oracle/product/9.2.0/lib/libskgxp9.so

FFFFFFFF7F100000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libskgxp9.so

FFFFFFFF7F200000 8K read/exec /opt/oracle/product/9.2.0/lib/libodmd9.so

FFFFFFFF7F300000 8K read/write/exec /opt/oracle/product/9.2.0/lib/libodmd9.so

FFFFFFFF7F400000 8K read/exec /usr/lib/sparcv9/libdl.so.1

FFFFFFFF7F500000 8K read/write/exec [ anon ]

FFFFFFFF7F600000 152K read/exec /usr/lib/sparcv9/ld.so.1

FFFFFFFF7F724000 16K read/write/exec /usr/lib/sparcv9/ld.so.1

FFFFFFFF7FFF2000 56K read/write [ stack ]

total 329968K

$

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有