울어라휘파람새야

[Oracle]Export,Import 본문

밥줄/Oracle

[Oracle]Export,Import

꼬꼬리코 2009. 7. 24. 17:35
 

Oracle Export and Import Utilities
 
1. Export and Import Utility 가 하는 일
   - historical archive를 생성한다.
   - table의 데이터와 구조를 binary file로 저장한다.
   - oracle의 다른버전으로 migration 할 때 사용하면 좋다.
     - 갑작스런 drop or truncate로부터 복구를 목적으로 사용된다.

2. Export 사용법 (exp scott/tiger file=/backup/orabackup.dmp owner=scott)

   $ exp scott/tiger tables=(dept,emp) \
   > file=emp.dmp log=exp.log compress=n \
   > direct=y recordlength=32768
  
   [syntax]
   $ exp [keyword=]{value | (value, value ...)}
      [ [ [,] keyword=]{value | (value, value ...)} ] ...
  


Parameter
 Description
 
USERID
 Username/password of schema objects to export
 
FILE
 Name of output file
 
ROWS
 Include table rows in export file: (Y)ex/(N)o
 
FULL
 Export entire database : (Y)es/(N)o
 
OWNER
 Users to export : Username
 
TABLES
 Tables to export : List of tables
 
INDEXES
 Indexes to export : (Y)es/(N)o
 
DIRECT
 Specify direct mode export : (Y)es/(N)o -- 좀더 빨리처리한다.
 
INCTYPE
 Type of export level
 
PARFILE
 Name of file in which parameters are specified.
 
HELP
 Display export parameters in interactive mode (Y)
 
LOG
 Name of file for informational and error messages
 
CONSISTENT
 Read-consistent view of the database when data is updated during an export : (Y)es/(N)o
 
BUFFER
 Size of the data buffer in bytes : (Integer)
 
POINT_IN_TIME_RECOVER
 Indicates whether or not the Export utility exports one or more tablespaces in an Oracle database
Refer to the Oracle Server Readme, Relaease 8.0.4
 
RECOVERY_TABLESPACES
 Specifies the tablespaces that will be recovered using point-in-time recovery
Refer to the Oracle Server Readme, Release 8.0.4
 
COMPRESS
 Specified to include all data in one extent : (Y)es/(N)o
 

 

3. Import 사용법 (imp scott/tiger file=/backup/orabackup.dmp full=y commit=y)

   $ imp scott/tiger tables=(dept, emp) \
   > file=emp.dmp log=imp.log ignore=y
  


Parameter
 Description
 
USERID
 Username/passwordof schema objects to export
 
FILE
 Name of the input file. Must be a valid Export Utility file.
 
ROWS
 Include table rows in import file.
 
IGNORE
 Ignore create errors due to an object's existence.
 
FULL
 Import entire file.
 
TABLES
 Tables to import
 
INDEXES
 Indexes to import
 
INCTYPE
 Specifies the type of incremental import. Options are SYSTEM and RESTORE.
 
PARFILE
 Parameter specification file
 
HELP
 Display export parameters in interactive mode.
 
LOG
 File for informational and error messages
 
DESTROY
 Specifies whether or not the existing datafile making up the database should be reused.
 
FROMUSER
 A list of schemas containing objects to import
 
TOUSERS
 Specifies a list of usernames whose schemas will be imported.
 
INDEXFILE
 Specifies a file to receive index-creation commands.
 
POINT_IN_TIME_RECOVER
 Indicates whether or not Import recovers one or more tablespaces in an Oracle database to a prior point in time without affecting the rest of the database.
Refer to the Oracle Server Readme, Release 8.0.4
 
     
 EXPORT 
 
 
OracleClub.com
 
 작 성 일     2002-02-03 조 회 수 22821 
 
 제    목    EXPORT  
 
 내     용       프린트     
 
* 내용을 복사하실때는 마우스로 선택 후 Ctrl+C로 복사하세요.
 

▣ EXPORT ?

  ⊙ 오라클에서 제공하는 논리적인 백업에 사용되는 유틸리티로써,  binary file형태로 기록합니다.

  ⊙ 데이터베이스가 가동중인 상태에서 실행합니다.

  ⊙ 전체 데이터베이스, 특정 사용자, 특정 테이블들을 엑스포트 시킬 수 있습니다.

  ⊙ 권한, 익덱스, 또한 연관된 제약조건들과 같이 테이블들과 연관되는
      데이터 딕셔너리 정보도 엑스포트 시킬 것인가를 선택할 수 있습니다.

  ⊙ 마지막 엑스포트 이후로변경된 테이블들에 대해서만 엑스포트 작업을 실행 할 수도 있습니다. 
 


▣ Export Paramger

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

   - buffer : 데이터 행들을 가져오는데 사용되는 버퍼의 크기.

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

   - filesize : EXPORT덤프 파일의 최대 크기

   - grants : 데이터베이스 객체에 대한 권한 정보의 EXPORT여부 (Y/N 플래그)

   - indexes : 테이블에 대한 INDEXES의 EXPORT여부 (Y/N 플래그)

   - rows : 행들에 대한 EXPORT여부. (Y/N 플래그)
               만약 “no”이면 데이터는 EXPORT되지않고 테이블의 정의만 EXPORT 됩니다.

   - constraints : 테이블에 대한 제약조건 정보의 EXPORT여부 (Y/N 플래그)

   - compress : IMPORT에 대비하여 테이블의 데이터를 한 extent로 압축 할것인가의 여부
                      (Y/N 플래그)

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

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

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


