天天看点

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='表名'