Chinaunix首页 | 论坛 | 博客
  • 博客访问: 661406
  • 博文数量: 163
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1625
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-24 11:40
个人简介

资深Oracle数据库专家 OCM认证大师 10年数据库相关服务及开发经验 各类数据库相关方案的编写,管理及实施 数据中心数据库日常运维、大型项目割接、性能优化等方面有丰富的实战经验 客户包括: 电信,银行,保险,航空,国网,汽车,烟草等 想要一起学习探讨数据安全技术的请加qq群 256041954

文章分类

全部博文(163)

文章存档

2017年(2)

2016年(112)

2015年(38)

2014年(11)

我的朋友

分类: Oracle

2015-01-07 17:02:11


//表使用频率最高的100个表
SQL> execute statspack.snap (i_snap_level=>7, i_modify_parameter=>'true'); 


select table_owner    "table owner",
       table_name     "table name",
       command        "command issued",
       executions     "executions",
       disk_reads     "disk reads",
       gets           "buffer gets",
       rows_processed "rows processed"
  from (select distinct executions,
                        command,
                        table_owner,
                        table_name,
                        gets,
                        rows_processed,
                        disk_reads
          from (select decode(a.command_type,
                              2,
                              'insert ',
                              3,
                              'select ',
                              6,
                              'update  ',
                              7,
                              'delete ',
                              26,
                              'table lock  ') command,
                       c.owner table_owner,
                       c.name table_name,
                       sum(a.disk_reads) disk_reads,
                       sum(0 - a.executions) executions,
                       sum(a.buffer_gets) gets,
                       sum(a.rows_processed) rows_processed
                  from sys.v_$sql               a,
                       sys.v_$object_dependency b,
                       sys.v_$db_object_cache   c
                 where a.command_type in (2, 3, 6, 7, 26)
                   and b.from_address = a.address
                   and b.to_owner = c.owner
                   and b.to_name = c.name
                   and c.type = 'table'
                   and c.owner not in ('SYS', 'SYSTEM')
                 group by a.command_type, c.owner, c.name))
 where rownum <= 100;

阅读(1202) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~