無工具情況下Oracle應急診斷思路(一)
一、發現哪些session導致瓶頸或等在什麼event上
在Oracle10g上,透過v$session檢視就能找到瓶頸session,而Oracle9i中,除了v$session 還需要查詢v$session_wait檢視,具體如下:
在oracle 9i
select event, count(*) sessions from v$session_wait
where state='WAITING'
and Event not like '%SQL*Net%'
and USERNAME is not null
group by event
order by 2 desc;
select SW.Sid, S.Username, SW.Event, SW.Wait_Time,
SW.State, SW.Seconds_In_Wait SEC_IN_WAIT
from V$SESSION S, V$SESSION_WAIT SW
where S.Username is not null
and SW.Sid = S.Sid
and SW.Event not like '%SQL*Net%'
order by SW.Wait_Time Desc;
[@more@]在oracle 10g
select event, count(*) sessions from v$session
where state='WAITING'
and event not like '%SQL*Net%'
and USERNAME is not null
group by event
order by 2 desc;
select s.SID,s.USERNAME,s.EVENT,s.WAIT_TIME,s.SECONDS_IN_WAIT,s.LAST_CALL_ET,s.STATE,
s.BLOCKING_SESSION,s.BLOCKING_SESSION_STATUS
from v$session
where s.USERNAME is not null
and s.STATUS = 'ACTIVE'
and s.EVENT not like '%SQL*Net%'
order by s.SECONDS_IN_WAIT;
知道有問題session後,需要進一步查出導致等待的物件或SQL,在此針對不同evet需要採取不同的處理方法,對db file scattered read和db file sequential read類event,可以採取如下查詢:
--確定導致等待物件:
select Sid, Event, P1text, P1, P2text, P2, P3text, P3,SQL_ADDRESS,SQL_HASH_VALUE
from V$SESSION
where event not like '%SQL%'
and Event not like '%rdbms%';
and Sid between &sid1 and &sid2
select Owner, Segment_Name, Segment_Type, Tablespace_Name
from DBA_EXTENTS
where File_Id = &FileId_In
and &BlockId_In between Block_Id and Block_Id + Blocks - 1;
--確定導致等待的SQL:
select sql_id,child_number,sql_text,sql_fulltext from v$sql
where hash_value=&hv
and address=&addr
--找出該SQL相關的執行計劃:
呼叫dbms_xplan包,檢視該語句執行時的執行計劃:
select * from table(dbms_xplan.display_cursor('sql_id'));
SQL> select * from table(dbms_xplan.display_cursor('9dy3zmd40w004'));
根據SQL執行計劃,最佳化SQL,即對該SQL相關索引進行最佳化
如下為全表掃描和索引掃描的英文解釋,共參考:
db file scattered readThe db file scattered read event is posted by the session when it issues an I/O request to read multiple data blocks. The blocks read from the datafiles are scattered into the buffer cache. These blocks need not remain contiguous in the buffer cache. The event typically occurs during full table scans or index fast full scans. The initialization parameter, DB_FILE_MULTIBLOCK_READ_COUNT determines the maximum number of data blocks to read.
Waiting on datafile I/O completion is normal in any Oracle database. The presence of this wait event does not necessarily indicate a performance problem. However, if the time spent waiting for multiblock reads is significant compared to other waits, you must investigate the reason for it.
Wait Parameters
Wait parameters for db file scattered read are described here:
• P1 File number to read the blocks from
• P2 Starting block number to begin reading
• P3 Number of blocks to read
Wait Time
No timeouts. The session waits until all of the I/Os are completed to read specified number of blocks.
db file sequential readThe db file sequential read wait event occurs when the process waits for an I/O completion for a sequential read. The name is a bit misleading, suggesting a multiblock operation, but this is a single block read operation. The event gets posted when reading from an index, rollback or undo segments, table access by rowid, rebuilding control files, dumping datafile headers, or the datafile headers.
Waiting on datafile I/O completion is normal in any Oracle Database. The presence of this wait event does not necessarily indicate a performance problem. However, if the time spent waiting for single block reads is significant compared to other waits, you must investigate the reason for it.
Wait Parameters
No timeouts. Wait parameters for db file sequential read are described here:
• P1 File number to read the data block from
• P2 Starting block number to read
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1058765/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE診斷案例Oracle
- 一次ORACLE IO效能診斷案例Oracle
- 一次Oracle診斷案例-Spfile案例Oracle
- Oracle診斷事件列表(轉)Oracle事件
- 5.28應急響應思路流程
- 一次Oracle診斷案例-SGA與SwapOracle
- oracle之 redo過高診斷Oracle
- 9 Oracle Data Guard 故障診斷Oracle
- Oracle診斷案例-Sql_traceOracleSQL
- [JVM] 應用診斷工具之Fastthread(線上診斷)JVMASTthread
- 綠盟科技分享工業資訊保安應急響應能力建設思路
- Oracle 12.1.0.2 impdp匯入慢診斷Oracle
- oracle RAC 診斷叢集狀態命令Oracle
- Oracle EBS基礎學習:Oracle EBS啟用診斷功能Oracle
- Oracle診斷案例-Job任務停止執行Oracle
- 線上故障突突突?如何緊急診斷、排查與恢復
- ORACLE 如何診斷高水位爭用(enq: HW – contention)OracleENQ
- 9. Oracle常用分析診斷工具——9.3.ADDMOracle
- 9. Oracle常用分析診斷工具——9.2. ASHOracle
- 9. Oracle常用分析診斷工具——9.1. AWROracle
- 如何利用 Webshell 診斷 EDAS Serverless 應用WebshellServer
- 線上診斷神器-arthas基本應用
- Oracle 無備份情況下undo檔案損壞處理Oracle
- oracle 12c 新增的診斷事件的初步嘗試Oracle事件
- 【ASK_ORACLE】ORA-04030診斷方法及預防措施Oracle
- 是否可以考慮做一個dotnet應用的效能診斷工具
- Win10系統下網路診斷在哪_win10系統如何使用網路診斷Win10
- 用10046進行診斷一例
- 一次SGA與Swap故障診斷
- 腎不太好該怎麼辦?拜託AI診斷一下AI
- Oracle-無備份情況下,如何手動恢復控制檔案Oracle
- 過去十年中 美國“絕望的疾病”診斷率急劇增加
- Java診斷利器ArthasJava
- SQL問題診斷SQL
- 一次DG故障診斷過程分析
- 經緯恆潤遠端診斷車雲解決方案——下一代診斷技術
- win10設定-隱私-診斷和反饋-“可選診斷資料”呈灰色無法選擇怎麼辦?Win10
- 免費網站seo診斷:從哪些維度進行診斷呢?網站
- SQL Server database mail問題診斷一例SQLServerDatabaseAI