Oracle/Admin

생성된 INDEX를 다른 tablespace로 옮기기

에몽이ㅋ 2012. 3. 18. 12:35
alter index 인덱스이름 rebuild tablespace 새로운테이블스페이스;
예제
  1  select TABLE_NAME, INDEX_NAME, INDEX_TYPE, TABLESPACE_NAME from user_indexes
  2* where TABLE_NAME='STUDENT'
SQL> /

TABLE_NAME                     INDEX_NAME                     INDEX_TYPE                  TABLESPACE
------------------------------ ------------------------------ --------------------------- ----------
STUDENT                        IDX_STUD_DEPTNO                NORMAL                      USERS
STUDENT                        IDX_STUD_PROFNO                NORMAL                      USERS
STUDENT                        IDX_STUD_NAME                  NORMAL                      USERS
STUDENT                        STUDENT_STUDNO_PK              NORMAL                      INDX

IDX_STUD_DEPTNO를 다른 테이블스페이스로 옮겨보겠습니다.

SQL> alter index IDX_STUD_DEPTNO rebuild tablespace indx;

Index altered.

SQL> select TABLE_NAME, INDEX_NAME, INDEX_TYPE, TABLESPACE_NAME from user_indexes
  2  where TABLE_NAME='STUDENT';

TABLE_NAME                     INDEX_NAME                     INDEX_TYPE                  TABLESPACE
------------------------------ ------------------------------ --------------------------- ----------
STUDENT                        IDX_STUD_DEPTNO                NORMAL                      INDX
STUDENT                        IDX_STUD_PROFNO                NORMAL                      USERS
STUDENT                        IDX_STUD_NAME                  NORMAL                      USERS
STUDENT                        STUDENT_STUDNO_PK              NORMAL                      INDX

IDX_STUD_DEPTNO가 USERS --> INDX로 옮겨졌습니다.