驗證Oracle 10g線上整理碎片索引是否失效過程
從Oracle 10g開始,Oracle推出了表格線上整理碎片的功能(An ALTER TABLE … SHRINK ),極大的提高了系統可用性。
那麼表格碎片整理之後,索引是否會失效呢?實驗結果來證明:
SQL> CREATE TABLE test_rowid (
2 id NUMBER,
3 pad VARCHAR2(4000),
4 CONSTRAINT test_rowid_pk PRIMARY KEY (id)
5 );
Table created.
SQL> INSERT INTO test_rowid
2 SELECT rownum AS id, dbms_random.string('p',500) AS pad
3 FROM dual
4 CONNECT BY level <= 200000;
200000 rows created.
SQL> create index idx_pad on test_rowid(pad);
Index created.
SQL> select sum(blocks) from dba_extents where owner='ZHOUL' and segment_name='TEST_ROWID';
SUM(BLOCKS)
———–
15360
SQL> create table test_rowid_old as select rowid "row_id",id,pad from test_rowid;
Table created.
SQL> delete from test_rowid where id>=100000 and id<150000;
50000 rows deleted.
SQL> commit;
Commit complete.
SQL> select sum(blocks) from dba_extents where owner='ZHOUL' and segment_name='TEST_ROWID';
SUM(BLOCKS)
———–
15360
SQL> alter table test_rowid enable row movement;
Table altered.
SQL> ALTER TABLE test_rowid SHRINK space cascade;
Table altered.
SQL> select sum(blocks) from dba_extents where owner='ZHOUL' and segment_name='TEST_ROWID';
SUM(BLOCKS)
———–
10864
SQL> create table test_rowid_new as select rowid "row_id",id,pad from test_rowid;
Table created.
SQL> select t1."row_id",t2."row_id",t1.id,t2.id from test_rowid_old t1,test_rowid_new t2 where t1."row_id"!=t2."row_id" and t1.id=t2.id and rownum<10;
row_id row_id ID ID
—————— —————— ———- ———-
AAF0CfAAFAAAE53AAA AAF0CfAAFAAAE5tAAE 151929 151929
AAF0CfAAFAAAE53AAB AAF0CfAAFAAAE5tAAF 151930 151930
AAF0CfAAFAAAE53AAC AAF0CfAAFAAAE5tAAG 151931 151931
AAF0CfAAFAAAE53AAD AAF0CfAAFAAAE5tAAH 151932 151932
AAF0CfAAFAAAE53AAE AAF0CfAAFAAAE5tAAI 151933 151933
AAF0CfAAFAAAE53AAF AAF0CfAAFAAAE5tAAJ 151934 151934
AAF0CfAAFAAAE53AAG AAF0CfAAFAAAE5tAAK 151935 151935
AAF0CfAAFAAAE53AAH AAF0CfAAFAAAE5tAAL 151936 151936
AAF0CfAAFAAAE53AAI AAF0CfAAFAAAE5tAAM 151937 151937
9 rows selected.
SQL> select INDEX_NAME,STATUS from dba_indexes where owner='ZHOUL' and lower(INDEX_NAME)='test_rowid_pk';
INDEX_NAME STATUS
—————————— ——–
TEST_ROWID_PK VALID
SQL> select INDEX_NAME,STATUS from dba_indexes where owner='ZHOUL' and lower(INDEX_NAME)='idx_pad';
INDEX_NAME STATUS
—————————— ——–
IDX_PAD VALID
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23732248/viewspace-2987191/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 索引碎片整理索引
- MySql ORDER BY索引是否失效MySql索引
- oracle索引核心過程Oracle索引
- Oracle 20c 新特性:Online SecureFiles Defragmentation 線上的 LOB 碎片整理OracleFragment
- Oracle資料表碎片整理Oracle
- Oracle資料庫表碎片整理Oracle資料庫
- oracle驗證設定的event是否生效:Oracle
- Oracle 資料庫整理表碎片Oracle資料庫
- Oracle 指令碼 線上哪些索引從來沒有被使用過Oracle指令碼索引
- HTTPS加密過程和TLS證書驗證HTTP加密TLS
- yaml線上驗證工具YAML
- 驗證是否成功
- oracle order by索引是否使用的情況Oracle索引
- 線上Bcrypt加密、驗證工具加密
- Oracle 10g expdp attach引數體驗Oracle 10g
- MySQL表碎片整理MySql
- Oracle 10g 在linux redhat as4 系統安裝圖解全過程Oracle 10gLinuxRedhat圖解
- 第12篇 window上驗證mysql是否安裝成功MySql
- 驗證碼---js重新整理驗證碼JS
- 驗證資料是否存在
- 索引失效場景索引
- 線上直播原始碼,通過手機號簡訊接收驗證碼原始碼
- 【TUNE_ORACLE】Oracle索引設計思想(二)索引過濾列概述Oracle索引
- 記一次Oracle分割槽表全域性索引重建的過程Oracle索引
- 理論+實驗 詳解Oracle安裝部署過程Oracle
- 【教程】無法驗證app需要網際網路連線以驗證是否信任開發者APP
- DV證書和OV證書驗證過程有什麼不一樣
- HTTPS會話過程整理HTTP會話
- mysql儲存過程整理MySql儲存過程
- mysql之 OPTIMIZE TABLE整理碎片MySql
- java實現手機簡訊驗證全過程Java
- nacos2.3 密碼驗證的處理過程密碼
- Oracle儲存過程Oracle儲存過程
- [資料庫]索引失效資料庫索引
- 線上的一次fullgc排查過程GC
- ElasticSearch分片互動過程(建立索引、刪除索引、查詢索引)Elasticsearch索引
- windows10系統磁碟碎片整理在哪 win10如何開啟磁碟碎片整理WindowsWin10
- oracle 10g flashback databaseOracle 10gDatabase