Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

163

积分

0

好友

12

主题
1#
发表于 2015-2-28 15:12:26 | 查看: 8271| 回复: 6
简单说 :
    一条sql语句出现在v$active_session_history ,我能否能过wait_time+time_waited来计算他的执行的总时长.

   还是要用在v$active_session_history中这条sql出现的count(*)值 ,来近似的估算 这个sql的总时长?

谢谢!
7#
发表于 2015-3-10 09:05:22
其实,如果对视图中列不明白的话,可以仔细看看Reference,里面讲的很明白。

回复 只看该作者 道具 举报

6#
发表于 2015-3-3 09:00:06
Liu Maclean(刘相兵 发表于 2015-3-2 20:38
ash 并不能真正“完全意义上”追踪一条SQL的运行, 所以上面说的是 若一次等待在ash中出现多行,按照最后一 ...

OK,明白了

题外话,好象11g版本后v$active_session_history中多了一些字段,
如TM_DELTA_TIME , DELTA_TIME ,根据实际测试,感觉 近似过实际的SQL耗时.

回复 只看该作者 道具 举报

5#
发表于 2015-3-2 20:38:17
ash 并不能真正“完全意义上”追踪一条SQL的运行, 所以上面说的是 若一次等待在ash中出现多行,按照最后一行的TIME_WAITED可以计算出actual time spent waiting for that wait event, 而不是SQL的耗时。

回复 只看该作者 道具 举报

4#
发表于 2015-3-2 17:05:55
Liu Maclean(刘相兵 发表于 2015-3-2 15:09
官方文档说的很清楚
If a wait event lasted for more than a second and was caught waiting in more than ...

我能不能理解为 "按照最后一行的TIME_WAITED可以计算出actual time spent waiting for that wait event"  只是说明这个sql_id花在这个等待事件的时间, 而不是总消耗时长.

举个例子:
如果一条sql 执行了3秒种,这三秒中发生的行为比如有ON CPU ,和waiting .两种状态 . 即有3条记录保存在v$active_session_history .
我应该不能用wait_time + time_waited(或是最后一条的time_waited) 来得到这条sql 总共执行了多少时长吧 ?

谢谢!

回复 只看该作者 道具 举报

3#
发表于 2015-3-2 15:09:50
官方文档说的很清楚
If a wait event lasted for more than a second and was caught waiting in more than one session sample row, then the actual time spent waiting for that wait event will be populated in the last of those session sample rows.

若一次等待在ash中出现多行,按照最后一行的TIME_WAITED可以计算出actual time spent waiting for that wait event

回复 只看该作者 道具 举报

2#
发表于 2015-3-2 15:08:33
odm finding:

TIME_WAITED        NUMBER        If SESSION_STATE = WAITING, then the time that the session actually spent waiting for that EVENT. This column is set for waits that were in progress at the time the sample was taken.
If a wait event lasted for more than a second and was caught waiting in more than one session sample row, then the actual time spent waiting for that wait event will be populated in the last of those session sample rows. At any given time, this information will not be available for the latest session sample.



http://docs.oracle.com/cd/B19306 ... 7/dynviews_1007.htm

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-21 00:58 , Processed in 0.050366 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569