監控oracle的等待事件
select event
sum(decode(wait_Time
sum(decode(wait_Time
count(*)
from v$session_Wait
group by event
order by
Oracle的等待事件是衡量oracle運行狀況的重要依據及指標
等待事件的概念是在Oracle
主要有兩種類別的等待事件
空閒等待事件是指Oracle正等待某種工作
每一個等待事件都屬於某一類
管理類: administrative
類等待事件是由於DBA的管理命令引起的
應用程序類:
此類等待事件是由於用戶應用程序的代碼引起的(比如
群集類
此類等待事件和真正應用群集RAC的資源有關
提交確認類
此類等待事件只包含一種等待事件--在執行了一個commit命令後
並發類
此類等待事件是由內部數據庫資源引起的
配置類
此類等待事件是由數據庫或實例的不當配置造成的
空閒類
此類等待事件意味著會話不活躍
網絡類
和網絡環境相關的一些等待事件
Other
此類等待事件通常比較少見
調度類
Resource Manager related waits (for example
系統I/O類
此類等待事件通過是由後台進程的I/O操作引起的
用戶I/O類
此類等待事件通常是由用戶I/O操作引起的
這種情況通常與全表掃描相關
然而這個等待事件並不一定就意味著性能低下
因為全表掃描到內存的數據塊被置於LRU鏈表的冷端
當這個等待時間比較顯著時
Column
Datatype
Description
SID
NUMBER
Session identifier
SERIAL#
NUMBER
Session serial number
OPNAME
VARCHAR
Brief description of the operation
TARGET
VARCHAR
The object on which the operation is carried out
TARGET_DESC
VARCHAR
Description of the target
SOFAR
NUMBER
The units of work done so far
TOTALWORK
NUMBER
The total units of work
UNITS
VARCHAR
The units of measurement
START_TIME
DATE
The starting time of operation
LAST_UPDATE_TIME
DATE
Time when statistics last updated
TIME_REMAINING
NUMBER
Estimate (in seconds) of time remaining for the operation to complete
ELAPSED_SECONDS
NUMBER
The number of elapsed seconds from the start of operations
CONTEXT
NUMBER
Context
MESSAGE
VARCHAR
Statistics summary message
USERNAME
VARCHAR
User ID of the user performing the operation
SQL_ADDRESS
RAW(
Used with the value of the SQL_HASH_VALUE column to identify the SQL statement associated with the operation
SQL_HASH_VALUE
NUMER
Used with the value of the SQL_ADDRESS column to identify the SQL statement associated with the operation
QCSID
NUMBER
Session identifier of the parallel coordinator
這一事件通常顯示與單個數據塊相關的讀取操作
這個等待事件表明系統正在等待內存中的可用空間
該等待事件表示正在等待一個以unshareable方式使用的緩沖區
This view lists block contention statistics
Column
Datatype
Description
CLASS
VARCHAR
Class of the block
COUNT
NUMBER
Number of waits by this OPERATION for this CLASS of block
TIME
NUMBER
Sum of all wait times for all the waits by this OPERATION for this CLASS of block
select * from V$WAITSTAT
CLASS
COUNT
TIME
data block
undo header
undo block
segment header
file header block
bitmap index block
system undo block
system undo header
unused
bitmap block
save undo header
save undo block
sort block
free list
extent map
如果這一等待位於undo header
如果等待處於data block
如果等待處於索引塊
在執行DML (insert/update/ delete)時
ASSM 結合LMT 徹底改變了Oracle 的存儲機制
Oracle 宣稱ASSM 顯著地提高了DML 並發操作的性能
latch是一種低級排隊機制
■ 立刻
■ 可以等待
假如一個進程試圖在立刻模式下獲得闩
大多數latch問題都與以下操作相關:
沒有很好的是用綁定變量(library cache latch)
通常我們說
另外也有一些latch等待與bug有關
當你將日志緩沖(log buffer)產生重做日志的速度比LGWR 的寫出速度快
另外一個可能的原因是磁盤I/O 存在瓶頸
這是一個尋找性能瓶頸的關鍵視圖
每一個鏈接到實例的session都對應一條記錄
Column
Datatype
Description
SID
NUMBER
Session identifier
SEQ#
NUMBER
Sequence number that uniquely identifies this wait
EVENT
VARCHAR
Resource or event for which the session is waiting session當前正在等待的事件
P
VARCHAR
Description of first additional parameter
P
NUMBER
First additional parameter
P
RAW(
First additional parameter
P
VARCHAR
Description of second parameter
P
NUMBER
Second additional parameter
P
RAW(
Second additional parameter
P
VARCHAR
Description of third parameter
P
NUMBER
Third additional parameter
P
RAW(
Third additional parameter
WAIT_TIME
NUMBER
A nonzero value is the session
SECONDS_IN_WAIT
NUMBER
If WAIT_TIME =
STATE
VARCHAR
Wait state:
·
·
·
· >
本視圖記錄了每個session的每一項等待事件
Column
Datatype
Description
SID
NUMBER
The ID of the session
EVENT
VARCHAR
The name of the wait event
See Also: Appendix A
TOTAL_WAITS
NUMBER
The total number of waits for this event by this session
TOTAL_TIMEOUTS
NUMBER
The total number of timeouts for this event by this session
TIME_WAITED
NUMBER
The total amount of time waited for this event by this session
AVERAGE_WAIT
NUMBER
The average amount of time waited for this event by this session
MAX_WAIT
NUMBER
The maximum time (in hundredths of a second) waited for this event by this session
select a
from v$session a
V$SESSION_EVENT b
where a
and a
and user# >
select a
from v$session a
V$SESSION_wait b
where a
and a
and user# >
select a
from v$session a
v$sqltext b
where b
and a
and user# >
order by a
select a
from v$session a
V$SESStat b
v$statname c
where a
and b
and a
and user# >
and b
From:http://tw.wingwit.com/Article/program/Oracle/201311/18898.html