首页 > 数据库 > Oracle > 用分析函数显示日志切换的频率
select
thread#,
to_char(first_time,'dd hh24:mi:ss') first_time,
round(24 * 60 * (
lead(first_time,1) over (
partition by thread#
order by first_time
) -
first_time
),2) minutes
from
v$log_history v
where
recid >= 117
order by
thread#, recid
;
THREAD# FIRST_TIME MINUTES
---------- ----------- ----------
1 03 21:06:25 473.83
1 04 05:00:15 962.68
1 04 21:02:56 380.22
1 05 03:23:09 937.87
1 05 19:01:01 477.12
1 06 02:58:08 1083.63
1 06 21:01:46 384.72
1 07 03:26:29 214.55
1 07 07:01:02 1186.35
1 08 02:47:23 571.88
1 08 12:19:16
2 02 18:25:20 1954.57
2 04 02:59:54 1968.3
2 05 11:48:12 1570.95
2 06 13:59:09 1799.1
2 07 19:58:15
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12015/viewspace-909707/ ,如需转载,请注明出处,否则将追究法律责任。