Transcript exp_import
Oracle Export 및 Import 유틸리티 Oracle Export 및 Import 유틸리티 Import Export 덤프파일에서 객체의 정의와 테이블 데이터를 읽어서 데이터 객체를 Oracle Database에 삽입 Oracle Database Oracle Binary 형식의 덤프파일 Export Oracle Database 서로 다른 하드웨어나 소프트웨어 구성 을 사용하는 플랫폼에 상주하더라도 Database간에 데이터 객체를 이동할 수 있게 하는 방법으로 Oracle Binary 형식의 덤프파일로 객체의 정의와 테이 블 데이터를 추출 Oracle Export Mode Table Mode Exp hr/hr tables=employees, departments rows=y file=exp1.dmp User Mode Exp system/manager owner=hr direct=y file=expdat.dmp Tablespace Mode Exp \’username/password as sysdba\’ transport_tablespace=y tablespaces=ts_emp Full Database Mode Exp system/manager file=expdat.dmp log=expdat.log full=y Export Parameter Parameter 설명 기본값 Compress Export가 테이블 데이터의 초기 확장 영역을 관리 하는 방법을 지정 Y Constraints 테이블의 제약 조건의 export를 지정 Y Direct Direct 사용을 지정 N Feedback Export된 n개의 행에 해당하는 기간의 형태로 진행 측정기를 표시 0 File Export 파일 이름 지정 Expdat.dmp Full Full database모드 export N Grants 객체 권한 부여에 대한 지정 Y Indexes 인덱스 export 여부를 지정 N Log 정보 메시지 와 오류 메시지를 받을 파일의 이름을 지정 Owner User 모드 export Rows 테이블 데이터 행의 export 여부 지정 Tables Table 모드 export Tablespaces Tablespace에 있는 모든 테이블 export Transport_tabl espace 이동 가능한 tablespace 메타 데이터의 export를 설정 Y N Oracle Import Mode Table Mode imp hr/hr tables=employees, departments rows=y file=exp1.dmp User Mode imp system/manager owner=hr direct=y file=expdat.dmp Tablespace Mode imp \’username/password as sysdba\’ transport_tablespace=y tablespaces=ts_emp Full Database Mode imp system/manager file=expdat.dmp log=expdat.log full=y Import Parameter Parameter 설명 기본값 Datafiles Database로 transport할 데이터 파일을 나열 Feedback Export된 n개의 행에 해당하는 기간의 형태로 진행 측정기를 표시 0 File Import 파일 이름 지정 Expdat.dmp Fromuser Import할 스키마 목록 Full Full database모드 import, 전체 export 파일의 import 여부 지정 N Ignore 객체 생성 오류의 처리 방법 지정 N Indexes 인덱스 export 여부를 지정 N Log 정보 메시지 와 오류 메시지를 받을 파일의 이름을 지정 Rows 테이블 데이터 행의 import 여부 지정 Tables Table 모드 import Tablespaces Tablespace에 있는 모든 테이블 import Touser Import 대상이 될 스키마를 소유한 user이름 지정 Transport_tabl espace 이동 가능한 tablespace 메타 데이터의 import를 설정 Y N Import 프로세서 순서 및 Transport Tablespace Import 프로세서 순서 1. 2. 3. 4. 5. 6. 새 테이블 생성 데이터 import 인덱스 생성 트리거 import 새 테이블에서 무결성 제약 조건 활성화 비트맵, 함수 및 도메인 인덱스 생성 A B A B C FTP Transport Tablespace Transport Tablespace 1. Read only 전환 2. Meta data 추출 3. Meta data + data file 이동 4. Meta data import 단, 플랫폼은 동일해야 함(9i) 10g에서는 극복 Export 시 query option 사용하기 select 문장에서의 where절을 사용하는 것처럼 export 시에 부분적으로 table data 를 받아 낼 수 있는 기능 1. 테이블 레벨의 export 명령어에서만 가능하다. 2. Direct 옵션과 함께 사용될 수 없다. 3. Nested 테이블을 갖는 테이블에는 적용할 수 없다. 4. Partition 테이블에 대한 export에도 적용 가능하다. 5. Import 명령에는 적용되지 않는다. Example: 1. scott.emp table의 ename 이 JAME과 비슷한 이름의 data 를 export exp scott/tiger query=\"where ename like \'JAME%\'\" tables=emp file=exp.dmp log=exp.log 2. employee와 cust table에서 new york 주의 data 만 export exp scott/tiger query=\"where st=\'NY\'\" tables=(employee,cust) file=exp.dmp log=exp.log (V9.X) 8I -> 9.X EXPORT/IMPORT 수행 시 ORA-25150 에러 해결방법 Oracle 8i 버젼에서 export를 수행하였는데, 8i의 tablespace는 DICTIONARY managed tablespace이다. 이 8i export dump file을 9i 데이타베이스로 import를 하게 되면 다음과 같은 에러 메시지가 발생할 수 있다. Example: importing table "WWA_MODULE_CALL_STACK$" 186 rows imported . . importing table "WWA_MODULE_EVENTS$" 588 rows imported . . importing table "WWA_MODULE_LOV_BINDINGS$" 1 rows imported . . importing table "WWA_MODULE_SCRIPTS$" 0 rows imported IMP-00017: following statement failed with ORACLE error 25150: "ALTER TABLE "WWA_MODULE_SESSION_ELEMENTS$" PCTFREE 10 PCTUSED 40 INITRANS" "1 MAXTRANS 255 LOGGING STORAGE( NEXT 10485760 MINEXTENTS 1 MAXEXTENTS 1000" "PCTINCREASE 0 BUFFER_POOL DEFAULT)" IMP-00003: ORACLE error 25150 encountered ORA-25150: ALTERING of extent parameters not permitted (V9.X) 8I -> 9.X EXPORT/IMPORT 수행 시 ORA-25150 에러 해결방법 Solution Description : Oracle 9i에서는 생성되는 tablespace가 모두 default로 Locally-managed tablespace 이다. ORA-25150 에러를 해결하기 위해서는 dbms_space_admin.tablespace_migrate_from_local 프로시져를 이용하여 Locallymanaged tablespace를 Dictionary-managed tablespace로 migrate 해야 한다. SQL> connect / as sysdba Connected. SQL> execute dbms_space_admin.tablespace_migrate_from_local(‘users'); PL/SQL procedure successfully completed. Procedure : dbms_space_admin.tablespace_migrate_from_local Locally-Managed tablespace -> Dictionary-managed tablespace dbms_space_admin.tablespace_migrate_to_local Dictionary-managed tablespace- > Locally-Managed tablespace