如何分析诊断收集信息 1. 查看AWR 报告中high paring 和high version部分内容 具体查看这几个部分的内容:"SQLordered by Parse Calls' or 'SQL ordered by Version Count' SQL ordered by Parse Calls 关于这部分中的sql 解析执行是否过高,或者能否减小来
如何分析诊断收集信息
1. 查看AWR 报告中high paring 和high version部分内容
具体查看这几个部分的内容:"SQLordered by Parse Calls' or 'SQL ordered by Version Count'
SQL ordered by Parse Calls 关于这部分中的sql 解析执行是否过高,或者能否减小来。
SQL ordered by Version Count关于这部分中的high version sql ,需要找出为啥他们不能共享,可以通过 v$sql_shared_cursor 视图查找原因
2. systemstats 和errorstack 的关注点
对于systemstats 和errorstack 时效性非常重要。需要在问题发生时刻进行dump ,否则过时采集的信息是无效的。在一个高速运行的系统中,那些holders and waiter 进程转瞬即逝。
根据AWR 的 load profile 部分内容可以初步判断出 系统 sql 解析情况:
如果看到hard parses 很多,表明系统可能没有使用绑定变量,或者有新的sql 上线。
对于high version counts 也会导致 cursor:ping S wait on X
使用V$SQL_SHARED_CURSOR可以查找出 sql 不能共享的原因
有些bug可能会导致 high version counts:
Document 1057392.8 Bug 10157392 - High version counts forSQL with binds (BIND_MISMATCH)
Document 9689310.8 Bug 9689310 - Excessive child cursors /high VERSION_COUNT / OERI:17059 due to bind mismatch
Bug 可能会导致 cursor pin s wait on x :
NB |
Bug |
Fixed |
Description |
5650841 |
Hang / deadlock from ANALYZE of cluster index |
||
16191248 |
12.1.0.1.1, 12.1.0.2, 12.2.0.0 |
Hang from concurrent drop of on-commit materialized views or using DBMS_REDEFINITION |
|
14295250 |
11.2.0.4, 12.1.0.1 |
Long parse time for large query with many nested views due to much time in epxression analysis code |
|
14191508 |
11.2.0.3.8, 11.2.0.3.BP16, 11.2.0.4, 12.1.0.1 |
Slow row cache load due to SEG$ and INDSUBPART$ queries |
|
14176247 |
11.2.0.4, 12.1.0.1 |
Many child cursors using Adaptive Cursor Sharing with binds (due to BIND_EQUIV_FAILURE) |
|
18292893 |
12.1.0.2, 12.2.0.0 |
Jobs don't execute per schedule with a large number of PDBs |
|
18018515 |
12.2.0.0 |
High CPU in qctHasFakeBind (can cause 'cursor: pin S wait on X' waits) |
|
16448569 |
11.2.0.4, 12.1.0.2, 12.2.0.0 |
PQ hang/deadlock possible - "cursor: pin S wait on X" waits |
|
16400122 |
12.2.0.0 |
Spikes in library cache mutex contention for SQL using SQL Plan Baseline |
|
15850031 |
11.2.0.4, 12.2.0.0 |
Rare instance hang: deadlock between 'row cache lock' and 'cursor: pin S wait for X' |
|
14469756 |
12.2.0.0 |
Partition pruning causes delay in TBL$OR$IDX$PART$NUM |
|
14302813 |
11.2.0.4, 12.2.0.0 |
QC blocked / parse hang for parallel DML executed from remote stored procedure |
|
14029891 |
11.2.0.4, 12.1.0.1 |
mutex deadlock having SQL baselines on recursive dictionary cursor |
|
11927619 |
11.2.0.1.BP11, 11.2.0.2.BP07, 11.2.0.3, 12.1.0.1 |
DBMS_STATS slow on interval composite partitions |
|
11855965 |
11.2.0.3, 12.1.0.1 |
Truncate partition takes long time doing recursive delete on MLOG$ |
|
10213073 |
11.2.0.2.8, 11.2.0.2.BP18, 11.2.0.3, 12.1.0.1 |
CREATE SYNONYM and CREATE PACKAGE may incorrectly invalidate objects |
|
10171273 |
11.2.0.2.8, 11.2.0.2.BP08, 11.2.0.3, 12.1.0.1 |
Long parse time with non-equi subpartitioning under interval partitioning |
|
9944129 |
11.2.0.1.BP12, 11.2.0.2, 12.1.0.1 |
SQL not shared due to INST_DRTLD_MISMATCH with global transaction |
|
9935787 |
11.2.0.3, 12.1.0.1 |
Long parse time for large inlists - can cause 'cursor: pin S wait on X' waits |
|
9694101 |
10.2.0.5.7, 11.2.0.2, 12.1.0.1 |
Hang / deadlock between "cursor: pin S wait on X" and "library cache lock" involving dictionary objects |
|
9499302 |
10.2.0.5.5, 11.1.0.7.7, 11.2.0.1.BP08, 11.2.0.2, 12.1.0.1 |
Improve concurrent mutex request handling |
|
9472669 |
11.2.0.1.BP12, 11.2.0.2, 12.1.0.1 |
'cursor: pin S wait on X' waits for invalid SQL over DB link |
|
8508078 |
11.2.0.2, 12.1.0.1 |
Contention from many concurrent bad SQLs - superseded |
|
12432089 |
11.2.0.3 |
library cache lock/cursor: pin S wait on X with parallel partition stats gathering |
|
8441239 |
11.2.0.1 |
Library cache lock waits if long running TRUNCATE in progress |
|
8348464 |
11.1.0.7.2, 11.2.0.1 |
CREATE SYNONYM and CREATE PACKAGE may incorrectly invalidate objects |
|
7234778 |
11.2.0.1 |
Unnecessary "cursor: pin S wait on X" waits |
|
5485914 |
10.2.0.4 |
Mutex self deadlock on explain / trace of remote mapped SQL |
|
6143420 |
10.2.0.5, 11.1.0.6 |
Deadlock involving "ROW CACHE LOCK" on dc_users AND "CURSOR: PIN S WAIT ON X" |
|
6011045 |
10.2.0.5.5 |
DBMS_STATS causes deadlock between 'cursor: pin S wait on X' and 'library cache lock' |
|
7462072 |
10.2.0.4.3, 10.2.0.5 |
Unnecessary "cursor: pin S wait on X" waits |
|
5983020 |
10.2.0.4 |
MMON deadlock with user session executing ALTER USER |
|
7226463 |
10.2.0.5 |
EXECUTE IMMEDIATE no releasing mutex or library cache pin |
|
+ |
5907779 |
10.2.0.4 |
Self deadlock hang on "cursor: pin S wait on X" (typically from DBMS_STATS) |

