Oracle之查詢索引、索引列等資訊
用user_indexes和user_ind_columns系統表檢視已經存在的索引
user_indexes: 系統檢視存放是索引的名稱以及該索引是否是唯一索引等資訊。
user_ind_column: 系統檢視存放的是索引名稱,對應的表和列等。
完整性約束
DBA_CONSTRAINTS、ALL_CONSTRAINTS和USER_CONSTRAINST 顯示有關約束的一般資訊。
查詢資料庫列級的約束資訊
DBA_CONS_COLUMNS、ALL_CONS_COLUMNS和USER_CONS_COLUMNS 顯示有關列的相關約束的一般資訊。
ALL_CONS_COLUMNS 檢視能夠顯示使用者可以訪問的所有表上約束的列資訊,而不管所有者是誰。
DBA_CONS_COLUMNS 檢視列出了整個資料庫的列級約束資訊。
USER_CONS_COLUMNS
資料字典表列說明:
---------------------------------------------------------------------------------
desc user_constraints
Name Comments
----------------- ---------------------------------------------------------------------------
OWNER Owner of the table
CONSTRAINT_NAME Name associated with constraint definition
CONSTRAINT_TYPE Type of constraint definition
TABLE_NAME Name associated with table with constraint definition
SEARCH_CONDITION Text of search condition for table check
R_OWNER Owner of table used in referential constraint
R_CONSTRAINT_NAME Name of unique constraint definition for referenced table
DELETE_RULE The delete rule for a referential constraint
STATUS Enforcement status of constraint - ENABLED or DISABLED
DEFERRABLE Is the constraint deferrable - DEFERRABLE or NOT DEFERRABLE
DEFERRED Is the constraint deferred by default - DEFERRED or IMMEDIATE
VALIDATED Was this constraint system validated? - VALIDATED or NOT VALIDATED
GENERATED Was the constraint name system generated? - GENERATED NAME or USER NAME
BAD Creating this constraint should give ORA-02436. Rewrite it before 2000 AD.
RELY If set, this flag will be used in optimizer
LAST_CHANGE The date when this column was last enabled or disabled
INDEX_OWNER The owner of the index used by the constraint
INDEX_NAME The index used by the constraint
INVALID
VIEW_RELATED
-------------------------------------------------------------------------------------------------------------------------------------------------
desc user_cons_columns;
Name Comments
--------------- -------------- -------- ------- ------------------------------------------------------------------------------------------------
OWNER Owner of the constraint definition
CONSTRAINT_NAME Name associated with the constraint definition
TABLE_NAME Name associated with table with constraint definition
COLUMN_NAME Name associated with column or attribute of object column specified in the constraint definition
POSITION Original position of column or attribute in definition