V$MYSTAT and V$STATNAME


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博客 ” ,链接:http://blog.itpub.net/24107336/viewspace-1271210/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24107336/viewspace-1271210/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值