The view V$SESSION_WAIT_CLASS is similar to the V$SYSTEM_WAIT_CLASS view, but it gives session-level information for all sessions that are currently connected to the instance.
V$SESSION_WAIT_CLASS视图类似于V$SYSTEM_WAIT_CLASS视图,但它提供了当前连接到数据库实例的所有会话级的 信息。包括了如下列:
SQL> desc V$SESSION_WAIT_CLASS
Name Type Nullable Default Comments
------------- ------------ -------- ------- --------
SID NUMBER Y
SERIAL# NUMBER Y
WAIT_CLASS_ID NUMBER Y
WAIT_CLASS# NUMBER Y
WAIT_CLASS VARCHAR2(64) Y
TOTAL_WAITS NUMBER Y
TIME_WAITED NUMBER Y
2、How to Use V$SESSION_WAIT_CLASS View
The V$SESSION_WAIT_CLASS view is useful when you know the SID (and maybe the
SERIAL#) of the session that is connected to the instance. You can simply query this view for the
SID to quickly find out what wait class has the most waits. Further drilling down using
V$SESSION_EVENT view allows you to identify the wait events that may need further investigation.
通过SID和serial# 在V$SESSION_WAIT_CLASS 视图中能够很快地查询出等待事件,然后理进一步通过查询 V$SESSION_EVENT 视图找到相关等待事件的信息。
If you identified a particular wait class as a potential problem by sampling theV$SYSTEM_WAIT_CLASS view as just shown, you can find out all the current sessions
contributing to this wait class by querying V$SESSION_WAIT_CLASS view using the
WAIT_CLASS#. Once the SID is known, you can find out the user and the SQL that is causing the waits.
如果通过V$SYSTEM_WAIT_CLASS查到了问题,然后 通过WAIT_CLASS#列与V$SESSION_WAIT_CLASS 相关联,找出 sid,再根据这个sid,就能跟踪出导致相关事件的SQL,进一步确定问题 。