今天做awr报告发现gc buffer busy等待时间
gc buffer busy
This wait event, also known as global cache buffer busy prior to Oracle 10g, specifies the time the remote instance locally spends accessing the requested data block. This wait event is very similar to the buffer busy waits wait event in asingle-instance database and are often the result of:
1. Hot Blocks - multiple sessions may be requesting a block that is either not in buffer cache or is in an incompatible mode. Deleting some of the hot rows and re-inserting them back into the table may alleviate the problem. Most of the time the rows will be placed into a different block and reduce contention on the block. The DBA may also need to adjust the pctfree and/or pctused parameters for the table to ensure the rows are placed into a different block.
2. Inefficient Queries ˆ as with the gc cr request wait event, the more blocks requested from the buffer cache the more likelihood of a session having to wait for other sessions.Tuning queries to access fewer blocks will often result in less contention for the same block.
第一点应该基本排除:我刚刚整理完表,我们首先找到造成次问题的sql
1、首先查看上次所有的等待事件种类
- SQL> select min(begin_interval_time) min, max(end_interval_time) max from dba_hist_snapshot where snap_id between 204 and 228;
- SQL> select wait_class_id, wait_class, count(*) cnt
- from dba_hist_active_sess_history
- where snap_id between 204 and 228
- group by wait_class_id, wait_class
- order by 3;
- 结果如下:
- WAIT_CLASS_ID WAIT_CLASS CNT
- ------------- ------------------------------ ----------
- 4217450380 Application 1
- 1740759767 User I/O 3
- 2000153315 Network 7
- 3875070507 Concurrency 8
- 3386400367 Commit 24
- 4108307767 System I/O 54
- 1893977003 Other 66
- 3871361733 Cluster 104
- 3543
2、查看上次所有的等待事件
- SQL> SELECT event_id, event, COUNT (*) cnt
- FROM dba_hist_active_sess_history
- WHERE snap_id BETWEEN 204 AND 228 AND wait_class_id = 3871361733
- GROUP BY event_id, event
- ORDER BY 3;
- 结果如下:
- EVENT_ID EVENT CNT
- ---------- ------------------------------ ----------
- 2277737081 gc current grant busy 1
- 512320954 gc cr request 1
- 3897775868 gc current multi block request 4
- 737661873 gc cr block 2-way 5
- 111015833 gc current block 2-way 6
- 2701629120 gc current block busy 7
- 1520064534 gc cr block busy 9
- 1478861578 gc buffer busy 71
3、查询造成等待事件的sql
- SQL> SELECT sql_id, COUNT (*) cnt
- FROM dba_hist_active_sess_history
- WHERE snap_id BETWEEN 204 AND 228 AND event_id IN (1520064534, 1478861578)
- GROUP BY sql_id
- HAVING COUNT (*) > 1
- ORDER BY 2;
- 结果如下:
- SQL_ID CNT
- ------------- ----------
- fuzy096ka7sca 2
- 9mdnmqu9vhht6 4
- btb1g900q18u3 5
- 1y4rsrmg1m8u9 5
- g42h7cxm2jsmb 8
- 8knuwvx47gdsz 16
- bp92nqubvbpdq 40
4、查询具体的sql
- SELECT *
- FROM dba_hist_sqltext d
- WHERE sql_id IN
- ('bp92nqubvbpdq',
- '8knuwvx47gdsz',
- 'g42h7cxm2jsmb',
- '1y4rsrmg1m8u9',
- 'btb1g900q18u3',
- '9mdnmqu9vhht6',
- 'fuzy096ka7sca');
最后看到,主要是因为一个插入的sql产生的原因,下面就是和开发商量怎么解决这个问题了。