2

可视化oracle性能图表之“每个活动类的活动会话”篇 -m6米乐安卓版下载

原创 赵全文 2021-11-30
2459

目录

前言

众所周知,从本月初到现在我已经连续在上连续发表了三篇原创博客文章,它们按发表的时间顺序(也是遵循由易到难的层层递进方式)是:

近日,我从emcc 13.5的被监控数据库的性能米乐app官网下载主页(默认选择的是“负载和容量”标签)上的“性能”标签发现了一个按活动类别“cpu”“user i/o”“wait”分类的“活动会话”图表,如下所示:


我对这个图表的理解是它更细粒度地将oracle的“平均活动会话”(aas)进行了基本的分类,使得我们更直观地能够了解到当前的数据库从cpu、io和等待这三个方面来看到底是在哪一方面出现了性能瓶颈。那么,今天我要和大家分享的就是,可视化oracle性能图表之“每个活动类的活动会话”篇。

经过最近几天的一番研究,我发现这个图表的相关sql查询只能查看“最近1小时”“最近1分钟”的数据。从oracle的官方文档19c中找到的查看最近24小时最近7天最近31天自定义时间段的视图是。现将它的介绍描述如下:

dba_hist_waitclassmet_history displays the history of the wait event class metric data kept by the workload repository.

从上面简要的介绍来看,dba_hist_waitclassmet_history的数据应该是保留到了awr中。但是我在11gr219c21c中却发现这个视图的查询数据均为。详见我的sql查询和结果:

sql*plus: release 11.2.0.4.0 production on mon nov 29 10:39:13 2021
米乐app官网下载 copyright (c) 1982, 2013, oracle.  all rights reserved.
connected to:
oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production
with the partitioning, olap, data mining and real application testing options
10:39:57 sql> select count(*) from dba_hist_waitclassmet_history;
  count(*)
----------
         0
sql*plus: release 19.0.0.0.0 - production on mon nov 29 10:40:52 2021
version 19.3.0.0.0
米乐app官网下载 copyright (c) 1982, 2019, oracle.  all rights reserved.
connected to:
oracle database 19c enterprise edition release 19.0.0.0.0 - production
version 19.3.0.0.0
10:40:52 sql> select count(*) from dba_hist_waitclassmet_history;
  count(*)
----------
         0
sql*plus: release 21.0.0.0.0 - production on mon nov 29 10:41:12 2021
version 21.3.0.0.0
米乐app官网下载 copyright (c) 1982, 2021, oracle.  all rights reserved.
connected to:
oracle database 21c enterprise edition release 21.0.0.0.0 - production
version 21.3.0.0.0
10:41:12 sql> select count(*) from dba_hist_waitclassmet_history;
  count(*)
----------
         0

于是,我在的发了一个,静等专家朋友们的答复吧。所以目前仅能从个维度(最近1小时最近1分钟)来详细阐述相关的可视化操作了。由于这个图表只是基本的“面积堆叠图”,因此我们仍然使用中的用户自定义报告进行可视化即可。

[返回顶部目录]

维度目录列表

最近1小时的每个活动类的活动会话

用ash查看活动会话

从先前的“活动类别”图表中看到纵坐标轴(y轴)的名称为“active sessions”(活动会话)和相应图例的名称从下往上依次为:cpuuser i/owait,所以我们会非常自然地想到oracle查询活动会话历史的视图。详见我的sql查询代码和查询结果(因为返回行数太多,所以仅以2021-11-29 14:07”为例):
-- active sessions (in ash) per activity class from emcc 13.5 in last 1 hour.
set linesize 200
set pagesize 200
column sample_time    format a19
column activity_class format a15
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
select trunc(cast(sample_time as date), 'mi') sample_time
     , decode(wait_class, 'user i/o', 'user i/o', null, 'cpu', 'wait') activity_class
     , round(count(*)/6e1, 4) active_sessions
from v$active_session_history
where (wait_class <> 'idle' or wait_class is null)
and   cast(sample_time as date) >= sysdate - 1/24
group by trunc(cast(sample_time as date), 'mi')
       , decode(wait_class, 'user i/o', 'user i/o', null, 'cpu', 'wait')
order by activity_class
       , sample_time
