Oracle里大量删除记录后,表和索引里占用的数据块空间并没有释放. table move可以释放已删除记录表占用的数据块空间,整理碎片.如果将表格用move方式整理碎片后,索引将失效,这时需要将索引重建. 重建索引可以释放已删除记录索引占用的数据块空间.重建索引不仅能增加索引表空间空闲空间大小,还能够提高查询性能. --table move alter table tbl move; --rebuild索引 alter index idx_tbl_col rebuild; alter inde
在ITPUB 论坛上看到的一个帖子,很不错.根据论坛的帖子重做整理了一下. 原文链接如下: alter index rebuild online引发的血案 http://www.itpub.net/thread-1445427-1-1.html 一. 官网说明 在MOS 上的一篇文章讲到了rebuild online 和offline的区别: Index Rebuild Is Hanging Or Taking Too Long [ID 272762.1] Symptoms:=========
oracle index build online与offline测试环境为oracle 11.2.0.4 --sql test SQL> conn test/test )); begin .. loop insert into test.rb_test values(i,'ok'); commit; end loop; end; / SQL> select count(*) from test.rb_test; COUNT(*) ---------- SQL> create index
On MSSQL server database, while rebuild index failed, we can use the follow sql statement to see if there are some tables' index setting block the operation. if there are some index of users' table in the query result, we can check if the option sett
背景:在一次某客户的停产维护中,有一项例行对大表rebuild索引的操作,本是按部就班的操作,其效果却出乎我的意料,大部分索引的效果前后都有4倍左右的变化,最大的那个索引前后居然差了7倍多,并且重建索引也没有用到压缩选项,这个与我之前的预期差距很大,化名记录下这个结果. 1. 重建索引 使用rebuild重建索引,因为是停产状态,无需加online选项: --rebuild index ALTER INDEX JINGYU.IDX_XXX_1 REBUILD NOCOMPRESS PARALLE
SQL> drop table test; 表已删除. SQL> create table test as select * from dba_objects where 1!=1; 表已创建. SQL> create index idx_test_id on test(object_id); 索引已创建. SQL> insert into test select * from dba_objects where object_id is not null and object_i
昨天因为工作中遇到要对某个数据库的表通通启用data_compression,突然有个念头,就是如果我当初用"ALTER INDEX XXX ON YYY REBUILD WITH (DATA_COMPRESSION = PAGE);"会不会把原先Index上的一些其他的选择设置给覆盖掉?那么我做了一个实验,结果是不会覆盖. 我在某张表上建了一个索引,CREATE INDEX语句后面的WITH()中跟上PAD_INDEX = ON.然后我再ALTER INDEX...REBUILD这个
Question: I have a SQL with multiple columns in my where clause. I know that Oracle can only choose one index, and I know about multi-column composite indexes, but I do not know how to determine the optimal column order for a composite index with m
avg_fragmentation_in_percent value Corrective statement > 5% and < = 30% ALTER INDEX REORGANIZE > 30% ALTER INDEX REBUILD WITH (ONLINE = ON)* * Rebuilding an index can be executed online or offline. Reorganizing an index is always executed online
索引是一个模式对象,其中包含每个值的条目,该条目出现在表或集群的索引列中,并提供对行的直接快速访问. 创建一个索引: create index 索引名 on 表名 (字段名); 删除索引: drop index 索引名 建立索引的目的就是为了加快查询速度,建立索引后会使DML操作效率慢,但是对用户查询会提高效率.删除一个表时,相对应的索引也会删除.另外,索引是会进行排序. 创建索引就是为了减少物理读,索引会减少扫描的时间.在经常要用到where的子句的字段,应该使用索引,另外还要看所查询的数
如语句:type numbers is table of number index by binary_integer;其作用是,加了”index by binary_integer ”后,numbers类型的下标就是自增长,numbers类型在插入元素时,不需要初始化,不需要每次extend增加一个空间. 而如果没有这句话“index by binary_integer”,那就得要显示对初始化,且每插入一个元素到numbers类型的table中时,都需要先extend. 示例: 没加“in
[转自] http://blog.chinaunix.net/uid-14669803-id-2921539.html DECLARE TYPE t_list_1 IS TABLE OF VARCHAR2(1024) ; -- 非标号,需要动态初始化,动态extend TYPE t_list_2 IS TABLE OF VARCHAR2(1024) INDEX BY Binary_Integer; -- 标号数组,不需要动态申请 -- 非标号数组 v_list_11 t_list_1 := t_
一.普通索引是否失效 select * from dba_indexes s where s.owner in ('ISMP','BOSS','PAY','ACCOUNT','SETTLE','TEMP_DSF') and s.status!='VALID'; 二.分区索引状态select * from dba_ind_partitions l where l.index_owner in ('ISMP','BOSS','PAY','ACCOUNT','SETTLE','TEMP_DSF')
参考文献: http://technet.microsoft.com/en-us/library/ms188388.aspx 正文 本文主要讲解如何使用alter index来rebuild和reorganize索引来清除碎片,rebuild能够完全清除碎片,但是reorganize却不能. Rebuild index --1.准备实验数据 select * into Employee from AdventureWorks2008R2.HumanResources.Employee; --2.