原博客地址:http://space.itpub.net/10248702/viewspace-669512
1 Overview
##################################################################
1.1 v$sesstata stores session-specific resource usage statistics, beginning at login and ending at logout.
统计会话级的统计数据。虽然是会话级的,但并不是说只有当前会话,是所有会话都有统计。
1.2 The differences between v$sysstat and sesstat:
1) v$sesstat only stores?data?for each session, whereas v$sysstat stores the accumulated values for all session.
(系统级与会话级)
2) v$sesstat is transitory, and is lost after a session logs out. v$sysstat is cumulative, and is only lost when the instance is shutdown.
3) v$sesstat does not include the name of the statistic, this view must be joined to either v$sysstat or v$statname.
?
##################################################################
2 示例
##################################################################
2.1 Finding the Top sessions with Highest Logical and Physical I/O Rates Currently Connected to the database.
查找当前Session消耗IO最多的会话。
SQL> select name, statistic#
? 2? from v$statname
? 3? where name in( 'session logical reads', 'physical reads');
NAME???????????????????????????????????????????????????????????? STATISTIC#
---------------------------- ----------
session logical reads???????????????????????????????????????????????????? 9
physical reads?????????????????????????????????????????????????????????? 42
SQL> SELECT ses.sid
? 2? ,DECODE(ses.action,NULL,'online','batch') "User"
? 3? , MAX(DECODE(sta.statistic#,9,sta.value,0))/greatest(3600*24*(sysdate-ses.logon_time),1) "Log IO/s"
? 4? , MAX(DECODE(sta.statistic#,42,sta.value,0))/greatest(3600*24*(sysdate-ses.logon_time),1) "Phy IO/s"