Validating Tables, Indexes, Clusters, and Materialized Views

startay發表於2016-01-08

Validating Tables, Indexes, Clusters, and Materialized Views

使用ANALYZE VALIDATE STRUCTURE驗證 表、索引、群集、物化檢視結構的完整性。如果物件的結構有效,則會順利驗證透過,反之則會報錯。(如:表異常的ORA-01498,索引的ORA-01499)
To verify the integrity of the structure of a table, index, cluster, or materialized view, use the ANALYZE statement with the VALIDATE STRUCTURE option. If the structure is valid, no error is returned. However, if the structure is corrupt, you receive an error message.

例如:在極少情況下,硬體或系統出現異常時,索引可能會出現損壞且不能被正常使用。 當Validating驗證索引時,會逐條的檢查索引條目與關聯表對應記錄的準確性。 如果發現索引出現異常,可刪除它重建。
For example, in rare cases such as hardware or other system failures, an index can become corrupted and not perform correctly. When validating the index, you can confirm that every entry in the index points to the correct row of the associated table. If the index is corrupt, you can drop and re-create it.

如果表、索引、群集驗證是損壞的,可以刪除,重建。如果是物化檢視,可以使用complete refresh來修復該問題,如果仍然有誤,則需要重建。
If a table, index, or cluster is corrupt, you should drop it and re-create it. If a materialized view is corrupt, perform a complete refresh and ensure that you have remedied the problem. If the problem is not corrected, drop and re-create the materialized view.

The following statement analyzes the emp table:
下面是檢驗table的語句:

ANALYZE TABLE emp VALIDATE STRUCTURE;

You can validate an object and all related objects (for example, indexes) by including the CASCADE option. The following statement validates the emptable and all associated indexes:
可以使用cascade選項,檢驗與表相關聯的物件(如:所有索引

ANALYZE TABLE emp VALIDATE STRUCTURE CASCADE;

ou can specify that you want to perform structure validation online while DML is occurring against the object being validated. There can be a slight performance impact when validating with ongoing DML affecting the object, but this is offset by the flexibility of being able to perform ANALYZE online. The following statement validates the emp table and all associated indexes online:

ANALYZE TABLE emp VALIDATE STRUCTURE CASCADE ONLINE;


可參考官方文件:

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17086096/viewspace-1973745/,如需轉載,請註明出處,否則將追究法律責任。

相關文章