data pump를 하기 위해서는 물리적 디렉터리도 필요하지만 논리적인 디렉터리 또한 설정해줘야한다.
물리적 디렉터리 생성
mkdir data_pump
논리적 디렉터리 생성
create directory pump_dir as '/home/oracle/data_pump';

논리적으로 생성한 디렉터리 확인
select * From dba_directories where directory_name = 'PUMP_DIR';

일반유저에게 논리적인 디렉터리에 대한 객체권한 부여
grant read,write on directory pump_dir to hr;
부여받은 객체권한 확인
select * from dba_tab_privs where grantee = 'HR';
expdp system/oracle schemas=hr directory=pump_dir dumpfile=hr_schema.dmp

select constraint_name, constraint_type, search_condition, r_constraint_name, status, validated, index_name
from dba_constraints
where owner='HR' and table_name = 'EMPLOYEES';


impdp system/oracle directory=pump_dir dumpfile=hr_schema.dmp tables=hr.employees
- hr계정의 dump 파일이더라도 hr.employees으로 해줘야한다. hr을 지정해주지 않으면 system에서 찾게된다


impdp system/oracle directory=pump_dir dumpfile=hr_schema.dmp schemas=hr

expdp system/oracle schemas=hr include=table directory=pump_dir dumpfile=hr_table.dmp


impdp system/oracle directory=pump_dir dumpfile=hr_table.dmp tables=hr.employees


impdp system/oracle directory=pump_dir dumpfile=hr_table.dmp tables=hr.employees content=data_only


impdp system/oracle directory=pump_dir dumpfile=hr_table.dmp tables=hr.employees content=metadata_only

select table_name, tablespace_name from dba_tables where owner='HR';


impdp system/oracle directory=pump_dir dumpfile=hr_table.dmp remap_schema='HR':'JAMES' remap_tablespace='EXAMPLIE':'USERS' exclude=trigger
정상적으로 import 되었다.

물리적인 위치에 생성된다.
impdp system/oracle directory=pump_dir dumpfile=hr_table.dmp tables=hr.employees sqlfile=employees.sql
impdp system/oracle schemas=hr directory=pump_dir dumpfile=hr_schema.dmp sqlfile=hr.sql
expdp system/oracle directory=pump_dir dumpfile=example.dmp tablespaces=examplie

테이블스페이스 DUMP 파일은 테이블스페이스의 구조에 대한 정보는 가지고 있지 않다.
따라서 import 하기 전에 사전에 테이블스페이스를 만들어 놓아야 한다.

impdp system/oracle directory=pump_dir dumpfile=example.dmp tablespaces=examplie
expdp system/oracle directory=pump_dir dumfile=hr_james_table.dmp tables=hr.employees, hr.departments, james.loactions
ora19c DB에 신규 테이블스페이스 생성

신규 테이블스페이스에 테이블 생성

테이블스페이스를 이관작업 할수 있는지 체크
execute dbms_tts.transport_set_check(ts_list=>'INSA_TBS',incl_constraints=>TRUE)


변경하기전에 현재 테이블스페이스 모드 확인
select tablespace_name, status from dba_tablespaces where tablespace_name='INSA_TBS';

read only 모드로 변경
- 모드 변경시에도 partial 체크포인트가 발생한다.
alter tablespace insa_tbs read only;


expdp system/oracle directory=pump_dir transport_tablespaces=insa_tbs dumpfile=insa_tbs.dmp


만들려는 디렉터리가 이미 존재하는지 확인

논리적인 디렉터리 생성
- 덤프파일이 clone 디렉터리 안에 있기 때문에 /home/oracle/clone 으로 설정

system 계정 패스워드 설정 및 계정 unlock

import 받는데 dump 파일이 가지고 있는 테이블스페이스와 datafile이 맞는지 매핑 작업을 거친다.
impdp system/oracle directory=clone_dir dumpfile=insa_tbs.dmp transport_datafiles='/home/oracle/clone/insa_tbs01.dbf' exclude=statistics
- transpotable_tablespace는 다른 os로 이관할때 같은 문자 체계를 가지고 있어야지 이관이 가능하다.
- ENDIAN_FORMAT이 같은 OS 끼리만 가능하다.
select * from v$transportable_platform;