zoukankan      html  css  js  c++  java
  • Oracle-降低表的高水位线

    在应用中存在一系列的表,对表的操作是批量插入又批量删除,最终导致表的水位线很高。高水位线影响全索引扫描的SQL。即影响系统的性能。

    现有方法降低表的水位线:

    1、降低表的高水位线
    select 'alter table '||TABLE_NAME||' move tablespace '||TABLESPACE_NAME||';' from user_tables where table_name='&TABLE_NAME';
    2、重建表上的索引
    select 'alter index '||index_name||' rebuild online;' from user_indexes where table_name='&TABLE_NAME';
    3、收集表上的统计信息
    select 'analyze table '||TABLE_NAME||' compute statistics;' from user_tables where table_name='&TABLE_NAME';
    4、收集索引上的统计信息
    select 'analyze index '||index_name||' compute statistics;' from user_indexes where table_name='&TABLE_NAME';

    注意:

    1、需将对应的表名替换'&TABLE_NAME',表名要大写,依次执行上述步骤的“查询结果”;

    2、需停服务执行,否则脚本报错;

  • 相关阅读:
    bash编程2
    bash简介1
    grep文本处理工具
    用户的环境变量
    用户,组,权限
    yum与rmp
    逻辑卷管理
    磁盘配额
    磁盘创建
    创建计划任务
  • 原文地址:https://www.cnblogs.com/handhead/p/13158177.html
Copyright © 2011-2022 走看看