转载请注明转载自:忆雨林枫

WARNING: Heavy swapping observed on system in last 5 mins.

在检查一个测试环境看到下面的告警信息;
WARNING: Heavy swapping observed on system in last 5 mins.
pct of memory swapped in [7.35%] pct of memory swapped out [3.30%].
Please make sure there is no memory pressure and the SGA and PGA
are configured correctly. Look at DBRM trace file for more details.
Mon Nov 17 00:35:56 2014
WARNING: Heavy swapping observed on system in last 5 mins.
pct of memory swapped in [35.11%] pct of memory swapped out [8.77%].
Please make sure there is no memory pressure and the SGA and PGA
are configured correctly. Look at DBRM trace file for more details.
Mon Nov 17 01:35:59 2014
WARNING: Heavy swapping observed on system in last 5 mins.
pct of memory swapped in [2.83%] pct of memory swapped out [0.00%].
Please make sure there is no memory pressure and the SGA and PGA
are configured correctly. Look at DBRM trace file for more details.

在11gR2中DBRM(database resource manager,11gR2中新的后台进程,会在Alert.log告警日志中反映OS操作系统最近5分钟是否有剧烈的swap活动了。

可以看到dbrm收集到了短期内的swapin和swapout数据,这样便于我们诊断由swap造成的性能或者hang问题。
matelink上面相关的文章截取:

Fix

The reason you may now see these informational messages in the alert is
due to the fact that in 11.2.0.3 an enhancement fix was included for
unpublished
Bug 10220118 – Print warning to alert log when system is swapping (Doc ID 10220118.8)

Please refer to
Note 10220118.8 – Bug 10220118 – Print warning to alert log when system is swapping

Description
  This fix is really an enhancement.
  With this fix a warning is printed to the alert log (and DBRM trace)
  if excessive swapping is observed on the system.
  The warning will not be printed more than once per hour.
  
The same issues could have been happening on 11.2.0.2 but they simply would not have been reported.
There is no cause for concern and we suggest that the databases are just monitored as usual.
If you look in the alert log, you will see that the message does not happen every hour. 
If SWAP was causing any serious issue we could also see
ORA-4031/ORA-4030 and would then be able to use the DBRM trace in
conjunction with obtaining further diagnostics.

     上面的方法就是打补丁或做升级。但是具体问题还是得具体解决,要结合自己的情况。

     我的库的版本是: 11.2.0.4.0已经高于上面所说的,所以可以排除升级或打补丁操作。
通过对自己库的了解,我认为我的不需要打补丁或者升级。

而是加大内存或者调小sag+pga。我之前实验过,加大这个测试环境的内存,确实可以避免这个。

总结一点解决OS 系统严重swap的一些出发点:

1.  诊断是否存在内存泄露的进程,解决内存泄露
2.  调优SGA/PGA ,减少oracle对内存的占用
3.  暂时释放一些cache的内存
4. 加大系统内存
5. 调整系统VM内存管理参数, 例如Linux上sysctl.conf中的以下几个参数

设置以下值,减少out of memory的可能性:

# Oracle-Validated setting for vm.min_free_kbytes is 51200 to avoid OOM killer
vm.min_free_kbytes = 51200
#vm.swappiness = 40
vm.vfs_cache_pressure = 200