ITPub博客

首页 > 数据库 > Oracle > V$MYSTAT and V$STATNAME

V$MYSTAT and V$STATNAME

原创 Oracle 作者:mopnan 时间:2014-09-16 23:42:46 0 删除 编辑


V$MYSTAT

This view contains statistics on the current session.


Column Datatype Description
SID NUMBER ID of the current session
STATISTIC# NUMBER Number of the statistic
VALUE NUMBER Value of the statistic

v$mystat字面来说就是当前用户的各种统计信息,sid就是session的id(也就是当前用户),STATISTIC#就是统计量的编号(用来唯一确定统计量的名称),value是统计量的值。

V$STATNAME

This view displays decoded statistic names for the statistics shown in the V$SESSTAT and V$SYSSTAT tables.

On some platforms, the NAME and CLASS columns contain additional operating system-specific statistics.

Column Datatype Description
STATISTIC# NUMBER Statistic number

Note: Statistics numbers are not guaranteed to remain constant from one release to another. Therefore, you should rely on the statistics name rather than its number in your applications.

NAME VARCHAR2(64) Statistic name
CLASS NUMBER A number representing one or more statistics classes. The following class numbers are additive:
  • 1 - User

  • 2 - Redo

  • 4 - Enqueue

  • 8 - Cache

  • 16 - OS

  • 32 - Real Application Clusters

  • 64 - SQL

  • 128 - Debug

STAT_ID NUMBER Identifier of the statistic
v$statname是对统计信息的说明,STATISTIC#相当于编号,NAME就是统计量的名称。

v$statname视图获取系统的统计量的说明
v$mystat视图获取当前用户的在v$statname中的每个统计量的值
两个视图按STATISTIC#连接,可以得到当前用户的sid,统计量的编号,统计量的名称,和统计值.
select b.sid,a.STATISTIC#,a.name,b.value 
from v$statname a,v$mystat b 
where a.STATISTIC#=b.STATISTIC#;

       SID STATISTIC# NAME                                                                  VALUE
---------- ---------- ---------------------------------------------------------------- ----------
       138          0 logons cumulative                                                         1
       138          1 logons current                                                             1
       138          2 opened cursors cumulative                                           56
       138          3 opened cursors current                                                 1
        ...
       138        314 OTC commit optimization hits                                       0
       138        315 OTC commit optimization failure - setup                       0

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24107336/viewspace-1271210/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-06-17

  • 博文量
    13
  • 访问量
    98548