天天看點

oracle索引操作等

select * from all_indexes where table_name='表名' and owner='使用者名';  --查詢某使用者下某張表的所有索引   

create index 索引名 on 表名 (列名) --建立索引

alter index 舊索引名 rename to 新索引名;  --修改索引名稱
  
ALTER INDEX 索引名 COALESCE; --合并索引
  
ALTER INDEX 索引名 REBUILD;  --重建索引

DROP INDEX 索引名; --删索引

--查詢表注釋
select * from user_tab_comments where table_name='表名';
--user_tab_comments:table_name,table_type,comments
--相應的還有dba_tab_comments,all_tab_comments,這兩個比user_tab_comments多了ower列。

--擷取字段注釋:
select * from user_col_comments where table_name='表名';
--user_col_comments:table_name,column_name,comments

--查詢表限制
select constraint_name from dba_constraints where table_name='表名'