Oracle占用系统内存居高不小

[复制链接]
查看11 | 回复9 | 2011-11-1 16:26:59 | 显示全部楼层 |阅读模式
Oracle版本:Release 10.2.0.4.0
linux版本:Red Hat 4.1.2-46
问题描述:目前oracle占用内存居高不下,系统内存64G,oracle程序完全占光了,只剩下500M左右的空闲。如下:

total
used
freesharedbuffers cached
Mem:65995472 65575776 419696
0 93534861696668
-/+ buffers/cache: 2943760 63051712
Swap:4194296 4467563747540
执行: ps -ef|grep "ora_"|grep -v grep
结果如下
[oracle@oradb198 oracle]$ ps -ef|grep "ora_"|grep -v grep
oracle8470 10 Jul01 ?00:02:33 ora_pmon_oradb198
oracle8472 10 Jul01 ?00:00:01 ora_psp0_oradb198
oracle8474 10 Jul01 ?00:00:03 ora_mman_oradb198
oracle8476 10 Jul01 ?00:32:24 ora_dbw0_oradb198
oracle8478 10 Jul01 ?00:32:26 ora_dbw1_oradb198
oracle8480 10 Jul01 ?05:48:39 ora_lgwr_oradb198
oracle8482 10 Jul01 ?00:07:46 ora_ckpt_oradb198
oracle8484 10 Jul01 ?00:02:39 ora_smon_oradb198
oracle8486 10 Jul01 ?00:00:00 ora_reco_oradb198
oracle8488 10 Jul01 ?00:01:01 ora_cjq0_oradb198
oracle8490 10 Jul01 ?00:08:41 ora_mmon_oradb198
oracle8492 10 Jul01 ?00:16:11 ora_mmnl_oradb198
oracle8494 10 Jul01 ?00:00:00 ora_d000_oradb198
oracle8496 10 Jul01 ?00:00:00 ora_s000_oradb198
oracle8499 10 Jul01 ?00:40:28 ora_asmb_oradb198
oracle8503 10 Jul01 ?00:00:01 ora_rbal_oradb198
oracle8510 10 Jul01 ?00:05:40 ora_arc0_oradb198
oracle8512 10 Jul01 ?00:06:12 ora_arc1_oradb198
oracle8516 10 Jul01 ?00:00:00 ora_qmnc_oradb198
oracle8524 10 Jul01 ?00:00:00 ora_q000_oradb198
oracle8526 10 Jul01 ?00:00:00 ora_q001_oradb198
oracle 20456 10 Aug16 ?00:00:00 ora_o000_oradb198
执行ps auxw --sort=%mem
结果如下(只摘选了几个占用内存大的oracle的进程):
[oracle@oradb198 oracle]$ ps auxw --sort=%mem
USER PID %CPU %MEMVSZ RSSTTYSTATSTART TIME COMMAND
oracle84760.0 15.6 21170708 10343840 ? SsJul0132:24 ora_dbw0_oradb198
oracle84780.0 15.6 21170708 10308736 ? Ss Jul0132:26 ora_dbw1_oradb198
oracle84800.3 0.1 21143428 66516 ? Ss Jul01 348:33ora_lgwr_oradb198
oracle84990.0 18.1 1120532 11999732 ? Ss Jul0140:28 ora_asmb_oradb198

目前
SQL> show parameter sga
NAME
TYPEVALUE
------------------------------------ ----------- ------------------------------
lock_sga
boolean FALSE
pre_page_sga
boolean FALSE
sga_max_size
big integer 20G
sga_target
big integer 20G
共享池SQL区的使用率: Sql代码 select(sum(pins-reloads))/sum(pins)
"Library cache"
from v$librarycache;达到99%
数据字典缓冲区的使用率: Sql代码 select
(sum(gets-getmisses-usage-fixed))/sum(gets)
"Data dictionary cache"
from v$rowcache;
到达99%

SQL> show parameter pga
NAME
TYPEVALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target
big integer 2G
如下是PGA使用情况:
SQL> SELECT * FROM V$PGASTAT;
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
aggregate PGA target parameter
2147483648
bytes
aggregate PGA auto target
1823874048
bytes
global memory bound
214743040
bytes
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
total PGA inuse
122087424
bytes
total PGA allocated
344500224
bytes
maximum PGA allocated
865736704
bytes
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
total freeable PGA memory
104202240
bytes
process count
79
max processes count
203
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
PGA memory freed back to OS
3.7263E+11
bytes
total PGA used for auto workareas
1037312
bytes
maximum PGA used for auto workareas
346433536
bytes
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
total PGA used for manual workareas
0
bytes
maximum PGA used for manual workareas
531456
bytes
over allocation count
0
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
bytes processed
3.3773E+11
bytes
extra bytes read/written
5338699776
bytes
cache hit percentage
98.44
percent
NAME
VALUE
---------------------------------------------------------------- ----------
UNIT
------------
recompute count (total)
1764748
19 rows selected.
请问我如何优化我的oracle,将内存占用率降下来?
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
先了解一下linux使用内存的机制
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
linux下剩余内存小并不说明内存耗尽,你可以查看linux内存使用机制
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
ysping
可否说的详细一点,例如我应该怎么分步去做,需要检查linux的哪些指标等。

,我对linux不太熟悉哦
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
jlliuyi
可否详细指点一下,或者有什么帖子或者网页需要我去学习?
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
http://www.jb51.net/LINUXjishu/34605.html
楼主可以参考一下上面的文档
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
真长见识了!!!多谢了啊
:::
[oracle@db1 ~]$ free -m

total used free sharedbuffers cached
Mem:72433 6707553570558 62221
-/+ buffers/cache: 429568138
Swap:7209691 72004
上述结果显示了67075M的used,但是(-/+ buffers/cache)减去buffers和cache的结果可以看到,所以当前进程实际占用内存是4296M。
可以这么理解:在linux的内存分配机制中,优先使用物理内存,当物理内存还有空闲时(还够用),不会释放其占用内存,就算占用内存的程序已经被关闭了,该程序所占用的内存用来做缓存使用,对于开启过的程序、或是读取刚存取过得数据会比较快。
如上面的例子:使用了72433M的内存,67075M被占用,但是buuffer和cached部分作为缓存,可以使用命中率的方式提高使用效率,而且这部分缓存是根据指令随时可以释放的,我们可以认为这部分内存没有实际被使用,也可以认为它是空闲的。
因此查看目前进程正在实际被使用的内存,是used-(buffers+cache),也可以认为如果swap没有大量使用,mem还是够用的,只有mem被当前进程实际占用完(没有了buffers和cache),才会使用到swap的。
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
在linux中有这么一种思想,内存不用白不用,因此它尽可能的cache 和buffer一些数据
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
原帖由 yoyosys 于 2011-9-1 11:20 发表
http://www.jb51.net/LINUXjishu/34605.html
楼主可以参考一下上面的文档

说的比较详尽,赞一个。
回复

使用道具 举报

千问 | 2011-11-1 16:26:59 | 显示全部楼层
弱弱的问一句,linux下如何释放这些缓存空间呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行