티스토리 뷰

■ IMPORT(impdp)란?

impdp는 Oracle10g에서 도입된 새로운 가져오기 유틸리티이다.

이전 imp에 비해 성능이 향상되어 빠르게 가져올 수 있다.

※ Oracle 11g 이상에서는 이전 명령인 imp는 더 이상 사용되지 X

 

■ impdp구문

impdp <사용자>/<비밀번호>@<연결 문자열> <옵션>

■ impdp옵션

impdp에서 주로 사용하는 옵션은 아래와 같다.

- 하나만 지정 가능한 옵션 

매개변수 설명
full 전체 데이터베이스를 가져올 때 y를 지정
(예) full=y
tablespaces 대상 테이블스페이스 단위로 가져올 때 지정
(예) tablespaces=tbs01
schemas 스키마 단위로 가져올 때 지정합니다
(예) schemas=schema01
tables 테이블 단위로 가져올 때 지정
※ 복수 지정하는 경우는 쉼표로 구분하기
(예) tables=schema01.m_test tables=m_test1,m_test2,m_test3
remap_schema 다른 스키마로 가져올 때 지정합니다
(예) remap_schema=schema02:schema01
remap_tablespace 다른 테이블 스페이스로 가져올 때 지정합니다
(예) remap_tablespace=tbs01:tbs02

- 공통 옵션 

매개변수 설명
directory 가져오기 파일을 작성하는 디렉토리를 DIRECTORY 오브젝트명으로 지정하는
※실제 패스는 지정 불가.
dumpfile 가져온 데이터의 파일 이름 지정
(예) data.dmp
logfile 가져올 때의 로그 파일명을 지정한다
(예) data.log
※미지정시는 「export.log」가 됩니다.
※로그 출력 유무는 nologfile의 설정에 따른다.
content 가져오기 대상 지정
 data_only : 테이블 데이터 전용
 metadata_only : 객체 정의만
 all : 정의 및 데이터 (기본값)
exclude Import에서 제외한 시체의 객체를 지정
(예) 인덱스를 제외할 경우 exclude= INDEX
parfile 파라미터 파일을 지정
파라미터 파일은 파라미터를 파일에 항목별로 적은 것이다.
아래의 예제에서 확인
table_exists_action Import처에 이미 정의와 데이터가 존재했을 경우의 동작지정
 truncate: 기존 데이터 truncate 후 Import하기
 replace : 기존의 정의를 drop한 후 Import한다
 append: 기존 데이터는 그대로 Import한다.
 skip: 기존 정의와 데이터는 그대로 두고 다음 오브젝트 Import로 넘어간다.
transform 메타데이터 변환 지정
(예) transform=OID:n
※가져오기 시에 ORA-02304가 발생하는 경우는 OID:n을 지정하면 나오지 않게 된다.
nologfile 가져오기 실행 시 로그 출력 여부
 YES : 로그 파일을 출력하지 않음
 NO : 로그 파일을 출력합니다 (기본값)

 다른 사용자가 소유한 테이블을 내보내려면

IMP_FULL_DATABASE 역할이 필요하다.

 

■ impdp 예제

- 예제) 전체 데이터베이스 가져오기

C:¥>impdp shcema01/password@db01 full=y directory=dir01
table_exists_action=replace dumpfile=data.dmp logfile=data.log

- 예제) 테이블스페이스 단위로 가져오기

C:¥>impdp shcema01/password@db01 tablespaces=tbs01 directory=dir01
table_exists_action=replace dumpfile=data.dmp logfile=data.log

- 예제) 스키마 단위로 가져오기

C:¥>impdp shcema01/password@db01 schemas=taro directory=dir01
table_exists_action=replace dumpfile=data.dmp logfile=data.log

- 예제) 테이블 단위로 가져오기

C:¥>impdp shcema01/password@db01 tables=m_test1,m_test2 directory=dir01
table_exists_action=replace dumpfile=data.dmp logfile=data.log

- DMP 파일과 다른 스키마로 가져오기 【스키마 단위(다른 스키마)】

C:¥>impdp schema01/pass@db01 schemas=schema01 directory=dir01
dumpfile=data.dmp logfile=data.log remap_schema=schema01:schema02

※ 위의 예제는 schema01에서 schema02 스키마로 가져오기가 된다.

 

- 예제) DMP 파일과 다른 스키마/테이블 공간으로 스키마 단위로 가져오기

 

- 예제) 옵션을 파라미터 파일로 지정하여 가져오기

C:¥>impdp schema01/pass@db01 schemas=schema01 directory=dir01
dumpfile=data.dmp logfile=data.log
remap_schema=schema02:schema01 remap_tablespace=tbs01:tbs02

- 예제) DMP 파일과 다른 스키마 / 테이블 스페이스로 테이블 스펙으로 가져오기

C:¥>impdp shcema01/password@db01 directory=dir01
dumpfile=data.dmp logfile=data.log
table_exists_action=truncate
remap_schema=shcema02:shcema01 remap_tablespace=tbs01:tbs02
tables=shcema02.tab1,shcema02.tab2

- 파라미터 파일 예제(parameters.par)

C:¥>impdp kr98gyeongim/password@db01 parfile=parameters.par

 directory는 사전에 만들어놔야한다.

자세한건 directory 게시글을 따로 참고

'Oracle > [oracle] 유틸리티' 카테고리의 다른 글

[유틸리티] EXPORT(expdp)  (0) 2022.04.12
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함