zoukankan      html  css  js  c++  java
  • 查询TOP50 DML的表

    查询上一次统计信息收集以来到现在的DML次数,如果收集了统计信息了,那么就清空了.

    select *
      from (select *
              from (select *
                      from (select u.name owner,
                                   o.name table_name,
                                   null partition_name,
                                   null subpartition_name,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO') truncated,
                                   m.drop_segments
                              from sys.mon_mods_all$ m,
                                   sys.obj$          o,
                                   sys.tab$          t,
                                   sys.user$         u
                             where o.obj# = m.obj#
                               and o.obj# = t.obj#
                               and o.owner# = u.user#
                            union all
                            select u.name,
                                   o.name,
                                   o.subname,
                                   null,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods_all$ m, sys.obj$ o, sys.user$ u
                             where o.owner# = u.user#
                               and o.obj# = m.obj#
                               and o.type# = 19
                            union all
                            select u.name,
                                   o.name,
                                   o2.subname,
                                   o.subname,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods_all$ m,
                                   sys.obj$          o,
                                   sys.tabsubpart$   tsp,
                                   sys.obj$          o2,
                                   sys.user$         u
                             where o.obj# = m.obj#
                               and o.owner# = u.user#
                               and o.obj# = tsp.obj#
                               and o2.obj# = tsp.pobj#)
                     where owner not like '%SYS%'
                       and owner not like 'XDB'
                    union all
                    select *
                      from (select u.name owner,
                                   o.name table_name,
                                   null partition_name,
                                   null subpartition_name,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO') truncated,
                                   m.drop_segments
                              from sys.mon_mods$ m,
                                   sys.obj$      o,
                                   sys.tab$      t,
                                   sys.user$     u
                             where o.obj# = m.obj#
                               and o.obj# = t.obj#
                               and o.owner# = u.user#
                            union all
                            select u.name,
                                   o.name,
                                   o.subname,
                                   null,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods$ m, sys.obj$ o, sys.user$ u
                             where o.owner# = u.user#
                               and o.obj# = m.obj#
                               and o.type# = 19
                            union all
                            select u.name,
                                   o.name,
                                   o2.subname,
                                   o.subname,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods$   m,
                                   sys.obj$        o,
                                   sys.tabsubpart$ tsp,
                                   sys.obj$        o2,
                                   sys.user$       u
                             where o.obj# = m.obj#
                               and o.owner# = u.user#
                               and o.obj# = tsp.obj#
                               and o2.obj# = tsp.pobj#)
                     where owner not like '%SYS%'
                       and owner not like '%XDB%')
             order by inserts desc)
     where rownum <= 50;

    相关的索引,只有delete次数多,delete数据量大,才需要rebuild

  • 相关阅读:
    JavaScript数组方法
    模拟js数组indexOf方法
    js数组排序
    发布Exchange的SMTP,POP3服务器:ISA2006系列之十八
    用智能卡构建身份验证的马其诺防线:ISA2006系列之二十三
    Java与CSharp的相同与不同
    创建可传递的林信任,Active Directory系列之二十
    组策略指派Office2003分发,Active Directory系列之二十三
    发布Exchange的RPC以及RPC Over HTTPS:ISA2006系列之十九
    初步理解组策略,Active Directory系列之二十一
  • 原文地址:https://www.cnblogs.com/nazeebodan/p/2782619.html
Copyright © 2011-2022 走看看