본문 바로가기
🗄️ DB_이야기/# 🛢️ Oracle

[Oracle] Data Pump(impdp)

by gwon_s 2026. 2. 24.

주의

더보기
  • 멀티테넌트 구조의 경우 시스템 설정(ETL_GROUP, BATCH_GROUP, INTERACTIVE_GROUP 등) 에러를 발생할 수 있음 
    • PDB에 CDB의 내용을 넣을려고 시도하기 때문
    • 복구에 지장에 없으므로 무시

① 전체 복구 (Full Mode)

덤프 파일에 있는 전체 내용을 그대로 복구 (주로 DB 전체 이관 시 사용)

$ impdp system/system full=y directory=expdp_dir dumpfile=full_expdp.dmp logfile=full_impdp.log

 

 

② 스키마 복구 (Schema Mode) ⭐ 

특정 유저의 데이터를 복구합니다. 이때 유저 이름을 바꾸는 REMAP_SCHEMA 옵션이 가장 많이 사용합니다.

  • 그대로 복구:
 $ impdp system/system schemas=testuser01 directory=expdp_dir dumpfile=testuser01_schema.dmp logfile=testuser01_imp.log

 

  • 유저 바꿔서 복구 (testuser01 데이터를 testuser02로): 
$ impdp system/system remap_schema=testuser01:testuser02 directory=expdp_dir dumpfile=testuser01_schema.dmp

 

③ 테이블 복구 (Table Mode)

특정 테이블만 골라서 복구합니다. 실수로 테이블을 지웠을 때 유용합니다.

  • 그대로 복구:
$ impdp system/system tables=emp directory=expdp_dir dumpfile=testuser01_table_emp.dmp logfile=testuser01_table_emp.log

 

  • 테이블 바꿔서 복구 (testuser01.emp 테이블을 testuser02.emp로): 
$ impdp system/system remap_table=testuser01.emp:testuser02.emp directory=expdp_dir dumpfile=testuser01_table_emp.dmp logfile=testuser01_table_emp.log

 

  • TABLE_EXISTS_ACTION (이미 있을 때 대처법)

복구하려는 테이블이 대상 DB에 이미 존재할 때, impdp가 어떻게 행동할지 결정합니다.

$ impdp system/system table_exists_action={APPEND | TRUNCATE | REPLACE} full=y directory=expdp_dir dumpfile=full_exp.dmp
옵션값 의미
SKIP (기본값) 이미 있으면 아무것도 안 함
APPEND 기존 데이터는 두고 아래에 추가
TRUNCATE 기존 데이터만 싹 지우고 새로 넣음
REPLACE 테이블을 삭제(Drop)하고 다시 만듦


④ 테이블스페이스 복구 (Tablespace Mode) 

특정 테이블스페이스 단위로 데이터를 밀어 넣습니다.

  • 그대로 복구:
$ impdp system/system tablespaces=test_tbs directory=expdp_dir dumpfile=tbs_tablespace.dmp
  • 테이블스페이스를 바꿔서 복구 (test_tbs01 테이블스페이스를 test_tbs02로): 
$ impdp system/system remap_tablespace=test_tbs01:test_tbs02 directory=expdp_dir dumpfile=tbs_tablespace.dmp

 

⑤ 특정 오브젝트를 제외(Exclude) 

특정 오브젝트를 제외하고 데이터를 복구합니다.

EXCLUDE={OBJECT_NAME}

-- 인덱스와 통계정보를 제외하고 복구
$ impdp system/system schemas=testuser01  dumpfile=full_exp.dmp
	EXCLUDE=INDEX,STATISTICS
-- 특정 테이블을 제외하고 복구
$ impdp system/system schemas=testuser01  dumpfile=full_exp.dmp
	exclude=table:\"in\(\'TABLE01\',\'TABLE02\',\'TABLE03\'\)\"

 

 

⑥ 특정 오브젝트만 복구

특정 오브젝트만 복구합니다.

INCLUDE={OBJECT_NAME}

-- 인덱스와 통계정보만 복구
$ impdp system/system schemas=testuser01  dumpfile=full_exp.dmp
	INCLUDE=INDEX,STATISTICS
-- 특정 테이블만 복구
$ impdp system/system schemas=testuser01  dumpfile=full_exp.dmp
	INCLUDE=table:\"in\(\'TABLE01\',\'TABLE02\',\'TABLE03\'\)\"