今天监控一直报等待事件异常,查了下数据库基本都是gc buffer busy acquire等待事件。这个等待事件之前一直没接触过,今天特意了解下。

参考文档:Oracle Mos

一、简要定义

该等待事件仅适用于RAC环境,类似于非RAC环境中的"buffer busy"等待。

当会话正在等待访问另外一个会话正在适用和持有的块且无法共享该块时,会发生这种情况。多个会话可能会排队等待同一个块。

在11.1和更早版本中,这种类型的等待被分为"gc buffer busy"等待。

从Oracle 11.2开始"gc buffer busy"等待被分为两个新的等待类别:

gc buffer busy acquire

gc buffer busy release

gc buffer busy acquire:是当session 1尝试请求访问远程实例(remote instance)的buffer,但是session 1之前已经有相同实例上的另外一个session 2正在请求访问了相同的buffer,并且没有完成,那么session 1就是在等待gc buffer busy acquire。

gc buffer busy release:是在本地实例session 1之前已经有远程实例session 2请求访问了本地实例的相同buffer,并且没有完成,那么本地实例的session 1就是在等待gc buffer busy release。

二、一般原因

High contention in particular HOT blocks of the objects

Other waits like "gc block busy" and "enq: TX - row lock contention

High network latency or a problem with network

Busy server or active paging/swapping due to low free memory

Individual waits-(用于在GV$SESSION_WAIT中看到的等待)

P1                 File #

P2                 Block #

P3                 Mode requested/mode held/block class

SECONDS_IN_WAIT    Amount of time waited for the current event

file#              This is the file# of the file that Oracle is trying to read from.

block#             This is the starting block number in the file from where Oracle starts reading the blocks.

blocks             This parameter specifies the number of blocks that Oracle is rying to read from the file# starting at block#

Inst_id            instance number

To determine the root blocker for sessions waiting on the gc wait events use the below options

1.system state dump at cluster level

2. oratop displays waiters/blockers

3. v$wait_chains can be used to find the root blocker for sessions that are blocked,Troubleshooting Database Contention With V$Wait_Chains (Doc ID 1428210.1)

4. Using v$hang_info, v$hang_session_info, etc

5. Oracle Hang Manager (Doc ID 1534591.1)

Using the above information we can find the sessions waiting for specific gc events with their final blockers at instance level

System Wide wait-(用于在V$SYSTEM_EVNET中看到的等待)

如果等待缓冲区花费的时间较长,则需要根据以下内容确定哪个段遭受争用:

SELECT inst_id,

sid,

event,

wait_class,

P1,

P2,

P3 Mode requested / mode held / block class,

seconds_in_wait

FROM gv$session_wait

WHERE event LIKE 'gc buffer%';

从前面的输出中,使用P1和P2中的数据,可以使用以下命令获得相关的对象信息以下查询:

SELECT segment_name

FROM dba_extents

WHERE file_id = &file

AND &block BETWEEN block_id AND block_id + blocks - 1

AND ROWNUM = 1;

三、故障排查

1)特定HOT块的争用较高

这是由于大量并发插入导致过多的索引块拆分或带有从序列生成的键的右增长索引。

buffer busy 会频繁伴随着这一点。如果问题仍然存在,可以使用

System Wide wait-(用于在V$SYSTEM_EVNET中看到的等待)说明寻找热块。或者从问题时期的AWR报告的

Segments by Global Cache Buffer Busy获取问题segment。

2)gc block busy、enq: TX - row lock contention以及其他等待可能会影响阻止会话或者LMS进程。

如果还有其他等待可能会使块的持有者放慢速度,则解决该问题是当务之急,因为gc buffer busy acquire/release可能只是该等待的副作用。

检查AWR报告中的

Top 10 Foreground Events by Total Wait Time部分,以查看其他等待是否显着影响数据库的性能。

3)高网络延迟或网络问题

发出

"ping -s 10000 "并按照文档执行网络检查(

How to Validate Network and Name Resolution Setup for the Clusterware and RAC (Doc ID 1054902.1))

对于过去发生的问题的RCA,请检查OSWatcher以获取ping延迟时间。

AWR报告将包含

