ITPub博客

首页 > 数据库 > Oracle > 【INDEX】索引失效或者不可用 UNUSABLE

【INDEX】索引失效或者不可用 UNUSABLE

原创 Oracle 作者:xysoul_云龙 时间:2017-06-22 14:07:57 0 删除 编辑



在管理数据库过程中,我们经常遇到索引失效或者大量删除、插入表数据时暂时让索引失效,那么手动让索引暂时“失效”需要注意什么呢?


点击(此处)折叠或打开

  1. - -使索引失效的两条语句
  2. alter index index_name disable ;


  3. alter index index_name unusable


此处需要注意,两条语句执行条件。

disable 方式只能适用于函数索引 ,而当使用unusable方式时,索引需要rebuild或者直接drop。 官方说明如下:

点击( 此处)折叠或打开

  1. DISABLE Clause

  2. DISABLE applies only to a function -based index . This clause lets you disable the use of a function -based index . You might want to do so , for example , while working on the body of the function . Afterward you can either rebuild the index or specify another ALTER INDEX statement with the ENABLE keyword .



点击( 此处)折叠或打开

  1. UNUSABLE Clause

  2. Specify UNUSABLE to mark the index or index partition (s ) or index subpartition (s ) UNUSABLE . An unusable index must be rebuilt , or dropped and re -created , before it can be used . While one partition is marked UNUSABLE , the other partitions of the index are still valid . You can execute statements that require the index if the statements do not access the unusable partition . You can also split or rename the unusable partition before rebuilding it .

  3. Restriction on Marking Indexes Unusable
  4. You cannot specify this clause for an index on a temporary table .



点击( 此处)折叠或打开

  1. - -使索引生效语句

  2. alter index index_name enable ;

  3. alter index index_name rebuild





来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29487349/viewspace-2141124/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
主要从事Oracle数据库 DBA相关工作,其他操作系统、中间件等也有涉及,热衷分享。岁月老将至,如有幸在江湖中留点踪迹,也是欣慰。 【文盲筱烨】好读书爱运动的IT技术爱好者 微博:文盲筱烨 微信公众号:筱烨视点

注册时间:2014-02-15

  • 博文量
    412
  • 访问量
    1104610