▣ Full Level Export

   - 전체 데이터베이스가 엑스포트 됩니다.

   - 모든 테이블스페이스, 모든 사용자, 또한 모든 객체, 데이터들이 포함됩니다.

   예제) C:\>exp  userid=system/manager  file='C:\full.dmp'   full=y
 


▣ User Level Export

  - 사용자 객체들이 엑스포트 되고 객체들 안에 있는 데이터도 엑스포트 됩니다.

  - 사용자 객체에 대한 모든 권한들과 인덱스들도 엑스포트 됩니다.

  - 다른 사용자들의 객체와 권한, 인덱스들은 엑스포트 되지 않습니다.

   예제1) 사용자 자신이 만든 모든 오브젝트를 그 user가 EXPORT하는 방법입니다.

        C:\>exp   userid=scott/tiger  file='C:\scott.dmp'


   예제2) SYSTEM/MANAGER로 접속한 DBA가 여러 user소유의 오브젝트들을 EXPORT 하는
            방법입니다.

        C:\>exp userid=system/manager owner=scott  file='C:\scottuser.dmp'
 


▣ Table Level Export

   - 명시된 테이블만 엑스포트 됩니다.

   - 테이블의 구조, 인덱스, 권한등이 테이블과 함께 엑스포트 됩니다.


      예제1) system user로 다른 유저의 table 몇 개만 Export하는 예제입니다.

      C:\>exp userid=system/manager file='C:exp.dmp' tables=(scott.EMP, scott.DEPT)

      => 위와 같이 table의 schema(user)명까지 지정해야만 export가 성공합니다.


       예제2) scott user로 table 몇 개만 EXPORT하는 예

       C:\>exp userid=scott/tiger file='C:\exp.dmp' tables=(EMP, DEPT) log=exp.log

       => user가 자신의 table을 export할 때에는 schema 명을 지정할 필요 없습니다.

 

 출처: 
  ================================================
    * Oracle Community OracleClub.com
    * http://www.oracleclub.com
    * http://www.oramaster.net
    * 운영자 : 김정식 (oramaster _at_ empal.com)
  ================================================ 

 

 

     
 IMPORT 
 
 
OracleClub.com
 
 작 성 일     2002-02-03 조 회 수 22723 
 
 제    목    IMPORT  
 
 내     용       프린트     
 
* 내용을 복사하실때는 마우스로 선택 후 Ctrl+C로 복사하세요.
 

▣ IMPORT ?

   ⊙ EXPORT 덤프 파일을 읽어서 그 안에 저장되어 그 파일안에 있는 명령을 실행시킵니다.

   ⊙ 데이터베이스를 복구하거나 재구성하기위해 사용될 수 있습니다.

   ⊙ 기본적으로 IMPORT는 각 테이블을 IMPORT한 후 COMMIT을 합니다.
 


▣ Import Parameter

  - userid : IMPORT를 실생시키는 계정의 username/password명

  - buffer : 데이터를 행들을 가져오는데 사용되는 buffer의 bytes수

  - file : IMPORT될 EXPORT 덤프 파일명

  - show : 파일 내용이 화면에 표시되어야 할 것인가를 나타냄(Y/N 플래그)

  - ignore : IMPORT중 CREATE명령을 실행할 때 만나게 되는 에러들을 무시할 것인지 결정
                (Y/N 플래그)

  - indexes : 테이블 INDEX의 IMPORT여부(Y/N 플래그)

  - rows : 테이블 데이터를 IMPORT할 것인가(Y/N 플래그)
              만약 "N"로 설정하면 데이터베이스 객체들에 대한 DDL만이 실행됩니다.

  - full : FULL엑스포트 덤프 파일이 IMPORT 할때 사용합니다. 

  - tables : IMPORT될 테이블 리스트

  - commit : 배열(배열의 크기는 BUFFER에 의해 설정됩니다) 단위로 COMMIT을 할것인가 결정
                   기본적으로는 테이블 단위로 COMMIT을 합니다.

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

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


▣ Import 예제


     예제1) 전체 데이터베이스가 IMPORT됩니다. (Full Level)

       C:\>imp userid=system/manager file='C:\full.dmp'  full=y


     예제2) scott의 유저 IMPORT를 실행 합니다.(User Level)

       C:\>imp userid=scott/tiger file='C:\scott.dmp'


     예제3) 다른 계정으로 IMPORT하기

      ==> scott유저의 데이터를 EXPORT받아서 test 유저에게 IMPORT하는 예제 입니다.

       C:\>exp userid=system/manager file='C:\scott.dmp' owner=scott

       C:\>imp userid=system/manager file='C:\scott.dmp' fromuser=scott touser=test      

   

출처:
  ================================================
    * Oracle Community OracleClub.com
    * http://www.oracleclub.com
    * http://www.oramaster.net
    * 운영자 : 김정식 (oramaster _at_ empal.com)
  ================================================  

Comments