read by other session 等待事件处理

2013-04-26 号 Indonesia jakarta 运营商X

OS:suse 10
DBMS:ORACLE11.1.0.7
4 rac 节点

例行检查发现一业务模块运行非常慢

查询等待事件及awr 报告

发现有 read by other session等待事件


awr 报告

Top 5 Timed Foreground Events

Event Waits Time(s) Avg wait (ms) % DB time Wait Class
DB CPU   8,349   47.67 
db file sequential read 1,160,341 5,164 4 29.48 User I/O
read by other session 119,364 541 5 3.09 User I/O
gc buffer busy acquire 90,531 399 4 2.28 Cluster
db file scattered read 25,374 138 5 0.79 User I/O

read by other session  官方解释

 read by other session Definition: When information is requested from the database,
 Oracle will first read the data from disk into the database buffer cache.
 If two or more sessions request the same information, the first session will read the
 data into the buffer cache while other sessions wait.
 In previous versions this wait was classified under the “buffer busy waits” event.
 However, in Oracle 10.1 and higher this wait time is now broken out into the
 “read by other session” wait event. Excessive waits for this event are
 typically due to several processes repeatedly reading the same blocks, e.g.
 many sessions scanning the same index or performing full-table scans on the same table.
 Tuning this issue is a matter of finding and eliminating this contention.
 Confio concludes with a summary that “read by other session waits” are very similar to buffer busy waits
 When a session waits on the “read by other session” event, it indicates
 a wait for another session to read the data from disk into the Oracle buffer cache.
 If this happens too often the performance of the query or the entire database can suffer.
  Typically this is caused by contention for “hot” blocks or objects so it is imperative
  to find out which data is being contended for.
  Once that is known this document lists several alternative methods for solving the issue.
 
总结:两个或者多个会话同时需要把硬盘中的对象装载到data buffer中,当其中一个会话把对象装入后,
其他会话就处于read by other session等待状态;这个是oracle 10g 从oracle 9i的buffer busy waits中分离出来的,
也是需要一种热块现象
从执行时间过长的

原来25号大量数据补采开成一个数据入库的高峰,对一些业务表的大规模写入更新造成此问题

定位执块的方法

select p1,p2,p3 from v$session_wait where event='read by other session';

select relative_fnno,owner,segment_name from dba_extents where fileid=&file
and &block between block_id and block_id +blocks-1
也可以通过awr 报告的 buffer busy segment 来定位

优化方法
1. 调整pctused /pctfree 减少执块的争用,减少单块数量的行数
2. 可以使用hash 分区,减少热块的争用机率
3. 优化index
4. 减少blocksize 的大小

Oracle数据库中的等待事件是指在数据库运行时,由于某些资源的限制,导致进程需要等待的事件。以下是常见的33个Oracle等待事件: 1. latch free - 等待获取latch资源的进程。 2. CPU time - 等待CPU处理时间。 3. log file sync - 等待日志文件同步完成。 4. buffer busy waits - 等待访问繁忙的数据缓冲区。 5. db file sequential read - 等待从磁盘读取数据文件的读取操作完成。 6. db file scattered read - 等待从磁盘读取散乱的数据块的读取操作完成。 7. log file parallel write - 等待并行写入日志文件的操作完成。 8. direct path read - 等待直接路径读取完成。 9. SQL*Net message from client - 等待来自客户端的SQL*Net消息。 10. log buffer space - 等待空闲的日志缓冲区空间。 11. control file parallel write - 等待并行写入控制文件的操作完成。 12. db file parallel write - 等待并行写入数据文件的操作完成。 13. enqueue - 等待获取enqueue资源的操作完成。 14. db file async I/O submit - 等待异步I/O提交的操作完成。 15. db file async I/O complete - 等待异步I/O完成的操作。 16. direct path write - 等待直接路径写入操作完成。 17. SQL*Net more data to client - 等待传输更多SQL*Net数据给客户端。 18. redo log space requests - 等待空闲的重做日志空间。 19. buffer deadlock - 等待缓冲区死锁解除。 20. db file checkpoint completion - 等待数据文件检查点完成。 21. db file parallel read - 等待并行读取数据文件的操作。 22. latch: cache buffers chains - 等待获取缓冲区链锁的进程。 23. read by other session - 等待其他会话读取数据。 24. control file sequential read - 等待从控制文件读取数据。 25. ASM background process - 等待ASM后台进程操作完成。 26. latch: In-Memory undo latch - 等待获取In-Memory undo latch锁的进程。 27. cell single block physical read - 等待从Cell服务器读取单个块的物理读取操作完成。 28. library cache: mutex X - 等待获取库缓存互斥锁的进程。 29. PX Deq: Table Q Normal - 等待并行执行查询操作。 30. direct path read temp - 等待从临时文件读取数据的直接路径读取操作完成。 31. PX Deq Execution Msg - 等待并行执行消息处理。 32. PX Deq Credit: send blkd - 等待并行执行接收处理。 33. PX Deq: reap credit - 等待并行执行回收资源的操作完成。 以上是常见的33个Oracle等待事件,了解这些事件对于排查和优化数据库性能非常重要。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值