데이터베이스/Oracle

오라클 import/export하는 방법

Giant Oreo 2021. 6. 18. 12:26

import

- userid: import실행하는 계정의 username/password

- file: Import할 덤프 파일명

- full: full export 덤프 파일이 import 될 때 사용되며 기본값은 n이다.

- fromuser : 덤프파일로부터 읽혀져야 하는 객체들을 갖고 있는 데이터베이스 계정

- touser: 덤프파일 안에 있는 객체들이 import될 데이터베이스 계정

 

1. cmd창에서 덤프파일이 있는 경로로 들어간다.

 

-유저명으로 export한 전체파일을 scott계정으로 import할 경우 아래와 같은 명령문을 입력한다.

 

imp userid=system/비밀번호 file='덤프파일명.dmp' fromuser=유저명 touser=scott

또는

imp userid=scott/비밀번호 file='덤프파일명.dmp' full=y

 

 

export

 - userid : EXPORT를 실행시키고 있는 username/password 명

  - file : 생성되는 EXPORT덤프 파일명

  - full : 전체 데이터베이스를 EXPORT할것인가의 여부 (Full Level EXPORT) (Y/N 플래그)

  - owner : EXPORT 될 데이터베이스의 소유자 명 (User Level EXPORT)[owner=user]

  - tables : EXPORT될 테이블의 리스트(Table Level EXPORT) [tables=(table1, table2, ...)]

  - log : EXPORT 실행 과정을 지정된 로그 파일에 저장

 

 

1. Full level Export

exp userid=system/비밀번호 file='C:\경로\덤프파일지정명.dmp' full=y

 

2. User level Export

 

scott계정이 가지고 있는 데이터베이스 스키마를 export할 경우

exp userid=scott/비밀번호 file='경로\덤프파일명.dmp'

 

system계정으로 scott계정의 데이터베이스 스키마 export할 경우(owner옵션 사용하기!)

exp userid=system/비번 file='경로\덤프파일명.dmp' owner=scott

 

*비밀번호에 특수문자가 있다면 ' 로 감싸준다!

 

3. Table level Export

 

system계정이 scott계정의 특정 table만 export할 경우

exp userid=system/WGsystem1 file='C:\폴더명\덤프파일명.dmp' tables=(scott.테이블명1, scott.테이블명2)

 

scott계정이 특정 table을 export할 경우

exp userid=scott/비밀번호 file='경로\덤프파일명.dmp' tables=(테이블명1, 테이블명2)



출처: https://godlvkhj.tistory.com/215 [하은양 믿음군 효실맘 호홍홍집s]