2013년 8월 27일 화요일

오라클 Managing Index Partitions

Managing Index Partitions

오라클 10g에서는 파티션된 테이블에 DDL(ADD, SPLIT, MERGE, MOVE)이 사용되는 경우 UPDATE INDEXES에 의해 자동으로 연관된 인덱스 세그먼트를 빌드해 줍니다.
(참고로 이전 버전에서 인덱스 세그먼트는 default tablespace or data segment와 같은 tablespace에 위치)

아래의 예제를 참고 하세요~

SQL> create table parts1
  2    (part_no        number,
  3    part_group    int not null)
  4    partition by    range (part_group)
  5    (partition grp1 values less than (11),
  6    partition grp2 values less than (21),
  7    partition grp3 values less than (31)
  8  ) ;
 
Table created.
 
SQL>  create index parts1_idx on parts1 (part_group) LOCAL ;
 
Index created.
 
SQL> select index_name, partition_name, tablespace_name, status from user_ind_partitionswhere index_name like 'PART%';
 
SQL> ALTER TABLE parts1 ADD PARTITION grp4 values less than (41) UPDATE INDEXES;
 
Table altered.
 
SQL> select index_name, partition_name, tablespace_name, status from user_ind_partitionswhere index_name like 'PART%';
 
INDEX_NAME  PARTITION_NAME  TABLESPACE_NAME  STATUS
----------  --------------- ----------------  -------
PARTS1_IDX    GRP1          USERS            USABLE
PARTS1_IDX    GRP2          USERS            USABLE
PARTS1_IDX    GRP3          USERS            USABLE
PARTS1_IDX    GRP4          USERS            USABLE

댓글 없음:

댓글 쓰기