Print
카테고리: [ Oracle Database ]
조회수: 6691

1. 확인

1-1. 최초 상태

SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN from index_stats;

  LF_ROWS      LF_BLKS         LF_ROWS_LEN    DEL_LF_ROWS     DEL_LF_ROWS_LEN
----------  ----------         -----------    -----------     ---------------
    100000        199              1588892              0                   0

1-2. 대량 데이터 삭제 후

SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN from index_stats;

  LF_ROWS      LF_BLKS         LF_ROWS_LEN    DEL_LF_ROWS     DEL_LF_ROWS_LEN
----------  ----------         -----------    -----------     ---------------
     75797         199             1203168           9131              143916

SQL> SELECT (DEL_LF_ROWS_LEN/LF_ROWS_LEN)*100 from index_stats;

(DEL_LF_ROWS_LEN/LF_ROWS_LEN)*100
---------------------------------
                       11.9614218 

1-3. Reorg 수행 후

SQL> select LF_ROWS,LF_BLKS,LF_ROWS_LEN,DEL_LF_ROWS,DEL_LF_ROWS_LEN fromindex_stats;

  LF_ROWS      LF_BLKS         LF_ROWS_LEN    DEL_LF_ROWS     DEL_LF_ROWS_LEN
----------  ----------         -----------    -----------     ---------------
    66666          148             1059252              0                   0

SQL> select (del_lf_rows_len/lf_rows_len)*100 as index_usage from index_stats;

INDEX_USAGE
-----------
         0

2. 기준


3. 고려사항


4. 관련 스크립트

SELECT NUM_ROWS
      ,BLOCKS
      ,EMPTY_BLOCKS
      ,AVG_SPACE
      ,AVG_ROW_LEN
FROM DBA_TABLES
WHERE NUM_ROWS / BLCKS < 50;
SELECT a.owner
     , a.table_name
     , a.NUM_ROWS
     , a.BLOCKS
     , a.EMPTY_BLOCKS
     , a.AVG_SPACE
     , a.AVG_ROW_LEN
     , b.bytes/1024/1024 bytes
FROM DBA_TABLES a
   , dba_segments b
WHERE a.NUM_ROWS / a.BLOCKS < 50
and a.num_rows > 0
and a.blocks > 0
and a.owner = b.owner
and b.segment_type = 'TABLE'
and a.table_name = b.segment_name
and b.bytes/1024/1024 > 500
order by 1,2;
SELECT a.owner
     , a.table_name
     , a.NUM_ROWS
     , a.BLOCKS
     , a.EMPTY_BLOCKS
     , a.AVG_SPACE
     , a.AVG_ROW_LEN
     , b.bytes/1024/1024 bytes
FROM DBA_TABLES a
   , dba_segments b
WHERE a.empty_blocks > 7000
and a.num_rows > 0
and a.blocks > 0
and a.owner = b.owner
and b.segment_type = 'TABLE'
and a.table_name = b.segment_name
and b.bytes/1024/1024 > 300
order by 1,2;