본문 바로가기
Dev/DataBase

[티베로] Export/Import

by nakanara 2023. 5. 31.
반응형

티베로 Export/Import 하기

티베로에는 오라클의 데이터베이스 백업과 복원에 필요한 expdp/impdp와 유사한 tbexport/tbimport 유틸이 존재합니다.

Export

tibero/clinet/bin/tbexport 파일을 이용하여 export 합니다.

모드는 Full, User, Table 3가지 모드를 지원하고 있으며, 세 가지 모드 중 하나를 선택하여 진행합니다.

Usage : tbexport [options] [parameter=value parameter=value ...]

Options:
  -h|--help        Display the more detailed information.
  -v|--version     Display the version information.
  -p|--patch       Display the binary's patch information.

Parameters:
  CFGFILE          Config file name
  COMPRESS         Compress Mode: Y/N, default: N
  CONSTRAINT       Export Constraint: Y/N, default: Y
  CONSISTENT       Consistent Mode: Y/N, default: N
  ENCRYPTION       Encryption Mode: all/data_only/metadata_only/encrypted_columns_only/none, default: none
  ENCRYPTION_PASSWORD Encryption Password to encrypt dump file
  EXCLUDE          Limit the export to specific objects # 제외 대상
  FILE             Export dump file name, default: default.dat
  FULL             Full Mode: Y/N, default: N # 전체 덤프
  GEOM_ASBYTES     Export the geometry columns as bytes, default: N 
  GRANT            Export Grant: Y/N, default: Y
  INDEX            Export Index: Y/N, default: Y
  INLINE_CONSTRAINT Use the Inline Constraint: Y/N, default: N (this option is only supported for the not null)
  IP               IP address, default: localhost
  LOG              Export script log file name
  LOGDIR           Export log directory
  NO_PACK_DIR      Export unpacked dump files to specified directory.
                   If this option is specified, FILE parameter will be ignored.
  OVERWRITE        Overwrite datafile if same file name exists: Y/N, default: N
  PASSWORD         User password # Import 사용자 패스워드
  PORT             PORT number, default: 8629
  QUERY            Where predicate: (Optional) to filter data to be exported
                   (must be used with TABLE parameter)
  REMAP_TABLE      Remaps the objects from the source table to the target table. # 변환할 테이블
  REMAP_TABLESPACE Remaps the objects from the source tablespace to the target tablespace. # 변환할 테이블스페이스
  ROWS             Export Table Rows: Y/N, default: Y
  SAVE_CREDENTIAL  Save your username and password to specified file
  SCRIPT           LOG THE DDL SCRIPT: Y/N, default: N
  SID              Database name
  TABLE            Table Mode: table name list. # 테이블 모드시 사용
                   Append :<Partition Name> to select a single partition (Optional)
  TEMP_DIR         Directory for the temporary raw dump files. 
  THREAD_CNT       Thread Count, default: 4
  USER             User Mode: user name list # 사용자 모드
  USERNAME         Database user name # 로그인 사용자
  NOVALIDATE       NOVALIDATE: Y/N , default: N 
  INDEX_PARALLEL_DEGREE Export Indexes with parallel indexing value default:NOPARALLEL
# Full 모드
$ tbexport username=sys password=tibero port=8629 sid=tibero file=exported.dat full=y 

# User 모드
$ tbexport username=sys password=tibero port=8629 sid=tibero file=exported.dat user=tibero

# Table 모드
$ tbexport username=sys password=tibero port=8629 sid=tibero file=exported.dat table=tibero.TableName

Import

Full, User, Table 3가지 모드 중 하나를 선택 진행해야 하며, Import전 TableSpace, User를 생성해야 합니다.

Parameters:
    BIND_BUF_SIZE     Specify the buffer size of DPL stream, default: 1M(1048576)
    CFGFILE           Config file name
    COMMIT            Commit after the insertion, default: N
    CONSTRAINT        Import Constraint: Y/N, default: Y
    DBLINK            Import DB Link: Y/N, default: Y
    DPL               Use Direct Path Load: Y/N, default: N
    ENCRYPTION_PASSWORD    encryption password to decrypt dump file
    EXCLUDE_TABLE     Exclude Imported Table, default: None
    EXCLUDE_USER      Exclude Imported User, default: None
    EXP_SERVER_VER    Specify the exported server version, default: 8
    FILE              Import dump file name, default: default.dat
    FROMUSER          FromUser toUser Mode: user name list(must be used with TOUSER parameter) 
    FULL              Full Mode: Y/N, default: N
    GRANT             Import Grant: Y/N, default: Y
    GEOM_ASBYTES      Import the data to the geometry columns as bytes, default: N
    IGNORE            Ignore create error due to object existence: Y/N, default: N
    INDEX             Import Index: Y/N, default: Y
    IO_BUF_SIZE       Specify the buffer size of file I/O, default: 16M(16777216)
    IP                IP address, default: localhost
    LOG               Import script log file name
    LOGDIR            Import log directory
    NATIONAL_CHARSET  Specify the exported national character set, default is the exported character set 
    NOLOGGING         Import Table's NOLOGGING attribute: Y/N, default: N
    NO_PACK_DIR       Import unpacked dump files from specified directory. If this option is specified, FILE parameter will be ignored.
    PASSWORD          User password
    ROLE              Import Role: Y/N, default: Y
    PORT              PORT number, default: 8629
    PSM               Import PSM: Y/N, default: Y
    P_DPL             Use Parallel DPL: Y/N, default: N
    ROWS              Import Table Rows: Y/N, default: Y
    SAVE_CREDENTIAL   Save your username and password to specified file
    SCRIPT            LOG THE DDL SCRIPT: Y/N, default: N
    SEQUENCE          Import Sequence: Y/N, default: Y
    SID               Database name
    SYNONYM           Import Synonym: Y/N, default: Y
    TABLE             Table Mode: table name list
    TEMP_DIR          Directory for the temporary raw dump files.
    THREAD_CNT        Thread Count, default: 4
    TOUSER            FromUser toUser Mode: user name list(must be used with FROMUSER parameter) 
    TRIGGER           Import Trigger: Y/N, default: Y
    USER              User Mode: user name list 
    USERNAME          Database user name
# Full 모드
$ tbimport username=sys password=tibero port=8629 sid=tibero file=test.dat full=y

# User 모드
$ tbimport username=sys password=tibero port=8629 sid=tibero file=test.dat user=tibero

# 사용자 변경을 통한 Import
# fromuser: 기존 사용자, touser: 변경 사용자
$ tbimport username=sys password=tibero port=8629 sid=tibero file=test.dat fromuser=fromUser touser=toUser

# Table 모드
$ tbimport username=sys password=tibero port=8629 sid=tibero file=test.dat table=tibero.test Table 모드
반응형