列出oracle dbtime得sql语句
发表于:2025-01-22 作者:千家信息网编辑
千家信息网最后更新 2025年01月22日,可以根据dbtime 查看数据库得繁忙程度,获取某个快照得awr报告,进行分析-------------------------------------------------------------
千家信息网最后更新 2025年01月22日列出oracle dbtime得sql语句可以根据dbtime 查看数据库得繁忙程度,获取某个快照得awr报告,进行分析
----------------------------------------------------------------------------------------
--
-- File name: dbtime.sql
-- Purpose: Find busiest time periods in AWR.
-
-- Author: Kerry Osborne
--
-- Usage: This scripts prompts for three values, all of which can be left blank.
--
-- instance_number: set to limit to a single instance in RAC environment
--
-- begin_snap_id: set it you want to limit to a specific range, defaults to 0
--
-- end_snap_id: set it you want to limit to a specific range, defaults to 99999999
--
--
---------------------------------------------------------------------------------------
set lines 155
col dbtime for 999,999.99
col begin_timestamp for a40
select * from (
select begin_snap, end_snap, timestamp begin_timestamp, inst, a/1000000/60 DBtime from
(
select
e.snap_id end_snap,
lag(e.snap_id) over (order by e.snap_id) begin_snap,
lag(s.end_interval_time) over (order by e.snap_id) timestamp,
s.instance_number inst,
e.value,
nvl(value-lag(value) over (order by e.snap_id),0) a
from dba_hist_sys_time_model e, DBA_HIST_SNAPSHOT s
where s.snap_id = e.snap_id
and e.instance_number = s.instance_number
and to_char(e.instance_number) like nvl('&instance_number',to_char(e.instance_number))
and stat_name = 'DB time'
)
where begin_snap between nvl('&begin_snap_id',0) and nvl('&end_snap_id',99999999)
and begin_snap=end_snap-1
order by dbtime desc
)
where rownum < 31
/
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
99 100 02-MAY-18 04.00.11.163 PM 1 2,791.85
80 81 01-MAY-18 09.00.01.121 PM 1 2,749.62
66 67 01-MAY-18 07.00.08.007 AM 1 2,733.33
67 68 01-MAY-18 08.00.21.814 AM 1 2,732.78
57 58 30-APR-18 10.00.06.732 PM 1 2,728.00
56 57 30-APR-18 09.00.35.565 PM 1 2,727.69
65 66 01-MAY-18 06.00.00.538 AM 1 2,726.59
72 73 01-MAY-18 01.00.30.321 PM 1 2,723.55
100 101 02-MAY-18 05.00.27.047 PM 1 1,764.40
55 56 30-APR-18 08.00.13.544 PM 1 1,706.66
59 60 01-MAY-18 12.00.17.902 AM 1 1,704.93
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
64 65 01-MAY-18 05.00.19.310 AM 1 1,703.53
83 84 02-MAY-18 12.00.44.286 AM 1 1,702.55
85 86 02-MAY-18 02.00.11.423 AM 1 1,701.95
69 70 01-MAY-18 10.00.21.811 AM 1 1,675.91
77 78 01-MAY-18 06.00.37.335 PM 1 1,675.91
71 72 01-MAY-18 12.00.16.844 PM 1 1,675.83
52 53 30-APR-18 05.00.02.455 PM 2 1,109.93
101 102 02-MAY-18 06.00.39.504 PM 2 1,088.41
86 87 02-MAY-18 03.00.24.853 AM 2 1,049.19
53 54 30-APR-18 06.00.12.352 PM 2 1,036.89
44 45 30-APR-18 09.00.00.954 AM 2 1,026.10
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
51 52 30-APR-18 04.00.25.353 PM 2 1,017.33
50 51 30-APR-18 03.00.11.207 PM 2 1,003.77
45 46 30-APR-18 10.00.12.054 AM 2 1,003.51
47 48 30-APR-18 12.00.02.027 PM 2 1,002.93
46 47 30-APR-18 11.00.29.502 AM 2 1,002.87
48 49 30-APR-18 01.00.12.856 PM 2 1,002.62
49 50 30-APR-18 02.00.10.611 PM 2 1,002.43
43 44 30-APR-18 08.00.29.126 AM 2 880.34
----------------------------------------------------------------------------------------
--
-- File name: dbtime.sql
-- Purpose: Find busiest time periods in AWR.
-
-- Author: Kerry Osborne
--
-- Usage: This scripts prompts for three values, all of which can be left blank.
--
-- instance_number: set to limit to a single instance in RAC environment
--
-- begin_snap_id: set it you want to limit to a specific range, defaults to 0
--
-- end_snap_id: set it you want to limit to a specific range, defaults to 99999999
--
--
---------------------------------------------------------------------------------------
set lines 155
col dbtime for 999,999.99
col begin_timestamp for a40
select * from (
select begin_snap, end_snap, timestamp begin_timestamp, inst, a/1000000/60 DBtime from
(
select
e.snap_id end_snap,
lag(e.snap_id) over (order by e.snap_id) begin_snap,
lag(s.end_interval_time) over (order by e.snap_id) timestamp,
s.instance_number inst,
e.value,
nvl(value-lag(value) over (order by e.snap_id),0) a
from dba_hist_sys_time_model e, DBA_HIST_SNAPSHOT s
where s.snap_id = e.snap_id
and e.instance_number = s.instance_number
and to_char(e.instance_number) like nvl('&instance_number',to_char(e.instance_number))
and stat_name = 'DB time'
)
where begin_snap between nvl('&begin_snap_id',0) and nvl('&end_snap_id',99999999)
and begin_snap=end_snap-1
order by dbtime desc
)
where rownum < 31
/
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
99 100 02-MAY-18 04.00.11.163 PM 1 2,791.85
80 81 01-MAY-18 09.00.01.121 PM 1 2,749.62
66 67 01-MAY-18 07.00.08.007 AM 1 2,733.33
67 68 01-MAY-18 08.00.21.814 AM 1 2,732.78
57 58 30-APR-18 10.00.06.732 PM 1 2,728.00
56 57 30-APR-18 09.00.35.565 PM 1 2,727.69
65 66 01-MAY-18 06.00.00.538 AM 1 2,726.59
72 73 01-MAY-18 01.00.30.321 PM 1 2,723.55
100 101 02-MAY-18 05.00.27.047 PM 1 1,764.40
55 56 30-APR-18 08.00.13.544 PM 1 1,706.66
59 60 01-MAY-18 12.00.17.902 AM 1 1,704.93
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
64 65 01-MAY-18 05.00.19.310 AM 1 1,703.53
83 84 02-MAY-18 12.00.44.286 AM 1 1,702.55
85 86 02-MAY-18 02.00.11.423 AM 1 1,701.95
69 70 01-MAY-18 10.00.21.811 AM 1 1,675.91
77 78 01-MAY-18 06.00.37.335 PM 1 1,675.91
71 72 01-MAY-18 12.00.16.844 PM 1 1,675.83
52 53 30-APR-18 05.00.02.455 PM 2 1,109.93
101 102 02-MAY-18 06.00.39.504 PM 2 1,088.41
86 87 02-MAY-18 03.00.24.853 AM 2 1,049.19
53 54 30-APR-18 06.00.12.352 PM 2 1,036.89
44 45 30-APR-18 09.00.00.954 AM 2 1,026.10
BEGIN_SNAP END_SNAP BEGIN_TIMESTAMP INST DBTIME
---------- ---------- ---------------------------------------- ---------- -----------
51 52 30-APR-18 04.00.25.353 PM 2 1,017.33
50 51 30-APR-18 03.00.11.207 PM 2 1,003.77
45 46 30-APR-18 10.00.12.054 AM 2 1,003.51
47 48 30-APR-18 12.00.02.027 PM 2 1,002.93
46 47 30-APR-18 11.00.29.502 AM 2 1,002.87
48 49 30-APR-18 01.00.12.856 PM 2 1,002.62
49 50 30-APR-18 02.00.10.611 PM 2 1,002.43
43 44 30-APR-18 08.00.29.126 AM 2 880.34
繁忙
快照
报告
数据
数据库
程度
分析
语句
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
服务器日常维护协议
面向对象数据库技术视频
国家安全和国家网络安全
联想服务器数据如何导出
推进网络安全相关条例
网络安全审计报告内容
安徽c语言软件开发报价
西安网络技术支持招聘
衡阳市公安局网络安全检查
网络安全白无常
服务器冷却液龙头股票
大学生电脑数据库建设
游戏服务器程序码
数据库自动化测试
网络安全威胁实验
电科通信网络技术好吗
故障数据库
湖南学网络安全哪个学校好
casia夜间红外步态数据库
数据库社区门诊管理系统设计
软件开发行业五行属金吗
网络安全小技巧都有哪些
萤石云服务器域名解析失败
数据库计算乘积
学校党支部网络安全责任制
国外对网络安全意识的研究
oracle数据库岗位有
大型数据库概论答案
软件开发自已能做事
高中选修网络技术