Interconnect Ping Latency Stats,这对于检查网络延迟也很有用。

OSWatcher中的netstat和CHM输出中的Nic&Protocol部分可以提供有关网络运行状况的信息。

4)繁忙的服务器或活动的页面调度/交换(由于可用内存不足)

检查vmstat输出或CHM输出,以查看服务器是否繁忙或大量的分页/交换。

对于过去发生的问题的RCA,请检查CHM或OSWatcher输出。

5)低效SQL语句

低效SQL语句会导致不必要的buffer被请求访问,增加了buffer busy的机会。在AWR中可以找到TOP SQL。解决方法可以优化SQL语句减少buffer访问。这点与单机数据库中的buffer busy waits类似。

关于select是否会导致gc buffer busy acquire:

查询一般以shared模式请求buffer,但是如果buffer不在buffer cache中,那么需要IO将buffer 读到内存中,这个过程需要以exclusive模式,如果同时有大量其他的session也请求查询该buffer(以shared 模式请求),那么就会有buffer等待了,此时可能buffer cache不够大。

如果查询请求的block已经被修改了,查询需要访问CR块,为了重构CR块,需要读取对应的undo block,如果undo block不在buffer中,需要IO把undo block读到内存,如果有大量查询访问这个CR块,那么都会有buffer busy等待了。

6)数据在节点间交叉访问

RAC数据库,同一数据在不同数据库实例上被请求访问。

如果应用程序可以实现,那么我们建议不同的应用功能/模块数据分布在不同的数据库实例上被访问,避免同一数据被多个实例交叉访问,可以减少buffer的争用,避免gc等待。

7)Oracle  Bug

四、可能的解决方案

对于高争用和热块:

Solution is to reorganize the index in a way to avoid the contention or hot spots using the below options

I. Global Hash partition the index

CREATE INDEX hgidx ON tab (c1,c2,c3) GLOBAL

PARTITION BY HASH (c1,c2)

(PARTITION p1  TABLESPACE tbs_1,

PARTITION p2  TABLESPACE tbs_2,

PARTITION p3  TABLESPACE tbs_3,

PARTITION p4  TABLESPACE tbs_4);

II. Recreate the index as reverse key index (not suitable for large table, could require buffer cache increased accordingly)

III. If index key is generated from a sequence, increase cache size of the sequence and make the sequence 'no order' if application supports it.

Refer the doc link:

对于enq: TX - row lock contention:

Mode 4-Related to ITL waits

从AWR报告或使用以下SQL查找具有较高ITL等待的段:

SELECT OWNER, OBJECT_NAME, OBJECT_TYPE

FROM V$SEGMENT_STATISTICS

WHERE STATISTIC_NAME = 'ITL waits'

AND VALUE > 0

ORDER BY VALUE;

增加这些高ITL等待的segment的inittrans值

Mode 6-Primarily due to application issue:

这是一个应用程序问题,需要应用程序开发人员来调查所涉及的SQL语句。 以下文档可能有助于进一步深入研究:

Note:102925.1 - Tracing sessions: waiting on an enqueue

Note:179582.1 - How to Find TX Enqueue Contention in RAC or OPS

Note:1020008.6 - SCRIPT: FULLY DECODED LOCKING

Note:62354.1 - TX Transaction locks - Example wait scenarios

Note:224305.1 -Autonomous Transaction can cause locking

How to Validate Network and Name Resolution Setup for the Clusterware and RAC (Doc ID 1054902.1)

