RAC 环境中最常见的 5 个数据库和/或实例性能问题 (文档 ID 1602076.1) | ![]() |
![]() |
修改时间:2013-11-27![]() ![]() |
|
文档内容
适用于:Oracle Database - Enterprise Edition - 版本 10.1.0.2 到 11.2.0.3 [发行版 10.1 到 11.2]本文档所含信息适用于所有平台 用途 本文旨在提供关于 RAC 环境中最常见的数据库和/或实例性能问题的摘要以及可能的解决方案 适用范围DBAs 详细信息问题 1:大量块丢失 (gc lost blocks, gc current/cr lost blocks)症状
I. AWR 报告中显示有大量块丢失。
II. netstat -s 报告数据包重新组装故障(reassambly failure)和丢失数据包(dropped packets)增加。
使用以下文档进行故障排除并解决丢失块问题。该文档描述了症状、可能原因以及解决方案。
Document 563566.1 - gc block lost diagnostics
问题 2:大量 log file sync 等待症状
I. AWR 报告中显示 log file sync 始终位于 Top 5 等待事件列表中。
II. 平均 log file sync 时间很长(> 20 毫秒)。 III. 平均 log file parallel write 时间很长(> 10 毫秒)。 III. 平均 redo write broadcast ack time 或者 wait for scn ack 时间很长(> 10 毫秒)。 IV. 平均 log file sync 时间很短,但 log file sync 等待次数太多。
I. 重做日志文件所在设备的 IO 服务时间和吞吐量不理想。
II. Oracle Bug。有关已知 Oracle Bug,请查看 WAITEVENT: "log file sync" Reference ( Document 34592.1)。 III. LMS 未在 RT(实时)类中运行。 IV. LGWR 进程调度延迟。 V. 提交数太多。 VI. 操作系统资源紧张。
I. 如果日志文件并行写入始终很高(> 10 毫秒),则将重做日志文件移动到具有较高吞吐量和更短响应时间的磁盘上。日志文件并行写入理想范围应在 1-2 毫秒之间。
II. 应用适用于您的环境的已知 Oracle Bug 修复。获取这些修复的最有效方法是应用最新 PSU 补丁程序。Document 756671.1 提供了有关最新 PSU 的详细信息。 III. 确保 LMS 进程在 RT 类中运行。LMS 进程默认情况下在 RT 类中运行。 IV. 使用批量提交而不是在每次 DML 操作之后提交,可以减少提交数量。 V. 查看是否有任何活动可以使用 NOLOGGING/UNRECOVERABLE 选项安全地完成。 VI. 查看是否可以使用 COMMIT NOWAIT 选项。有关详细信息,请参阅 Document 857576.1。
@For Support Only: Renice LGWR to run at higher priority or run LGWR in RT class by adding LGWR to the parameter: _high_priority_processes='VKTM|LMS|LGWR". Consider doing this only if log file sync is high and scheduling delay of LGWR is found to be causing it. Be prepared to test it thoroughly.
问题 3:Mutexes 上的长时间等待 Mutexes 是比闩锁(latches)更为轻型且粒度更细的并行机制。获取 Mutex 的目的是为了确保正确管理特定操作的并行执行,例如,如果一个会话正在更改内存中的数据结构,则其他会话等到获取Mutex 后,才能进行类似的更改。下面是最常见的与 Mutex 相关的等待:
AWR 报告中显示“cursor: pin S wait on X as one of the top wait”。
请查看 Troubleshooting 'cursor: pin S wait on X' waits ( Document 1349387.1).
请查看 Troubleshooting 'cursor: pin S wait on X' waits ( Document 1349387.1).
AWR 报告中显示“cursor: pin S as one of the top waits”
I. 某个特定 Mutex 有大量并行操作,特别是在多个 CPU 的系统上。
II. 在高负载情况下,会等待非常多不同的“idn”值。 III. Oracle Bugs Bug 10270888 - ORA-600[kgxEndExamine-Bad-State] / mutex waits after a self deadlock Bug 9591812 - Wrong wait events in 11.2 ("cursor: mutex S" instead of "cursor: mutex X") Bug 9499302 - Improve concurrent mutex request handling Bug 7441165 - Prevent preemption while holding a mutex (fix only works on Solaris) Bug 8575528 - Missing entries in V$MUTEX_SLEEP.location
I. 应用 Bug 10411618 的修复。
II. 对于任何已标识的“热点”SQL,用户可以通过将 SQL 替换为一些由其他会话执行的变体,来减少特定游标上的并行操作。有关详细信息,请查看 WAITEVENT: cursor: pin S Reference ( Document 1310764.1)。 III. 应用其他已知 Oracle bug 的修复。获取修复的最有效方法是应用最新 PSU patch(补丁程序)。 Document 756671.1 提供了有关推荐补丁程序的详细信息。
AWR 报告中显示“library cache: Mutex X as one of the TOP waits”。
I. 频繁硬解析。
II. 高版本数。 III. 失效和重新加载。 IV. Oracle Bug。有关详细信息,请查看 WAITEVENT: "library cache: mutex X" ( Document 727400.1) 以获取已知 Oracle Bug 列表。
I. 减少硬解析、失效和重新加载。有关详细信息,请查看 Troubleshooting: Tuning the Shared Pool and Tuning Library Cache Latch Contention ( Document 62143.1)。
II. 查看 Troubleshooting: High Version Count Issues ( Document 296377.1) 以解决高版本数问题。 III. 应用已知 Oracle bug 的修复。获取修复的最有效方法是应用最新 PSU patch(补丁程序)。 Document 756671.1 提供了有关推荐 patch(补丁程序)的详细信息。 问题 4:高 enq: TX -row lock contention, enq: TX - index contention, enq: TX - ITL allocate entry 等待 A. enq: TX - Index Contention
I. AWR 报告中显示,在模式 4 下,“enq: TX - index contention and enq: TX - row lock contention”上有大量等待。
II. AWR 报告中显示有大量的branch node splits, leaf node splits 和leaf node 90-10 splits III. AWR 报告(Segments by Row Lock Waits)中显示特定段上有大量行锁等待。 IV. AWR 报告中显示其他等待,例如索引分支或叶块上的 gc buffer busy 等待、远程回滚段段头上的 gc current block busy 和 gc current split。 示例: Top 5 Timed Foreground Events Event Waits Time(s) Avg wait (ms) % DB time Wait Class enq: TX - index contention 29,870 1,238 41 9.52 Concurrency Instance Activity Stats: Statistic Total per Second per Trans branch node splits 945 0.26 0.00 leaf node 90-10 splits 1,670 0.46 0.00 leaf node splits 35,603 9.85 0.05 Segments by Row Lock Waits: Owner Tablespace Object Name Obj.Type Row Lock Waits % of Capture ACSSPROD ACSS_IDX03 ACSS_ORDER_HEADER_PK INDEX 3,425 43.62 ACSSPROD ACSS_IDX03 ACSS_ORDER_HEADER_ST INDEX 883 11.25 ACSSPROD ACSS_IDX03 ACSS_ORDER_HEADER_DT INDEX 682 8.69
I. 大量并行插入导致过量索引块拆分。
II. 对于索引值由序列产生的索引,它不断向右增长。
解决方案是采用避免争用或热点的方式重新组织索引。选项包括
I. 将索引重新创建为反向索引 II. Hash(散列)分区索引 III. 如果索引关键字是从序列(sequence)生成的,则增加序列的高速缓存大小,在应用程序支持时,使用“无序”序列。
AWR 报告中显示,在模式 4 下,“enq: TX - allocate ITL”和“enq: TX - row lock contention”上有大量等待。
相对于并行事务数量,initrans 数设置得太低
从 AWR 报告中查找具有高 ITL 等待的段,或者使用以下 SQL:
SELECT OWNER, OBJECT_NAME, OBJECT_TYPE FROM V$SEGMENT_STATISTICS WHERE STATISTIC_NAME = 'ITL waits' AND VALUE > 0 ORDER BY VALUE; 增加出现高 ITL 等待的段的 initrans值。
AWR 报告中显示,在独占模式 (6) 下,“enq: TX - row lock contention”上有大量等待。
这是应用程序问题,需要由应用程序开发人员参与查找涉及的 SQL 语句。下面的文档对进一步研究该问题可能会有所帮助:
Document 102925.1 - Tracing sessions: waiting on an enqueue Document 179582.1 - How to Find TX Enqueue Contention in RAC or OPS Document 1020008.6 - SCRIPT: FULLY DECODED LOCKING Document 62354.1 - TX Transaction locks - Example wait scenarios Document 224305.1 -Autonomous Transaction can cause locking 问题 5:高 CPU 和内存开销 A. 高 CPU 占用率
I. TOP、prstat、vmstat 等操作系统工具显示用户 CPU 占用率非常高,而占用 cpu 最高的进程是 Oracle 进程或后台进程。
II. AWR 报告中显示最高等待数为以下一项或多项: latch free cursor pin S wait on X 或 cursor pin S wait 或 library cache mutex X latch: cache buffers chains resmgr: cpu quantum enq: RO - fast object reuse DFS lock handle III. AWR 报告(SQLs ordered by buffer gets )中显示一些 SQL 语句每次执行都读取很多buffer并消耗很多 cpu 时间。 IV. 高 cpu 开销进程的堆栈信息显示该进程在不断自旋(spinning)。
I. Oracle bugs:
Bug 12431716 - Mutex waits may cause higher CPU usage in 11.2.0.2.2 PSU / GI PSU Bug 8199533 - NUMA enabled by default can cause high CPU Bug 9226905 - Excessive CPU usage / OERI:kkfdPaPrm from Parallel Query / High Version count on PX_MISMATCH Bug 7385253 - Slow Truncate / DBWR uses high CPU / CKPT blocks on RO enqueue Bug 10326338 - High "resmgr:cpu quantum" but CPU has idle time Bug 6455161 - Higher CPU / Higher "cache buffer chains" latch gets / Higher "consistent gets" after truncate/Rebuild II. Linux x86-64 平台上配置了非常大的 SGA,但是没有实施 Hugepages。 III. 高开销的 SQL 语句,使用了未优化的执行计划。 IV. 无法找到的进程。
I. 对所遇到的 Bug 应用修复。获取所有这些修复的最有效方法是应用最新 PSU patch(补丁程序)。 Document 756671.1 提供了有关最新 PSU 的详细信息。
II. 实施 hugepages。有关更多说明,请参阅 Document 361670.1 - Slow Performance with High CPU Usage on 64-bit Linux with Large SGA。 III. 优化导致过多 buffer gets和消耗高 cpu 时间的 SQL。有关详细信息,请参阅 Document 404991.1 - How to Tune Queries with High CPU Usage。
I. ps、pmap 等操作系统工具显示内存中的进程在不断增长。pmap 显示进程的 heap(堆)和/或 stack(堆栈)内存不断增加。例如,
#pmap -x 26677 Address Kbytes RSS Anon Locked Mode Mapped File 00010000 496 480 - - r-x-- bash 0009A000 80 80 24 - rwx-- bash 000AE000 160 160 40 - rwx-- [ heap ] FF100000 688 688 - - r-x-- libc.so.1 II. Oracle 进程的 session uga memory 和/或 session pga memory 在不断增长。 select se.sid,n.name,max(se.value) maxmem from v$sesstat se, v$statname n where n.statistic# = se.statistic# and n.name in ('session pga memory','session pga memory max', 'session uga memory','session uga memory max') group by n.name,se.sid order by 3; III. 会话/进程 的游标数不断增长。
I. Oracle bugs:
Bug 9919654 - High resource / memory use optimizing SQL with UNION/set functions with many branches Bug 10042937 HIGH MEMORY GROUP IN GES_CACHE_RESS AND ORA-4031 ERRORS Bug 7429070 BIG PGA MEM ALLOC DURING PARSE TIME - KXS-HEAP-C Bug 8031768 - ORA-04031 SHARED POOL "KKJ JOBQ WOR" Bug 10220046 - OCI memory leak using non-blocking connection for fetches Bug 6356566 - Memory leak / high CPU selecting from V$SQL_PLAN Bug 7199645 - Long parse time / high memory use from query rewrite Bug 10636231 - High version count for INSERT .. RETURNING statements with reason INST_DRTLD_MISMATCH Bug 9412660 - PLSQL cursor leak / ORA-600[kglLockOwnersListDelete] Bug 6051972 - Memory leak if connection to database is frequently opened and closed Bug 4690571 - Memory leak using BULK COLLECT within cursor opened using native dynamic sql II. 应用程序未显式关闭游标导致游标泄漏。 III. 具有异常大的 hash(散列)联接和/或排序操作的SQL语句。
I. 应用适用 Bug 的修复。获取这些修复的最有效方法是应用最新 PSU patch(补丁程序)。 Document 756671.1 提供了有关最新 PSU 的详细信息。
II. 确保应用程序显式关闭了游标。 III. 避免非常大的 hash(散列)联接和/或排序操作。 |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29656486/viewspace-1160428/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29656486/viewspace-1160428/