日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

索引unusable|disable|enable

發(fā)布時(shí)間:2024/8/26 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 索引unusable|disable|enable 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ORACLE使索引變成不可用的狀態(tài):
alter index index_name unusable;
執(zhí)行成功后,如果后續(xù)需要再用到該索引的話,就必須重建。重建后會(huì)自動(dòng)變成usable。
根據(jù)ORACLE官方文檔的說(shuō)法(An unusable index must be rebulit , or dropped and re-created , before it can be used.)
重建有兩種方式
1. rebuild
?? alter index index_name rebuild;
2. drop掉該索引,然后再重建。
?? drop index index_name;
?? create index index_name on xxxxx;
實(shí)際上這兩種操作的結(jié)果是一樣的,都是刪除再重新啟用,不過(guò)rebulid方式更為快捷和簡(jiǎn)單。

另外,數(shù)據(jù)庫(kù)還有兩種修改INDEX狀態(tài)的語(yǔ)句,叫disable和enable;

1. enable index
?? alter index index_name enable;
2. disable index
?? alter index index_name disable;


兩者的區(qū)別是:enable和disable僅僅只針對(duì)函數(shù)索引。
ORACLE官方文檔提供的說(shuō)法是:

ENABLE Clause

Enable applies only to a function-based index that has been disabled because a user-defined function used by the index was dropped or replaced. This clause enables such an index if these conditions are true:

The function is currently valid

The signature of the current function matches the signature of the function when the index was created

The function is currently marked asDETERMINISTIC

Restriction on Enabling Function-based Indexes You cannot specify any other clauses of ALTER INDEX in the same statement with ENABLE.

DISABLE Clause

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.

UNUSABLE Clause

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.

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

如果發(fā)現(xiàn)一個(gè)索引失效以后,對(duì)其使用enable命令,可能會(huì)引發(fā)ORA-02243的錯(cuò)誤,這是由于ENABLE只針對(duì)函數(shù)索引有效,可以試試rebuild,如果對(duì)一個(gè)索引執(zhí)行失效命令,也可能會(huì)遇到這個(gè)錯(cuò)誤,原因是一樣的。
因此,修改你的命令就可以啦~~

總結(jié)

以上是生活随笔為你收集整理的索引unusable|disable|enable的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。