• Oracle表变化趋势追踪记录 & 表 历史统计信息查看


    Oracle表变化趋势追踪记录

    DBA_HIST_SEG_STAT可以看出对象的使用趋势,构造如下SQL查询出每个时间段内数据库对象的增长量,其中DB_BLOCK_CHANGES_DELTA为块个数

    select c.SNAP_ID,
    to_char(c.END_INTERVAL_TIME, 'yyyy-mm-dd') SNAP_TIME,
    a.OWNER,
    a.OBJECT_NAME,
    a.OBJECT_TYPE,
    b.DB_BLOCK_CHANGES_DELTA
    from dba_objects a,
    (select SNAP_ID, obj#, DB_BLOCK_CHANGES_DELTA
    from DBA_HIST_SEG_STAT
    where DB_BLOCK_CHANGES_DELTA > 20000
    order by snap_id desc, DB_BLOCK_CHANGES_DELTA desc) b,
    DBA_HIST_SNAPSHOT c
    where a.object_id = b.obj#
    and object_type = 'TABLE'
    and b.SNAP_ID = c.SNAP_ID
    order by DB_BLOCK_CHANGES_DELTA
    ;

    下面的SQL查询出某个时间段内,数据库对象的变化大小,单位以换算成GB

    select a.OBJECT_NAME,
    to_char(c.END_INTERVAL_TIME, 'yyyy-mm-dd') SNAP_TIME,
    sum(b.DB_BLOCK_CHANGES_DELTA) / 1024 / 1024 GB
    from dba_objects a,
    (select
    SNAP_ID, obj#, DB_BLOCK_CHANGES_DELTA
    from DBA_HIST_SEG_STAT
    where DB_BLOCK_CHANGES_DELTA > 20000
    order by snap_id desc, DB_BLOCK_CHANGES_DELTA desc) b,
    DBA_HIST_SNAPSHOT c
    where a.object_id = b.obj#
    and object_type = 'TABLE'
    and b.SNAP_ID = c.SNAP_ID
    group by a.OBJECT_NAME, c.END_INTERVAL_TIME
    order by GB
    ;

    Oracle表 历史统计信息查看
    select obj#, savtime, rowcnt, blkcnt, avgrln, analyzetime
    from sys.wri$_optstat_tab_history
    where obj# = --5789486
    (select object_id
    from dba_objects
    where object_name = 'RPT_3DNAND_JGS_SEGMENT_TARGET' and owner='MIDB01')
    order by savtime;

    FAQ: Database Performance Frequently Asked Questions (Doc ID 1360119.1)

  • 相关阅读:
    性能测试(硬件性能指标汇总)
    jmeter中通过beanshell访问eclipse中导出jar中的java类的方法
    Linux性能优化参考
    单机到分布式集群简介
    java代码(生成日历时间)
    explian使用介绍
    java代码(处理json串)
    java代码(ascii与字母互转)
    jmeter分布式测试配置
    性能测试整体解决方案技术架构图、模型体系图、LR性能测试流程图
  • 原文地址:https://www.cnblogs.com/lipeng20004/p/13897642.html
Copyright © 2020-2023  润新知