TECH
QUESTION
자주하는 질문답변 입니다.
Oracle
작성자 | 유건데이타 | 등록일 | 2015-05-18 |
제목 | (V8.X) PARTITIONED TABLE과 EXPORT, IMPORT | ||
---|---|---|---|
(V8.X) PARTITIONED TABLE과 EXPORT, IMPORT
========================================= Oracle7.3부터 소개된 partition view에 여러가지 기능 상의 향상을 추가하고 VLDB(Very Large DataBase)를 지원하기 위하여, Oracle8.x 에서는 partitioned table 개념이 추가되었다. 여기서는 partitioned table에 대한 export, import 작업에 대한 개략적인 내용을 예를 통해서 살펴보도록 한다. (partitioned table에 대한 개념은 bulletin:11269 'PARTITION TABLE 이란?' 을 참조하도록 한다.) 1. export partitioned table과 관련하여 export는 다음의 두가지 level로 분류할 수 있다. table-level export : 1) partitioned 또는 non-partitioned table 전체를 export한다. 2) 모든 export mode (full, user, table)에서 사용된다. 예) $ exp scott/tiger file=wookpark.dmp tables=emp emp table(partitioned 또는 non-partitioned) 전체를 export partition-level export : 1) partitioned table의 일부 partition만을 export한다. 2) table export mode에서만 사용가능하다. 3) b의 제한 사항때문에 full mode를 사용해야 하는 incremental export는 지원하지 못한다. 예) $ exp scott/tiger file=wookpark.dmp tables=emp:px emp table의 px partition만을 export ':'을 이용하여 partition name을 지정한다. 비고) 다음과 같이 두가지 level을 혼용하여 사용하는 것도 가능하다. $ exp scott/tiger file=wookpark.dmp tables=(emp:px, sales) sales table은 전부를, emp table에서는 px partition만을 export 2. import export와 마찬가지로 import도 다음의 두 가지로 분류할 수 있다. table-level import : 1) partitioned 또는 non-partitioned table 전체를 import한다. 2) 모든 import mode (full, user, table)에서 사용된다. 예) $ imp scott/tiger file=wookpark.dmp tables=emp emp table(partitioned 또는 non-partitioned)전체를 import partition-level import : 1) export dump file에서(full,user,table 중 어떠한 mode를 이용하여 export했건 간에) partitioned table의 일부 partition만을 import 2) table import mode에서만 사용 가능하다. 예) $ imp scott/tiger file=wookpark.dmp tables=emp:px emp table의 px partition만을 import ':'을 이용하여 partition을 지정한다. table-level import 시 우선 table creation 문장을 수행하고 row insert문을 수행하는 것과 마찬가지로, partition-level import도 우선 partitioned table 의 생성 문장을 수행하고 row insert문을 수행하게 된다. 따라서 ignore=y option 등을 적절히 사용하면, non-partitioned table과 partitioned table 간의 변경, partitioned table의 구조 변경 등을 수행할 수 있게 된다. 다음에는 그 중 몇 가지 예를 들어본다. 1. unpartitioned table을 exp, imp를 이용하여 partitioning하는 예 1) unpartitioned table을 export한다. $ exp scott/tiger file=wookpark.dmp tables=emp 2) 해당 table을 drop한다. SQL> drop table emp 3) 해당 table을 create하면서 partitioning한다. SQL> create table emp ( empno number(4) not null, ... ) partition by range (empno) (partition emp1 values less than (1000) tablespace ts1, partition emp2 values less than (2000) tablespace ts2, partition emp3 values less than (3000) tablespace ts3) ; 4) import한다. $ imp scott/tiger file=wookpark.dmp tables=emp ignore=y 2. partitioned table의 partition들을 exp, imp를 이용하여 merge하는 예 1) merge의 대상이 되는 partition을 export한다. $ exp scott/tiger file=wookpark.dmp tables=emp:emp2 2) merge의 대상이 되는 partition을 'alter table...'문장으로 drop한다. SQL> alter table emp drop partition emp2 ; 3) import한다. $ imp scott/tiger file=wookpark.dmp tables=emp:emp2 ignore=y 이후 emp table을 확인하면, emp2 partition에 있던 data가 emp3 partition에 merge되어 있음을 확인할 수 있다. 604 보기 태그: |
Comment | |||
---|---|---|---|
등록된 코멘트가 없습니다. |