Oracle等待事件详细分析(一)

2014-11-24 18:33:48 · 作者: · 浏览: 6

1、latch:cache buffers chains从oracle 9i开始,以只读为目的的查询chains时,可以将cache buffers chains锁存器以shared模式共享,因此有助于减少争用。(我们需要注意,若能共享cache buffer chains 锁存器,理论上理论上不应该发生同时执行select 操作引起cbc锁存器的争用,但实际的测试结果表明,同时执行select依然会发生cbc锁存器争用,其理由是与buffer lock相关:为了读取工作,以shared模式已经获得锁存器,但是读取实际缓冲区过程中,还要以shared 模式获取buffer lock,在此过程真呢过需要部分修改缓冲区头信息。因此在获取buffer lock过程中,需要将cbc锁存器修改为exclusive 模式,在释放buffer lock期间也需要exclusive模式获取cbc锁存器,在此过程中会发生争用。)


发生cache buffers chains 锁存器争用代表性的情况如下:低效的SQL 和 hot block(热块)
低效SQL引起的cbc争用先介绍视图:v$latch_children 数据库中有些类别的latches拥有多个。v$latch中提供了每个类别的总计信息。如果想查看单个latch,可以通过查询本视图:查询数据库中所有latch的名字和个数:SQL> select name,count(*) ct from v$latch_children group by name order by ct desc;


NAME CT
---------------------------------------- ----------
cache buffers chains 1024
SQL memory manager workarea list latch 67
channel operations parent latch 65
global tx hash mapping 47
message pool operations parent latch 34
name-service namespace bucket 32
simulator hash latch 32
row cache objects 29
redo allocation 20
In memory undo latch 18
checkpoint queue latch 16



NAME CT
---------------------------------------- ----------
msg queue 15
JS queue access latch 13
commit callback allocation 11
transaction allocation 11
buffer pool 8
cursor bind value capture 8
simulator lru latch 8
object queue header operation 8
object queue header heap 8
cache buffers lru chain 8
business card 8



NAME CT
---------------------------------------- ----------
shared pool 7
flashback copy 6
virtual circuit queues 6
post/wait queue 5
slave class 5
JS slv state obj latch 4
redo copy 4
session switching 4
parallel query alloc buffer 4
job workq parent latch 3
undo global data 3



NAME CT
--------------------------------------- -----------
library cache pin allocation 3
librar