oracle查询导致 gc等待,RAC等待事件:gc buffer busy acquire相关推荐

  1. RAC性能分析 - gc buffer busy acquire 等待事件

    概述 --------------------- gc buffer busy是RAC数据库中常见的等待事件,11g开始gc buffer  busy分为gc buffer busy acquire和 ...

  2. 分析解决11gR2 双节点RAC环境下的gc cr block busy/gc buffer busy acquire等待

    ?  系统环境 两节点的RAC:AIX6.1+Oracle 11.2.0.3.3 ?  AWR里展示出来的各种症状(数据来自实例2) 虽然应用没有报障,但AWR报告里的各种迹象已经很明显了 (1)   ...

  3. 2017-03-27Oracle故障gc buffer busy acquire导致数据库不可用

    实施反馈系统有20分钟不可用,然后又自动恢复了.先查看alert日志,看到打开文件数不够,系统已经运行几年了,怎么可能呢. Non critical error ORA-48180 caught wh ...

  4. oracle等待事件4——buffer busy wait 特别介绍

    以下内容太整理自网络,完全处于学习目的,如有侵权请及时联系我,我会立即删除. 非空闲等待之:buffer busy waits 事件参数说明: 事件号 事件名 参数一 参数二 参数三 145 buff ...

  5. 前台等待事件 oracle,Oracle等待事件之buffer busy waits

    产生原因 官方定义: This wait happens when a session wants to access a database block in the buffer cache but ...

  6. oracle查询导致 gc等待,如何诊断Oracle RAC系统中的等待事件gc cr multi block request?...

    AIX上: #no –a udp_recvspace udp_sendspace o 设置udp_sendspace >=[(DB_BLOCK_SIZE * DB_FILE_MULTIBLOCK ...

  7. GC Blocks Lost等待事件

    在Oracle RAC环境中,无论我们从AWR自动负载性能报告.Statspack或者Grid Control中都可以找到Oracle数据库软件所收集的全局缓存工作负载统计信息(global cach ...

  8. Oracle等待事件(三)—— buffer busy waits 常见原因及对应解决方法

    也先看看buffer busy waits在官方文档中的描述 This wait indicates that there are some buffers in the buffer cache t ...

  9. oracle+buffer+busy+wait,Oracle数据库buffer busy wait等待事件 (2)

    --查找等待块类型 SELECT 'segment Header' CLASS, a.Segment_Type, a.Segment_Name, a.Partition_Name FROM Dba_S ...

  10. oracle缓冲等待块,CSS_Oracle数据库buffer busy wait等待事件, 当会话意图访问缓冲存储 - phpStudy...

    Oracle数据库buffer busy wait等待事件 当会话意图访问缓冲存储器中的数据块,而该数据块正在被其它会话使用时产生buffer busy waits事件.其它会话可能正在从数据文件向缓 ...

最新文章

  1. 一套就够了!室内+室外激光SLAM关键算法讲解与工程实现(源码和数据开源)...
  2. Javascript 获取Url值 --转
  3. redux-saga基本用法
  4. [POJ3020]Antenna Placement(二分图最大匹配,最小边覆盖)
  5. Redisson + Lettuce实现
  6. 软件测试是评价软件质量的标准吗,《软件评测师教程》读书笔记(3)-软件质量与评价(软件测试标准)...
  7. 查计算机硬盘序列号6,Win7电脑查看硬盘序列号的方法
  8. 学校计算机管理维修制度,青岛滨海学院计算机机房管理制度
  9. bootstrap文件上传插件
  10. 高斯消元法——Matlab解线性方程组(1)
  11. Python模块之Shapely
  12. Attach在网络接入过程中的位置及实现功能
  13. mysql查看分片键
  14. 三次样条插值(附完整代码)
  15. Ubuntu或Linux下安装flash插件
  16. windows7蓝牙怎么打开_windows7系统怎么调待机时间
  17. 分享一种简易的直流电机正反转限位电路
  18. 【xquic】ubuntu20.04: libevent ( Event notification library )构建
  19. Python合并同文件夹下面Excel文件并且求和汇总
  20. 【计量经济学】联立方程模型

热门文章

  1. 直接管理和维护计算机系统的程序称为,全国2008年4月自考计算机原理试题
  2. 体育运用计算机教学的教学反思,[转载]体育教师的成长与反思
  3. Windows 启动jar程序
  4. HEX编码、Base64编码
  5. Luogu P1540 机器翻译
  6. iOS10获得系统权限
  7. windows 远程桌面连接(mstsc) 删除历史记录
  8. android自定义view星空,自定义RecyclerView星空列表「多item且互相交错,自定义列表,ViewGroup级」...
  9. 【2023校招刷题】常见面试问题总结(一、EDA工具及IC整体设计流程篇)(随后续面试不断更新....)
  10. 【友盟+】营销大数据论坛完美收官:数据驱动营销智能