ITPUB论坛-中国最专业的IT技术社区

 找回密码
 注册
查看: 701|回复: 0

flash_cache预计使用大小统计sql

[复制链接]
论坛徽章:
0
发表于 2017-11-2 08:46 | 显示全部楼层 |阅读模式
本帖最后由 zhenggaona1 于 2017-11-8 11:01 编辑

with base as (select t.owner,object_name,subobject_name,sum(value*8192/1024/1024) as io_mb,s.bytes/1024/1024 as mb,sum(value*8192)/bytes as hot_level
from gV$SEGMENT_STATISTICS t,dba_segments s
where t.owner = s.owner
and t.OBJECT_NAME=s.segment_name
and t.subobject_name=s.partition_name
and t.value > 0
and statistic_name in('physical reads direct','physical reads','physical writes','physical writes direct')
and t.owner not in ('SYS','SYSMAN','DBSNMP','SYSTEM')
group by t.owner,object_name,subobject_name,s.bytes
union all
select t.owner,object_name,subobject_name,sum(value*8192/1024/1024) as io_mb,s.bytes/1024/1024 as mb,sum(value*8192)/bytes as hot_level
from gV$SEGMENT_STATISTICS t,dba_segments s
where t.owner = s.owner
and t.OBJECT_NAME=s.segment_name
and s.partition_name is null
and t.value > 0
and statistic_name in('physical reads direct','physical reads','physical writes','physical writes direct')
and t.owner not in ('SYS','SYSMAN','DBSNMP','SYSTEM')
group by t.owner,object_name,subobject_name,s.bytes
)
select '热度比率高于10' as "维度",ROUND(sum(mb/1024),2) as "limit size GB" from base where hot_level>10
union all
select '热度比率高于5' as "维度",ROUND(sum(mb/1024),2) as "limit size GB" from base where hot_level>5
union all
select '热度比率高于2' as "维度",ROUND(sum(mb/1024),2) as "limit size GB" from base where hot_level>2
union all
select '热度比率高于1.5' as "维度",ROUND(sum(mb/1024),2) as "limit size GB" from base where hot_level>1.5;

以上 sql 语句统计按照io大小统计rac系统内热对象,关键算法是使用io总和除以自身大小来计算io热度。可以帮你找出数据库中消耗io最高的segment



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

本版积分规则

TOP技术积分榜 社区积分榜 徽章 电子杂志 团队 统计 虎吧 老博客 知识索引树 读书频道 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档 | IT博客
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛 | SAP ERP系统
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 网站律师 隐私政策 知识产权声明
京ICP备16024965号 北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表