Programming/Oracle

오라클 테이블스페이스 변경하기!

초록깨비 2024. 7. 26. 15:21
728x90

 

[ 오라클 테이블스페이스 변경하기 ]

 

[1] 인덱스에 사용된 테이블스페이스 확인

select distinct tablespace_name

   from user_indexes ;

 

 

alter index 인덱스명 rebuild tablespace 테이블스페이스명;

 

 

INDEX_TEMP 테이블스페이스로 사용한 INDEX를 INDX10으로 변경할때

select 'alter index '||index_name||' rebuild tablespace indx10;'

 from user_indexes

where tablespace_name in ('INDEX_TEMP') ;

 

[2] 테이블에 사용된 테이블스페이스 확인

select distinct tablespace_name

from user_tables ;

 

alter table 테이블명 move tablespace 테이블스페이스명;

 

[3] 테이블스페이스와 데이터파일명 확인

select * from dba_data_files ; 

 

[4] 테이블스페이스 삭제

drop tablespace 테이블스페이스명 including contents and datafiles cascade constraints ; 

 

 

728x90