TECH
QUESTION
자주하는 질문답변 입니다.
Oracle
작성자 | 유건데이타 | 등록일 | 2015-05-18 |
제목 | TABLE PARTITION이 존재하는 DATAFILE이 삭제된 경우 조치방법 | ||
---|---|---|---|
SCOPE
----- 8~10g Standard Edition 에서는 Partitioning Option 은 지원하지 않는다. Partitioned table의 partition이 포함되어 있는 datafile이 OS level에서 삭제된 경우, 해당 datafile을 offline drop하고 open한 후 해당 table을 access하고자 하는 경우 다음과 같은 error가 유발된다. ORA-00376: (File cannot be read at this time) Cause: An attempt was made to read from a file that is not readable. The most likely cause is that the file is off line. Action: Check the state of the file. Bring the file online, if necessary. 그리고, 해당 tablespace를 drop하고자 하면 다음과 같은 error가 유발된다. ORA-14404: (Partitioned table contains partitions in a different tablespace) Cause: An attempt was made to drop a tablespace which contains tables whose partitions are not completely contained in this tablespace. Action: Find tables with partitions which span the tablespace being dropped and some other tablespace(s). Drop these tables or move partitions to a different tablespace. 이 경우 다음과 같은 절차로 조치가능하다. 예를 들어, DEPT라는 partitioned table중에서 PART2라는 partition이 존재하는 TS_PART2의 datafile이 유실되었으며, 해당 datafile을 offline drop한 후 open 하였다고 가정한다. 1. 가장 간단하게 해당 partitioned table전체를 drop한 후 recreate한다. a. drop table DEPT ; b. drop tablespace TS_PART2 including contents ; c. tablespace recreate. d. table rebuild. 이 과정의 문제점은 전체 partitioned table을 복구해야 하므로 시간이 오래 소요된다는 것이다. 2. 해당 partition만을 drop후 재생성한다. a. alter table DEPT drop partition PART2 ; b. drop tablespace TS_PART2 including contents ; c. tablespace recreate. d. add partition or split partition. e. 해당 partition만의 data를 reload. partitioned table전체 data를 reload하는 것 보다 짧은 시간이 소요된다. 3. temporary table을 생성하여 exchange한다. a. DEPT talbe과 동일한 구조의 dummy table을 다른 tablespace에 생성한다. create table DEPT_TEMP as select * from DEPT where 1=2; b. 이 table을 문제의 partition과 exchange한다. alter table DEPT exchange partition PART2 with table DEPT_TEMP without validation ; c. drop tablespace TS_PART2 including contents ; d. 새로운 partition에 필요한 data를 load한다. 이때, 제 3의 table에 load한후 동일한 방법으로 exchange를 하여도 무방하다. |
Comment | |||
---|---|---|---|
등록된 코멘트가 없습니다. |