v$session_longops TIMESTAMP 字段和计时过程(以毫秒为单位)
有谁知道v$session_longops
中的TIMESTAMP
字段是做什么的? 文档页面上的描述只是说“时间戳”。
我需要获取在 longops 中监控的某些操作的运行时间,对于短测试,它们通常不到 1 秒,但我仍然想知道哪些操作运行时间更长。我希望使用这个 TIMESTAMP 字段来捕获毫秒时间,但我不知道 TIMESTAMP 字段是否可以用于此目的。
如果做不到这一点,是否有其他方法可以在 longops 中获取这些进程的毫秒持续时间?
更新:
进行了更多调查后,TIMESTAMP
字段似乎始终具有 NULL 值。另外,它的数据类型是 DATE
,而不是 TIMESTAMP
...
(使用 Oracle 10g)
Does anyone know what the TIMESTAMP
field in v$session_longops
does? The description on the documentation page just says "timestamp".
I need to get the elapsed time of some operations I monitor in longops and for short tests they are often less than 1 second, but I still want to know which ones run longer. I was hoping to use this TIMESTAMP
field to capture millisecond time, but I can't find out if the TIMESTAMP
field can even be used for that.
Failing that, is there any other way I could get the millisecond duration of these processes in longops?
UPDATE:
Having done some more investigation, the TIMESTAMP
field appears to always have a value of NULL. Also, it's datatype is a DATE
, not a TIMESTAMP
...
(using Oracle 10g)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Oracle 维护
V$SESSION_LONGOPS
- 您可以使用DBMS_APPLICATION_INFO.SET_SESSION_LONGOPS
将条目放入其中并更新它们,但 Oracle 控制它们的清除方式。有人想知道为什么您不创建自己的表来存储所有测试的计时,以便您可以在闲暇时分析所有数据?您似乎表明您已经获得了包含测试的软件包;与调用
DBMS_APPLICATION_INFO
相比,向这些包中添加INSERT
或UPDATE
语句似乎是零和游戏。V$SESSION_LONGOPS
早于 Oracle 对TIMESTAMP
数据类型的支持,因此该列是DATE
的原因。Oracle maintains
V$SESSION_LONGOPS
- you can useDBMS_APPLICATION_INFO.SET_SESSION_LONGOPS
to put entries in there and to update them, but Oracle controls how they get purged.One wonders why you don't create your own table to store timings for all of your tests, so that you can analyze all the data at your leisure? You seem to indicate that you've got packages that contain your tests; throwing an
INSERT
orUPDATE
statement into those packages seems pretty zero-sum compared to calls toDBMS_APPLICATION_INFO
.V$SESSION_LONGOPS
predates Oracle's support of theTIMESTAMP
datatype, so that's why the column is aDATE
.你可以这样得到毫秒:
如果你需要 INTERVAL 对象的数字表示,你可以使用这些函数:
you can get the milliseconds like that:
in case you need a numeric representation of the INTERVAL object you could use these functions:
也许您可以使用 SELECT dbms_utility.get_time FROM Dual; ?
它以数百秒为单位返回时间,并且只需通过简单的减法即可计算经过的时间。
Maybe you can use
SELECT dbms_utility.get_time FROM dual;
?It returns the time in hundreds of a second and computing an elapsed time is just by a simple subtraction.
实际的解决方案最终看起来像这样:
是的,我将毫秒持续时间存储在上下文字段中,因为它似乎可用于开发人员需要的任何目的。
Actual solution ended up looking like this:
Yes, I stored the millisecond duration in the context field since it seems to be available for whatever purpose the developer needs.