Oracle 執行 DDL 長時間無響應
Oracle資料庫上遇到一個很無語的問題。同事告訴我,不能刪除某個表的某個索引,其他操作都沒問題。看了一下,這個表只有幾千條資料,上面有2個組合唯一索引。刪除其中的一個唯一索引
SQL> drop index IDX_U_STDARD;
執行後,長時間無響應,不返回任何資訊,感覺是被鎖了,可查詢v$locked_object檢視,沒看到被鎖定的物件。(不清楚是否還有其他可藉助的檢視)
既然不能刪,看能不能disable掉
SQL> alter index IDX_U_STDARD disable;
還是一樣,長時間無響應。
如是,想到rebuild,這次執行很長時間後,居然成功了。
SQL> alter index IDX_U_STDARD rebuild;
Index altered.
太不容易了,再次disable看看。
SQL> alter index IDX_U_STDARD disable;
alter index IDX_U_STDARD disable
*
ERROR at line 1:
ORA-02243: invalid ALTER INDEX or ALTER MATERIALIZED VIEW option
終於看到錯誤提示了,離成功應該也就不遠了。馬上查詢該錯誤原因,原來disable 和 enable只針對函式索引有效,一般索引推薦unusable。
SQL> alter index IDX_U_STDARD unusable;
Index altered.
索引被設定為無用後,就可以刪除了。
SQL> drop index IDX_U_STDARD;
Index dropped.
對於該表上的另一個唯一索引,直接drop掉可以。
下面是找到的關於enable和diable的簡單使用說明。
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 as DETERMINISTIC
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.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9399028/viewspace-745093/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- azkaban執行任務長時間無法結束
- job 執行時間比排程間隔時間長
- Oracle DDL 執行過程Oracle
- 顯示oracle執行時間Oracle
- 使用 sail 執行 artisan 等命令無響應AI
- RHEL下oracle使用者執行rman無響應的解決Oracle
- 監控Oracle長時間執行的工作(v$session_longops)OracleSessionGo
- kill執行時間較長的會話會話
- Linux開機執行多長時間Linux
- logmnr挖掘中間有DDL的操作示例-對於執行DDL前的操作無法挖掘
- oracle查詢sql執行耗時、執行時間、sql_idOracleSQL
- DDL觸發器設定導致DDL無法執行(二)觸發器
- DDL觸發器設定導致DDL無法執行(一)觸發器
- 後臺執行以及保持程式在後臺長時間執行
- 時區調整對job的執行時間的影響
- c++ CopyFile函式響應時間過長問題。C++函式
- Win7程式響應時間過長怎麼辦Win7
- windows7系統程式響應時間長有妙招Windows
- Job長時間執行不能退出的分析
- Oracle DDL 執行過程【Blog 搬家】Oracle
- Mysql DDL出現長時間等待MDL問題分析MySql
- 並行查詢對於響應時間的影響實驗並行
- 檢視oracle系統的執行時間Oracle
- 記錄ORACLE語句的執行時間Oracle
- abap執行時間
- quartz不正常執行.執行一段時間後無故停止quartz
- 伺服器長時間執行如何做好維護伺服器
- 微服務中的事件、流程和長時間執行業務微服務事件行業
- MySQL表操作超時無響應MySql
- 效能分析之使用者數(執行緒數)/響應時間/TPS的關係執行緒
- 執行oracle DDL語句要注意的問題Oracle
- MySQL 執行 Online DDL 操作報錯空間不足?MySql
- 如何使用Docker構建執行時間較長的指令碼Docker指令碼
- 定位rac環境中某條sql執行時間過長SQL
- 使用Python獲取DNS解析時間和響應時間PythonDNS
- curl 請求獲取響應時間
- 流程分析響應時間的確定
- 獲取執行次數最多和單次執行時間最長的10個SQLSQL