;
sample_time         activity_class  active_sessions
------------------- --------------- ---------------
......
2021-11-29 14:07:00 cpu                       .3833  <<==
......
2021-11-29 14:06:00 user i/o                  .0167  ?
......
2021-11-29 14:07:00 wait                     1.6333  <<==
......
123 rows selected.

接着我们去查看同一时间(“2021-11-29 14:07”)emcc 13.5图表中显示的数据(以便和上述ash中的数据进行对比),如下三图(依次为:cpuuser i/owait)所示:




经过反复的对比,始终发现两者之间存在一定的差异,这也间接说明一个问题,我们的sql查询不匹配emcc的图表数据,也有可能emcc图表的数据来源不是我们前面的那个sql查询。

[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

通过asktom寻求帮助

于是,我到上寻求的帮助,请看或下面的张屏幕截图:



第二个图中我们可以看到,connor建议去查询列usecs_per_row(从12.2版本开始提供)。于是,我稍微调整了前面的sql代码并在我的测试库19.3中进行相应的查询,结果同样让我大跌眼镜,仍旧存在差异。索性又给connor做了回复,如下图所示:


后来,他这样说道,已和em团队进行沟通,可能不只是sql,或许有其他因素决定,数据不可能100%一致。


到此为止,我卡住了!!!难道止步不前吗?

[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

感谢kyle hailey

此时,我突然想到了kyle hailey的这篇文章,尤其在最后的更新段落中,他的部分sql代码给了我一些非常有价值的线索,因此只截取这部分代码,如下所示:

......
select
                 decode(n.wait_class,'user i/o','user i/o',
                                     'commit','commit',
                                     'wait')                               class,
                 sum(round(m.time_waited/m.intsize_csec,3))                aas,
                 begin_time ,
                 end_time
           from  v$waitclassmetric  m,
                 v$system_wait_class n
           where m.wait_class_id=n.wait_class_id
             and n.wait_class != 'idle'
           group by  decode(n.wait_class,'user i/o','user i/o', 'commit','commit', 'wait'), begin_time, end_time
          union
             select 'cpu_ora_consumed'                                     class,
                    round(value/100,3)                                     aas,
                 begin_time ,
                 end_time
             from v$sysmetric
             where metric_name='cpu usage per sec'
               and group_id=2
......

从上面的代码中我们可以看到,kyle hailey使用视图、和来查询cpu、user i/o和wait。这里引用一下官档19c中对这些视图的简要描述:

v$waitclassmetric displays metric values of wait classes for the most recent 60-second interval. a history of the last one hour will be kept in the system.

v$system_wait_class displays the instance-wide time totals for each registered wait class.

v$sysmetric displays the system metric values captured for the most current time interval for both the long duration (60-second) and short duration (15-second) system metrics.

通过前面的描述,我们已经知道这几个视图可以查询最近60秒(也就是1分钟)的度量数据。而我们这里要查询的是最近1小时的数据,非常巧合的是,官档中呈现的是一个视图列表,在视图v$waitclassmetric后面紧接着的是另一个相关的视图,它可以查询最近1小时的度量数据,官档的描述是这样的:

v$waitclassmetric_history displays metric values of wait classes for all intervals in the last one hour.

the columns for v$waitclassmetric_history are the same as those for v$waitclassmetric.

视图同样如此,它也可以查询最近1小时的度量数据,在此也引用一下官档的描述:

v$sysmetric_history displays all system metric values available in the database. both long duration (60-second with 1 hour history) and short duration (15-second with one-interval only) metrics are displayed by this view.

[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

探索cpu

说到这里,让我们先查询一下度量名称cpu usage per sec”的度量单位,详见如下sql代码和查询结果:

set linesize 200
column metric_name format a30
column metric_unit format a25
select distinct metric_name
     , metric_unit
from v$sysmetric_history
where metric_name like '%cpu%'
order by 1
;
metric_name                    metric_unit
------------------------------ -------------------------
background cpu usage per sec   centiseconds per second
cpu usage per sec              centiseconds per second
cpu usage per txn              centiseconds per txn
database cpu time ratio        % cpu/db_time
host cpu usage per sec         centiseconds per second
host cpu utilization (%)       % busy/(idle busy)
6 rows selected.

我们注意到,它的度量单位是“厘秒每秒”,所以我们在相应的sql查询中应该将“cpu usage per sec”的值除以100折/换算成“秒每秒”。接着我们用视图v$sysmetric_history去查询按cpu分类的活动会话数据,sql代码和查询结果如下所示(仍以“2021-11-29 14:07”为例,这样有利于和emcc的图表数据进行对比):

-- 'cpu usage per sec' is right to the legend 'cpu' from the "active sessions per activity class" graph of emcc 13.5.
set linesize 200
set pagesize 100
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.9999
select to_char(end_time, 'hh24:mi:ss') sample_time
     , decode(metric_name, 'cpu usage per sec', 'cpu') metric_name
     , round(value/1e2, 4) active_sessions
from v$sysmetric_history
where metric_name = 'cpu usage per sec'
and   group_id = 2
and   end_time >= sysdate - interval '60' minute
order by sample_time
;
sample_time metric_name active_sessions
----------- ----------- ---------------
......
14:07:29    cpu                   .8005
......
60 rows selected.

非常棒,这次终于(和前面呈现的emcc中cpu0.8005的取值相同)一致了,这正是我翘首以盼的结果,虽然它来得迟了一些,索性再贴一下吧,哈哈!!!


[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

探索user i/o

马不停蹄,我们接着用视图v$waitclassmetric_historyv$system_wait_class进行关联去查按user i/o分类的活动会话数据,具体的sql查询和查询结果(只显示“2021-11-29 14:07”这一行)是:

-- 'user i/o' is right as well to the legend 'user i/o' from the "active sessions per activity class" graph of emcc 13.5.
set linesize 200
set pagesize 100
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.9999
select to_char(wcmh.end_time, 'hh24:mi:ss') sample_time
     , swc.wait_class metric_name
     , round(wcmh.time_waited/wcmh.intsize_csec, 4) active_sessions
from v$waitclassmetric_history wcmh
   , v$system_wait_class swc
where wcmh.wait_class_id = swc.wait_class_id
and   swc.wait_class = 'user i/o'
and   wcmh.end_time >= sysdate - interval '60' minute
order by sample_time
;
sample_time metric_name active_sessions
----------- ----------- ---------------
......
14:07:29    user i/o              .0064
......
60 rows selected.

这个结果也和先前的emcc图表的显示数据惊人的一致,不信你看!


[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

探索wait

戒骄戒躁,我们来想一想这个wait分类如何查询呢?与此同时,我在视图v$sysmetric_history的列metric_name中发现了两个有用的度量名称database time per secdatabase wait time ratio,相关的查询为:

set linesize 200
column metric_name format a30
column metric_unit format a25
select distinct metric_name
     , metric_unit
from v$sysmetric_history
where metric_name like '�tabase%'
order by 1
;
metric_name                    metric_unit
------------------------------ -------------------------
database cpu time ratio        % cpu/db_time
database time per sec          centiseconds per second
database wait time ratio       % wait/db_time

将二者相乘,岂不是我们想要的wait查询?话不多说,详见如下代码和查询结果(只显示“2021-11-29 14:07”这一行):

-- but 'wait' is still not fully identical to emcc 13.5 when using 'database time per sec' * 'database wait time ratio'.
set linesize 200
set pagesize 100
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.9999
with
wait as
(
  select to_char(end_time, 'hh24:mi:ss') sample_time
         , max(decode(metric_name, 'database time per sec'   , value/1e2)) aas_value
         , max(decode(metric_name, 'database wait time ratio', value/1e2)) wait_ratio
  from v$sysmetric_history
  where metric_name in ('database time per sec', 'database wait time ratio')
  and   group_id = 2
  and   end_time >= sysdate - interval '60' minute
  group by to_char(end_time, 'hh24:mi:ss')
  order by sample_time
)
select sample_time
     , 'wait' metric_name
     , round(aas_value*wait_ratio, 4) active_sessions
from wait
;
sample_time metric_name active_sessions
----------- ----------- ---------------
......
14:07:29    wait                  .5928
......
60 rows selected.

傻眼了,和先前的emcc中显示的数据完全不一样!!!


失败是成功之母。或者说,不经一番寒彻骨怎得梅花扑鼻香。让我们换位思考一下,既然user i/o是一种等待类别cpu不是),那么这个wait会不会是其余所有等待类别的总和?另外,这是我们从视图v$system_wait_class中查询到的所有等待类别

select distinct wait_class
from v$system_wait_class
order by 1
;
wait_class
---------------
administrative
application
commit
concurrency
configuration
idle
network
other
scheduler
system i/o
user i/o
11 rows selected.

基于这个猜想,让我们去探索一番:

-- 'wait' is fairly precise to the legend 'wait' from the "active sessions per activity class" graph of emcc 13.5.
set linesize 200
set pagesize 100
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.9999
select to_char(wcmh.end_time, 'hh24:mi:ss') sample_time
     , 'wait' metric_name
     , sum(round(wcmh.time_waited/wcmh.intsize_csec, 4)) active_sessions
from v$waitclassmetric_history wcmh
   , v$system_wait_class swc
where wcmh.wait_class_id = swc.wait_class_id
and   (swc.wait_class not in ('idle', 'user i/o'))
and   wcmh.end_time >= sysdate - interval '60' minute
group by to_char(wcmh.end_time, 'hh24:mi:ss')
order by sample_time
;
sample_time metric_name active_sessions
----------- ----------- ---------------
......
14:07:29    wait                 2.2382
......
60 rows selected.

果不其然,这回终于和emcc上显示的数据(请查看上一张屏幕截图)相同了,瞬间会不会有一种欣喜的感觉?哈哈。。。

[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

用公用表表达式整合cpu、user i/o和wait

至此,我们已经把三个类别的sql查询都写出来了,那就用“with ... as ()”整合成一个完整的吧,请看下面(附带查询数据):

-- at this moment 'cpu', 'user i/o' and 'wait' are all same as the "active sessions per activity class" graph from emcc 13.5. congrats!!!
-- note: using the column 'time_waited' (rather than 'time_waited_fg') of view "v$waitclassmetric_history" to acquire 'user i/o' and 'wait'.
-- active sessions per activity class (cpu, user i/o and wait) from emcc 13.5 in last 1 hour.
set linesize 200
set pagesize 200
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.9999
with
cpu as
(
  select to_char(end_time, 'hh24:mi:ss') sample_time
       , decode(metric_name, 'cpu usage per sec', 'cpu') metric_name
       , round(value/1e2, 4) active_sessions
  from v$sysmetric_history
  where metric_name = 'cpu usage per sec'
  and   group_id = 2
  and   end_time >= sysdate - interval '60' minute
  order by sample_time
),
user_io as
(
  select to_char(wcmh.end_time, 'hh24:mi:ss') sample_time
       , swc.wait_class metric_name
       , round(wcmh.time_waited/wcmh.intsize_csec, 4) active_sessions
  from v$waitclassmetric_history wcmh
     , v$system_wait_class swc
  where wcmh.wait_class_id = swc.wait_class_id
  and   swc.wait_class = 'user i/o'
  and   wcmh.end_time >= sysdate - interval '60' minute
  order by sample_time
),
wait as
(
  select to_char(wcmh.end_time, 'hh24:mi:ss') sample_time
       , 'wait' metric_name
       , sum(round(wcmh.time_waited/wcmh.intsize_csec, 4)) active_sessions
  from v$waitclassmetric_history wcmh
     , v$system_wait_class swc
  where wcmh.wait_class_id = swc.wait_class_id
  and   (swc.wait_class not in ('idle', 'user i/o'))
  and   wcmh.end_time >= sysdate - interval '60' minute
  group by to_char(wcmh.end_time, 'hh24:mi:ss')
  order by sample_time
)
select * from cpu
union all
select * from user_io
union all
select * from wait
;
sample_time metric_name active_sessions
----------- ----------- ---------------
......
14:07:29    cpu                   .8005
......
14:07:29    user i/o              .0064
......
14:07:29    wait                 2.2382
......
180 rows selected.

[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

用oracle sql developer 21.2可视化

导入(具体步骤:1. 下载刚提到的xml文件到本地电脑;2. 在sql developer中右击用户自定义报告,然后选择打开报告,去选择刚才的xml文件即可完成导入操作)到我的sql developer 21.2用户自定义报告当中,然后连接相应的数据库,就可以看到下面的可视化图表:




[返回最近1小时的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

最近1分钟的每个活动类的活动会话

完整的sql查询代码

前面用过多的篇幅详细阐述了最近1小时活动会话情况,这里我们就省略了一些分析步骤,直接贴上我们最终写好的sql查询和查询结果:
-- active sessions per activity class (cpu, user i/o and wait) from emcc 13.5 in last 1 minute.
set linesize 200
set pagesize 10
column sample_time     format a11
column metric_name     format a11
column active_sessions format 999,999.99
with
cpu as
(
  select to_char(end_time, 'hh24:mi:ss') sample_time
       , decode(metric_name, 'cpu usage per sec', 'cpu') metric_name
       , round(value/1e2, 2) active_sessions
  from v$sysmetric
  where metric_name = 'cpu usage per sec'
  and   group_id = 2
  order by sample_time
),
user_io as
(
  select to_char(end_time, 'hh24:mi:ss') sample_time
       , swc.wait_class metric_name
       , round(wcm.time_waited/wcm.intsize_csec, 2) active_sessions
  from v$waitclassmetric wcm
     , v$system_wait_class swc
  where wcm.wait_class_id = swc.wait_class_id
  and   swc.wait_class = 'user i/o'
  order by sample_time
),
wait as
(
  select to_char(end_time, 'hh24:mi:ss') sample_time
       , 'wait' metric_name
       , sum(round(wcm.time_waited/wcm.intsize_csec, 2)) active_sessions
  from v$waitclassmetric wcm
     , v$system_wait_class swc
  where wcm.wait_class_id = swc.wait_class_id
  and   (swc.wait_class not in ('idle', 'user i/o'))
  group by to_char(end_time, 'hh24:mi:ss')
  order by sample_time
)
select * from cpu
union all
select * from user_io
union all
select * from wait
;
sample_time metric_name active_sessions
----------- ----------- ---------------
14:27:29    cpu                     .32
14:27:29    user i/o                .00
14:27:29    wait                    .59

来和emcc的对比一下呗,嘿嘿!!!



那么,总的活动会话值是多少呢?在emcc的“负载和容量”标签页中已经告诉了我们:


[返回最近1分钟的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

用oracle sql developer 21.2可视化

因为在前一维度的可视化操作中导入的xml文件里已经包含了这一维度的图表可视化设置功能,所以我们找到相应的报告直接进行可视化,详见如下两图(1分钟的时间过的真得很快,我只能截取另一个时间点15:10,而不是前面的14:07,哈哈):



[返回最近1分钟的每个活动类的活动会话]

[返回维度目录列表]

[返回顶部目录]

活动会话负载总览

在emcc的米乐appm6米乐安卓版下载官网下载首页有一个oracle load map,它列出了每一个数据库的活动会话总览情况,如:cpu、io和wait,还是这三个分类呀,说来够巧的。但是也很奇怪,我观察了一段时间,发现它们三个值和总计值(它们的总和)始终没有任何变化。看来它不应该是最近1分钟的情况,因为最近1分钟的值总是会有变化的,有可能是最近1小时的平均值,这个我没有具体去研究,只是猜测,等抽空看看em的官档中有关这个load map的解释,所以这里就只贴一个图吧。


[返回顶部目录]

获取图表的图例颜色

有的小伙伴可能会问,sql developer里的可视化图表的图例颜色为什么和emcc图表的图例几乎一样,你是怎么做到的呢?这里,我用了一个小窍门儿。那就是将emcc图表的每一个图例都截图保存成图片,然后在上传我保存的图片让其识别出相应的rgb颜色值(十六进制),接着我在sql developer的用户自定义报告中进行可视化设置时输入了对应图例的rgb颜色值(十六进制)。那么,这篇文章中用到的图表图例rgb颜色值是:

-- each legend color from the graph of "active sessions per activity class" of emcc 13.5.
-- 
-- cpu     , #00cf30 -> rgb (0  , 207, 48 )
-- user i/o, #004ce6 -> rgb (0  , 76 , 230)
-- wait    , #fa5f00 -> rgb (250, 95 , 0  )

至此,可视化oracle性能图表之“每个活动类的活动会话”篇今天就分享到这里结束了,其中最核心的sql源代码您也可以从上查看,欢迎各路亲朋好友提出宝贵意见和建议,小编一定会再接再励,竭尽所能给大家奉献更多更具有价值的深度原创技术好文。

[返回顶部目录]

参考文章



[返回顶部目录]

更新于 2021年11月30日 下午:

授人以鱼不如授人以渔,在上还没有解决我的困惑之前,我在最近的评论中这样回复道:



更新于 2021年12月9日 下午:

关于视图dba_hist_waitclassmet_history的返回行为什么为0?后来(世界级的oracle大师)这样回复道,以下直接是翻译后的引用内容:

这一定是一个经过深思熟虑的编码决策,可能有一个隐藏参数(或对内部包的调用)改变了oracle访问相关x$表的方式,但如果跟踪快照代码,您可以看到应该从x$表填充相关wrh$表的sql语句,然后看到那里没有任何内容。

接着是的回复,也引用如下:

是的,我记得空的 dba_hist_waitclassmet_history 令人困惑。
我相信 dba_hist_waitclassmet_history 仅用于在违反某些限制时提醒条目。
我已经很久没有看这些东西了。

统计数据
dba_hist_sysmetric_summary – 最大、最小、平均标准偏差
dba_hist_sysstat(累计)
dba_hist_sysmetric_history(警报)
等待
waitclassmetric_history(警报)
dba_hist_system_event(累计)
文件io
dba_hist_filemetric_history(警报)
dba_hist_filestatxs(累计)

随后,我也进行了相关的回复,内容为:

抱歉,dba_hist_filemetric_history 也返回了 0 行,kyle! 我调用了 dbms_metadata.get_ddl() 来检查定义的视图。

set verify off
set long 1000000000
set linesize 200
set pagesize 200

prompt ==================
prompt   running on sys schema
prompt ==================

select dbms_metadata.get_ddl(upper('&object_type'), upper('&object_name'), upper('&owner_name')) from dual
/


enter value for object_type: view
enter value for object_name: dba_hist_waitclassmet_history
enter value for owner_name: sys

dbms_metadata.get_ddl(upper('view'),upper('dba_hist_waitclassmet_history'),upper
--------------------------------------------------------------------------------

create or replace force view "sys"."dba_hist_waitclassmet_history" ("snap_id", "dbid", "instance_number", "wait_class
_id", "wait_class", "begin_time", "end_time", "intsize", "group_id", "average_wa
iter_count", "dbtime_in_wait", "time_waited", "wait_count", "time_waited_fg", "w
ait_count_fg") as
select em.snap_id, em.dbid, em.instance_number,
em.wait_class_id, wn.wait_class, begin_time, end_time, intsize,
group_id, average_waiter_count, dbtime_in_wait,
time_waited, wait_count, time_waited_fg, wait_count_fg
from wrm$_snapshot sn, wrh$_waitclassmetric_history em,
(select wait_class_id, wait_class from wrh$_event_name
group by wait_class_id, wait_class) wn
where em.wait_class_id = wn.wait_class_id
and sn.snap_id = em.snap_id
and sn.dbid = em.dbid
and sn.instance_number = em.instance_number
and sn.status = 0

sql> select count(*) from wrh$_waitclassmetric_history;

count(*)
-----------
              0

set verify off
set long 1000000000
set linesize 200
set pagesize 200

prompt ==================
prompt   running on sys schema
prompt ==================

select dbms_metadata.get_ddl(upper('&object_type'), upper('&object_name'), upper('&owner_name')) from dual
/


enter value for object_type: view
enter value for object_name: dba_hist_filemetric_history
enter value for owner_name: sys

dbms_metadata.get_ddl(upper('view'),upper('dba_hist_filemetric_history'),upper('
--------------------------------------------------------------------------------

create or replace force view "sys"."dba_hist_filemetric_history" ("snap_id", "dbid", "instance_number", "fileid", "cr
eationtime", "begin_time", "end_time", "intsize", "group_id", "avgreadtime", "av
gwritetime", "physicalread", "physicalwrite", "phyblkread", "phyblkwrite") as
select fm.snap_id, fm.dbid, fm.instance_number,
fileid, creationtime, begin_time,
end_time, intsize, group_id, avgreadtime, avgwritetime,
physicalread, physicalwrite, phyblkread, phyblkwrite
from wrm$_snapshot sn, wrh$_filemetric_history fm
where sn.snap_id = fm.snap_id
and sn.dbid = fm.dbid
and sn.instance_number = fm.instance_number
and sn.status = 0

sql> select count(*) from wrh$_filemetric_history;

count(*)
-----------
             0

最后修改时间:2021-12-09 16:56:45
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图