Oracle動態效能檢視學習筆記(10)_v$session_wait
Oracle動態效能檢視學習筆記(10)_v$session_wait
目錄
參考文件<>Chapter 24
##################################################################
1 Overview
##################################################################
This is a key view for finding botlenecks.
It tells what every session in the database is currently waiting for
(or the last event waited for by the session if it is not waiting for anything).
This view can be used as a starting point to find which direction to proceed in when a system is experiencing performance problems.
(這個檢視可以用來作為查詢瓶頸問題的Starting point.)
v$session_wait has a row for every session connected to the instance. It indicates if the session is:
Using Resource
Waiting for a Resource
Idle(waiting on one of the idle events);
不管會話是否在使用資源,都會有一行記錄。
##################################################################
2 Userful Columns for v$session_wait
##################################################################
1) SID: Session identifier for the session (可以與v$session結合,找到來自哪裡的會話正在等待某個事件)
2) Event: Event the session is currently waiting for, or the last event the session had to wait for.
(當前正在等待的事件,或最後一個等待的事件)
3) Wait_time: Time(in hundredths of a second) that the session waited for the event; if the WAIT_TIME is 0, then the session is currently waiting for the event.
(等待時間,
如果為0,表示正在等待
>0 Time waited in the last wait(in 10ms clock ticks) 等待時間,以10ms 為一個滴嗒。
-1 Time waited in the last wait was less than 10ms 小於10ms的等待時間
-2 Timing is not enabled (Timing沒開啟)
4) Seq#: Gets Incremented with every wait for the session.
等待序號,會話每等待一個事件,Seq#遞增
5) P1,P2,P3: Wait event specific details for the wait.
詳細描述等待事件
6) P1TEXT, P2TEXT, P3TEXT: Description of P1,P2,P3 for the given event
##################################################################
3 示例
##################################################################
1) Finding Current Waits on the System
查詢當前的等待事件
SELECT event,
sum(decode(wait_time,0,1,0)) "Curr",
sum(decode(wait_time,0,0,1)) "Prev",
count(*)"Total"
FROM v$session_wait
GROUP BY event
ORDER BY count(*);
EVENT Curr Prev Total
---------------------------------------------------------------- ---------- ---------- ----------
pmon timer 1 0 1
smon timer 1 0 1
rdbms ipc message 5 0 5
SQL*Net message from client 16 1 17
SELECT event,
sum(decode(wait_Time,0,0,DECODE(s.status,'ACTIVE',1,0))) "Prev",
sum(decode(wait_Time,0,1,DECODE(s.status,'ACTIVE',1,0))) "Curr",
count(*) "Tot"
FROM v$session s, v$session_wait w
WHERE s.sid = w.sid
GROUP BY event
ORDER BY count(*);
2.列出指定ID的等待事件
select * from v$session_wait where sid=XXX;
3.應用p1,p2,p3進行等待事件的分析
v$session_wait檢視的列代表的緩衝區忙等待事件如下:
P1—與等待相關的資料檔案的全部檔案數量。
P2—P1中的資料檔案的塊數量。
P3—描述等待產生原因的程式碼。
例:select p1 "File #", p2 "Block #", p3 "Reason Code"
from v$session_wait
where event = 'buffer busy waits';
如果以上查詢的結果顯示一個塊在忙等待,以下的查詢將顯示這一塊的名稱和型別:
select owner, segment_name, segment_type
from dba_extents
where file_id = &P1 and &P2 between block_id and block_id + blocks -1;
我們也可以查詢dba_data_files以確定等待的檔案的file_name,方法是使用v$session_wait中的P1。
從v$session_wait中查詢P3(原因編碼)的值可以知道session等待的原因。原因編碼的範圍從0到300,下列為部分編碼所代表的事項:
0 塊被讀入緩衝區。
100 我們想要NEW(建立)一個塊,但這一塊當前被另一session讀入。
110 我們想將當前塊設為共享,但這一塊被另一session讀入,所以我們必須等待read()結束。
120 我們想獲得當前的塊,但其他人已經將這一塊讀入緩衝區,所以我們只能等待他人的讀入結束。
130 塊被另一session讀入,而且沒有找到其它協調的塊,所以我們必須等待讀的結束。緩衝區死鎖後這種情況也有可能產生。所以必須讀入塊的CR。
200 我們想新建立一個block,但其他人在使用,所以我們只好等待他人使用結束。
210 Session想讀入SCUR或XCUR中的塊,如果塊交換或者session處於非連續的TX模式,所以等待可能需要很長的時間。
220 在緩衝區查詢一個塊的當前版本,但有人以不合法的模式使用這一塊,所以我們只能等待。
230 以CR/CRX方式獲得一個塊,但塊中的更改開始並且沒有結束。
231 CR/CRX掃描找到當前塊,但塊中的更改開始並且沒有結束。
##################################################################
4 v$session_event
##################################################################
This view summarizes wait events for every session. While v$session_wait shows the current waits for a session.
v$session_event provides summary of all the events has waited for since it started.
列上與v$system_event差不多。
##################################################################
5 問題
##################################################################
1) 對P1,P2,P3的理解仍不知道啥意思?不同的等待事件,不同的意思
目錄
參考文件<
##################################################################
1 Overview
##################################################################
This is a key view for finding botlenecks.
It tells what every session in the database is currently waiting for
(or the last event waited for by the session if it is not waiting for anything).
This view can be used as a starting point to find which direction to proceed in when a system is experiencing performance problems.
(這個檢視可以用來作為查詢瓶頸問題的Starting point.)
v$session_wait has a row for every session connected to the instance. It indicates if the session is:
Using Resource
Waiting for a Resource
Idle(waiting on one of the idle events);
不管會話是否在使用資源,都會有一行記錄。
##################################################################
2 Userful Columns for v$session_wait
##################################################################
1) SID: Session identifier for the session (可以與v$session結合,找到來自哪裡的會話正在等待某個事件)
2) Event: Event the session is currently waiting for, or the last event the session had to wait for.
(當前正在等待的事件,或最後一個等待的事件)
3) Wait_time: Time(in hundredths of a second) that the session waited for the event; if the WAIT_TIME is 0, then the session is currently waiting for the event.
(等待時間,
如果為0,表示正在等待
>0 Time waited in the last wait(in 10ms clock ticks) 等待時間,以10ms 為一個滴嗒。
-1 Time waited in the last wait was less than 10ms 小於10ms的等待時間
-2 Timing is not enabled (Timing沒開啟)
4) Seq#: Gets Incremented with every wait for the session.
等待序號,會話每等待一個事件,Seq#遞增
5) P1,P2,P3: Wait event specific details for the wait.
詳細描述等待事件
6) P1TEXT, P2TEXT, P3TEXT: Description of P1,P2,P3 for the given event
##################################################################
3 示例
##################################################################
1) Finding Current Waits on the System
查詢當前的等待事件
SELECT event,
sum(decode(wait_time,0,1,0)) "Curr",
sum(decode(wait_time,0,0,1)) "Prev",
count(*)"Total"
FROM v$session_wait
GROUP BY event
ORDER BY count(*);
EVENT Curr Prev Total
---------------------------------------------------------------- ---------- ---------- ----------
pmon timer 1 0 1
smon timer 1 0 1
rdbms ipc message 5 0 5
SQL*Net message from client 16 1 17
SELECT event,
sum(decode(wait_Time,0,0,DECODE(s.status,'ACTIVE',1,0))) "Prev",
sum(decode(wait_Time,0,1,DECODE(s.status,'ACTIVE',1,0))) "Curr",
count(*) "Tot"
FROM v$session s, v$session_wait w
WHERE s.sid = w.sid
GROUP BY event
ORDER BY count(*);
2.列出指定ID的等待事件
select * from v$session_wait where sid=XXX;
3.應用p1,p2,p3進行等待事件的分析
v$session_wait檢視的列代表的緩衝區忙等待事件如下:
P1—與等待相關的資料檔案的全部檔案數量。
P2—P1中的資料檔案的塊數量。
P3—描述等待產生原因的程式碼。
例:select p1 "File #", p2 "Block #", p3 "Reason Code"
from v$session_wait
where event = 'buffer busy waits';
如果以上查詢的結果顯示一個塊在忙等待,以下的查詢將顯示這一塊的名稱和型別:
select owner, segment_name, segment_type
from dba_extents
where file_id = &P1 and &P2 between block_id and block_id + blocks -1;
我們也可以查詢dba_data_files以確定等待的檔案的file_name,方法是使用v$session_wait中的P1。
從v$session_wait中查詢P3(原因編碼)的值可以知道session等待的原因。原因編碼的範圍從0到300,下列為部分編碼所代表的事項:
0 塊被讀入緩衝區。
100 我們想要NEW(建立)一個塊,但這一塊當前被另一session讀入。
110 我們想將當前塊設為共享,但這一塊被另一session讀入,所以我們必須等待read()結束。
120 我們想獲得當前的塊,但其他人已經將這一塊讀入緩衝區,所以我們只能等待他人的讀入結束。
130 塊被另一session讀入,而且沒有找到其它協調的塊,所以我們必須等待讀的結束。緩衝區死鎖後這種情況也有可能產生。所以必須讀入塊的CR。
200 我們想新建立一個block,但其他人在使用,所以我們只好等待他人使用結束。
210 Session想讀入SCUR或XCUR中的塊,如果塊交換或者session處於非連續的TX模式,所以等待可能需要很長的時間。
220 在緩衝區查詢一個塊的當前版本,但有人以不合法的模式使用這一塊,所以我們只能等待。
230 以CR/CRX方式獲得一個塊,但塊中的更改開始並且沒有結束。
231 CR/CRX掃描找到當前塊,但塊中的更改開始並且沒有結束。
##################################################################
4 v$session_event
##################################################################
This view summarizes wait events for every session. While v$session_wait shows the current waits for a session.
v$session_event provides summary of all the events has waited for since it started.
列上與v$system_event差不多。
##################################################################
5 問題
##################################################################
1) 對P1,P2,P3的理解仍不知道啥意思?不同的等待事件,不同的意思
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10248702/viewspace-669521/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 動態規劃學習筆記動態規劃筆記
- iOS學習筆記04 檢視切換iOS筆記
- 8.1關於動態效能檢視
- oracle學習筆記(十四) 資料庫物件 索引 檢視 序列 同義詞Oracle筆記資料庫物件索引
- 檢視提交歷史 —— Git 學習筆記 11Git筆記
- Echarts檢視視覺化-學習筆記(努力更新中)Echarts視覺化筆記
- oracle學習筆記《一》Oracle筆記
- 10.25 V$SESSION_WAITSessionAI
- db2常用動態效能檢視DB2
- Python學習筆記6——動態型別Python筆記型別
- java反射之動態代理學習筆記Java反射筆記
- Solidity語言學習筆記————27、檢視函式Solid筆記函式
- Adaptive AUTOSAR 學習筆記 5 - 架構 - 物理檢視APT筆記架構
- ASP.Net MVC開發基礎學習筆記(10):分部檢視PartialViewASP.NETMVC筆記View
- Adaptive AUTOSAR 學習筆記 4 - 架構 - 邏輯檢視APT筆記架構
- 動態dp複習筆記筆記
- Oracle學習筆記(6)——函式Oracle筆記函式
- Tomcat學習筆記—-本地部署servlet動態資源Tomcat筆記Servlet
- Google Protocol buffer 學習筆記.下篇-動態編譯GoProtocol筆記編譯
- “平板電視”學習筆記筆記
- (重要)關於效能的幾個主要動態檢視
- React學習筆記-State(狀態)React筆記
- Oracle體系結構學習筆記Oracle筆記
- [python學習手冊-筆記]004.動態型別Python筆記型別
- Tensorflow學習筆記No.10筆記
- oracle學習筆記(十一) 高階查詢Oracle筆記
- MySQL筆記 13 檢視MySql筆記
- Solidity語言學習筆記————14、動態位元組陣列Solid筆記陣列
- 高效能運算學習筆記(1)筆記
- [高效能MYSQL學習筆記]事務MySql筆記
- OpenCV學習筆記-Harris角點檢測OpenCV筆記
- 2020-10-19學習筆記筆記
- win10怎麼檢視電腦效能_win10系統檢視效能的方法Win10
- 強化學習-學習筆記10 | 經驗回放強化學習筆記
- h5學習筆記:動態載入vconsole 除錯工具H5筆記除錯
- PCI-DSS(V3.2)學習筆記(二)筆記
- webpack v3 學習筆記(一) 打包jsWeb筆記JS
- AC自動機學習筆記筆記
- AC 自動機學習筆記筆記