从日志中,可以清楚的看到SGA: allocation forcing component growth等待事件,可以看到是由于SGA无法增长导致,也就是SGA被撑爆了,这也好解释为什么用户重启服务器就恢复正常,可以初步判断问题的关键就是这里,查看metalink上的针对这个等待时间的资料,如下:

|
In this Document
| This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review. |
APPLIES TO:
Oracle Database - Enterprise Edition - Version 10.2.0.1 to 10.2.0.5 [Release 10.2] Information in this document applies to any platform. Checked for Relevance 16-MAY-13
SYMPTOMS
Slow database performance in peak hours.
The AWR shows the following in Top 5 waits table.
Event Waits Time(s) Avg Wait(ms) % Total Call Time Wait Class
CPU time 113 85.4
db file sequential read 6,831 7 1 5.4 User I/O
SGA: allocation forcing component growth 196 3 16 2.3 Other
db file scattered read 2,723 2 1 1.5 User I/O
kksfbc child completion 17 1 56 .7 Other
The top waits sections show "SGA: allocation forcing component growth" during peak time which is not there in normal load.
CAUSE
The waits for "SGA: allocation forcing component growth" indicates that SGA is inadequate. It looks like there is no enough memory available in SGA for the growth of components.
SOLUTION
You may need to find which SGA component is in huge demand, either shared pool or buffer cache. First check the "Cache Sizes" section in AWR to identify which SGA component demands growth and shrink.
To check for shared pool, look at the shared pool statistics and library cache activity.
Shared Pool Statistics Begin End Memory Usage %: 96.73 96.13 <= High usage % SQL with executions>1: 85.05 86.02 % Memory for SQL w/exec>1: 86.32 90.50 ...
Library Cache Activity
"Pct Misses" should be very low
Namespace Get Requests Pct Miss Pin Requests Pct Miss Reloads Invali-
dations
BODY 3,923 0.23 7,832 24.85 1,926 0
CLUSTER 544 0.00 3,588 0.70 25 0
INDEX 20 95.00 22 86.36 0 0
SQL AREA 86,033 19.06 204,090 25.49 19,348 20
It it clearly evident that the shared pool is in high demand as there are huge reloads happening.
Check the "Shared Pool Advisory" section and select the optimum value where "Est LC Time Saved Factr" and "Est LC Load Time Factr" correspond to 1. Then check buffer cache from "Buffer Pool Advisory" section and select the optimum value for buffer cache where "Est Phys Read Factor" corresponds to 1.
Increase the SGA_TARGET and SGA_MAX_SIZE to accommodate the SGA component growth and set the minimum value for shared pool and buffer cache based on the advisory so that the Automatic SGA would not shrink the component below the threshold thereby avoiding the contention in the respective component and performance would not be degraded.
To set minimum value for SGA components,
shared_pool_size=<value>M db_cache_size=<value>M
|
步骤三.解决之道
既然问题已经定位,我们就需要从SGA入手,为了保障不再出现类似问题,我主要从3个方面入手:
1. 调整SGA到一个更合理的值。
目前用户的SGA总值大小过小(5G),而用户的内存非常大(32G),数据库又是64位,这样的SGA设置明显不合理。
2. 关闭SGA自动管理,手工设定共享池、高速缓存区等内存大小,保证满足应用,调整语句如下
alter system set sga_max_size=15G scope=spfile
alter system set sga_target=0 scope=spfile
alter system log_buffer=50M scope=spfile
alter system set db_cache_size=10G scope=spfile
alter system set java_pool_size=100M scope=spfile
alter system set large_pool_size =100M scope=spfile
alter system set shared_pool_size=3G scope=spfile
3. 调整的时候注意对原始的参数文件进行备份,避免参数调整出现问题,好及时回退。
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-06/103075.htm
