oracle索引监控

时间:2015-04-30 17:51:13   收藏:0   阅读:114

目的:监控oracle索引的有效性,看索引有没有被使用。然后根据监控结果删除或者调整索引。

步骤:

1.监控指定索引

   命令: alter index  索引名 monitoring usage;  如:alter index User_IDX1 monitoring usage;

2.查看索引监控是否生效

  命令:select * from V$OBJECT_USAGE t where t.monitoring = ‘YES‘;

3.执行索引相关SQL

4.查看索引是否被使用

  命令:select * from V$OBJECT_USAGE t where t.monitoring = ‘YES‘;

5.取消索引监控

  命令: alter index 索引名 nomonitoring usage;  如:alter index User_IDX1 nomonitoring usage;

 

相关工具

  生成指定表所有索引监控命令的SQL:

    select ‘alter index ‘||index_name||‘ monitoring usage;‘ from user_indexes where table_name=upper(‘表名‘);

    如:select ‘alter index ‘||index_name||‘ monitoring usage;‘ from user_indexes where table_name=upper(‘User‘);

 

原文:http://www.cnblogs.com/jacktang/p/4469179.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!