InnoDB使用redologs和undologs確保數據一致性和可靠性。 1.redologs記錄數據頁修改,確保崩潰恢復和事務持久性。 2.undologs記錄數據原始值,支持事務回滾和MVCC。

EXPLAIN命令的關鍵指標包括type、key、rows和Extra。 1)type反映查詢的訪問類型,值越高效率越高,如const優於ALL。 2)key顯示使用的索引,NULL表示無索引。 3)rows預估掃描行數,影響查詢性能。 4)Extra提供額外信息,如Usingfilesort提示需要優化。

Usingtemporary在MySQL查詢中表示需要創建臨時表,常見於使用DISTINCT、GROUPBY或非索引列的ORDERBY。可以通過優化索引和重寫查詢避免其出現,提升查詢性能。具體來說,Usingtemporary出現在EXPLAIN輸出中時,意味著MySQL需要創建臨時表來處理查詢。這通常發生在以下情況:1)使用DISTINCT或GROUPBY時進行去重或分組;2)ORDERBY包含非索引列時進行排序;3)使用複雜的子查詢或聯接操作。優化方法包括:1)為ORDERBY和GROUPB

MySQL/InnoDB支持四種事務隔離級別:ReadUncommitted、ReadCommitted、RepeatableRead和Serializable。 1.ReadUncommitted允許讀取未提交數據,可能導致臟讀。 2.ReadCommitted避免臟讀,但可能發生不可重複讀。 3.RepeatableRead是默認級別,避免臟讀和不可重複讀,但可能發生幻讀。 4.Serializable避免所有並發問題,但降低並發性。選擇合適的隔離級別需平衡數據一致性和性能需求。

MySQL適合Web應用和內容管理系統,因其開源、高性能和易用性而受歡迎。 1)與PostgreSQL相比,MySQL在簡單查詢和高並發讀操作上表現更好。 2)相較Oracle,MySQL因開源和低成本更受中小企業青睞。 3)對比MicrosoftSQLServer,MySQL更適合跨平台應用。 4)與MongoDB不同,MySQL更適用於結構化數據和事務處理。

MySQL索引基数对查询性能有显著影响:1.高基数索引能更有效地缩小数据范围,提高查询效率;2.低基数索引可能导致全表扫描,降低查询性能;3.在联合索引中,应将高基数列放在前面以优化查询。

MySQL學習路徑包括基礎知識、核心概念、使用示例和優化技巧。 1)了解表、行、列、SQL查詢等基礎概念。 2)學習MySQL的定義、工作原理和優勢。 3)掌握基本CRUD操作和高級用法,如索引和存儲過程。 4)熟悉常見錯誤調試和性能優化建議,如合理使用索引和優化查詢。通過這些步驟,你將全面掌握MySQL的使用和優化。

MySQL在現實世界的應用包括基礎數據庫設計和復雜查詢優化。 1)基本用法:用於存儲和管理用戶數據,如插入、查詢、更新和刪除用戶信息。 2)高級用法:處理複雜業務邏輯,如電子商務平台的訂單和庫存管理。 3)性能優化:通過合理使用索引、分區表和查詢緩存來提升性能。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Atom編輯器mac版下載
最受歡迎的的開源編輯器

記事本++7.3.1
好用且免費的程式碼編輯器

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

WebStorm Mac版
好用的JavaScript開發工具