ORACLE index 随笔

索引类型
B-Tree
B-Tree Cluster
Hash Cluster
Reverse Key
BitMap
BitMap Join
Function-Based

索引创建
CREATE UNIQUE INDEX ind_name ON ct(name) tablespace TBS_01;
CREATE INDEX ind_name ON ct(name); –默认是B-Tree 索引
CREATE BITMAP INDEX ind_name ON ct(name);
CREATE INDEX ind_name ON ct(name) REVERSE;
CREATE INDEX ind_name ON ct(UPPER(name));

索引修改
ALTER INDEX ind_name rebuild;
ALTER INDEX ind_name rebuild TABLESPACE another;

删除索引
DROP INDEX ind_name;

数据字典
dba_indexes;
user_indexes
user_ind_columns

get_ddl.metadata(‘INDEX’,’ind_name’,’user’);
select * from dba_indexes;
select * from dba_indexes where table_name=’d’;
select index_name,tablespace_name from dba_indexes where table_name=’d’;

其他
ALTER session SET skip_unusable_indexes=true; –忽略索引无效的错误

select * from dba_indexes where lower(table_name)=’b’ ;
select * from dba_ind_columns where index_name=’c’;

//创建有索引及其索引列
column COLUMN_NAME format a20;
select ind.index_name,INDEX_TYPE,UNIQUENESS, indc.COLUMN_NAME
from dba_indexes ind
inner join dba_ind_columns indc on indc.index_name=ind.index_name
where lower(ind.table_name)=’a’ ;

你可能感兴趣的:(oracle)