天萃荷净
汇总运维DBA日常工作对普通index索引以及唯一index索引的管理命令,创建、更改、删除普通index索引以及唯一index索引案例
--查看用户对象
SELECT OBJECT_NAME,OBJECT_TYPE FROM USER_OBJECTS;
--创建普通索引(指定pctfree,表空间,nologging模式)
create index fei_idx3 on fei(pwd,name) pctfree 20 tablespace users nologging;
--创建唯一索引
create unique index fei_idx1 on fei(id) pctfree 20 tablespace users nologging;
--创建bitmap index
create bitmap index fei_idx1 on fei(id) pctfree 20 tablespace users nologging;
--修改索引空间大小(增大)
alter index fei_idx1 allocate extent(size 2000k
datafile 'C:\oracle\product\10.2.0\oradata\orcl\users01.dbf');
--释放索引未空间
alter index fei_idx1 deallocate unused;
--rebuild索引(在线索引重建)
alter index fei_idx1 rebuild online;
--删除索引
drop index fei_idx1;
--coalescing 索引(索引融合 相当于windows的磁盘整理功能)
alter index fei_idx1 coalesce;
--对索引分析(判断该索引是否要rebuild,主要参数是lf_rows,del_lf_rows的比例)
analyze index fei_idx1 validate structure offline;
select * from index_stats;
--监控索引使用情况
alter index fei_idx1 monitoring usage;--开启监控
select * from v$object_usage;--监控的结果
alter index fei_idx1 nomonitoring usage;--关闭监控
--查看执行计划
set autot on exp;--开启
set autot off;--关闭
--相关视图查询
select * from dba_ind_columns WHERE INDEX_OWNER='CHF';
select * from dba_indexes where owner='CHF';
SELECT * FROM DBA_IND_STATISTICS WHERE owner='CHF';
--------------------------------------ORACLE-DBA----------------------------------------
最权威、专业的Oracle案例资源汇总之学习笔记:Oracle索引管理 DBA常用创建、删除、管理各种index索引命令汇总