Oracle 视图 V$WAITSTAT 官方解释,作用,如何使用详细说明

本站中文解释

Oracle视图V$WAITSTAT是一个动态性能视图,用来显示数据库活动的细节、库的使用和资源等情况。它包括每个用户会话当前活动引起的等待事件以及它们以总和形式所花费的时间。通过查看V_$WAITSTAT视图,可以发现数据库的哪些操作在产生最多的等待事件,从而改善数据库的性能。

V$WAITSTAT视图可以通过以下语句来查询:

select * from V$WAITSTAT;

它一般用于查询数据库中可能导致性能问题的等待事件,以便执行协调、改进和优化等操作。例如,在数据库中查找造成性能低下的应用程序,可以执行以下查询:

select sum (total_waits) as waits, sum (time_waited_micro) as time_waited
from V$WAITSTAT
where event like ‘%APPLICATION%’;

该查询将提供应用程序不同等待事件的总等待次数和等待总时间。此外,还可以对用户会话的不同操作进行监视,以便发现高负载或者性能低下的原因:

select sum (total_waits) as waits, sum (time_waited_micro) as time_waited,
session_addr, sid, serial#
from V$WAITSTAT
group by session_addr, sid, serial#;

此外,V$WAITSTAT视图还可以用来发现性能低下的等待事件:

select event,sum (total_waits) as waits, sum (time_waited_micro) as time_waited
from V$WAITSTAT
group by event
order by time_waited desc;

通过以上查询可以查看哪些等待事件的时间最长,从而找出优化的重点。

官方英文解释

V$WAITSTAT displays block contention statistics. This table is only updated when timed statistics are enabled.
Column Datatype Description

CLASS

VARCHAR2(18)

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 (in centiseconds)

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data


数据运维技术 » Oracle 视图 V$WAITSTAT 官方解释,作用,如何使用详细说明