관리 메뉴

나만의공간

sqlldr을 이용한 대량 데이타 업로드 방법 본문

IT/Oracle

sqlldr을 이용한 대량 데이타 업로드 방법

밥알이 2014. 6. 27. 10:44

오라클 sqlldr을 이용한 대량 데이타 업데이트 방법


사용법 : SQLLDR keyword=value [,keyword=value,...]

관련 옵션

    userid -- ORACLE username/password           

   control -- Control file name                  

       log -- Log file name                      

       bad -- Bad file name                      

      data -- Data file name                     

   discard -- Discard file name                  

discardmax -- Number of discards to allow          (Default all)

      skip -- Number of logical records to skip    (Default 0)

      load -- Number of logical records to load    (Default all)

    errors -- Number of errors to allow            (Default 50)

      rows -- Number of rows in conventional path bind array or between direct path data saves

               (Default: Conventional path 64, Direct path all)

  bindsize -- Size of conventional path bind array in bytes  (Default 256000)

    silent -- Suppress messages during run (header,feedback,errors,discards,partitions)

    direct -- use direct path                      (Default FALSE)

   parfile -- parameter file: name of file that contains parameter specifications

  parallel -- do parallel load                     (Default FALSE)

      file -- File to allocate extents from


1. 사용할 ctl 파일을 생성

samplectl.ctl

load data

    infile samplecsv.csv --데이타 파일명

    replace

    into table cipher_test --테이블명

    fields terminated by ',' -- 데이타 구분자

    (seq integer external,    -- 컬럼 속성

    original_content char(50)    -- 컬럼속성

    )


2. 입력한 데이타 형식을 ','를 구분자로 생성

1234,2000학번,학생1

1235,2000학번,학생2

1236,2000학번,학생2


3. sample

LOAD DATA

INFILE * --혹은 파일이름

APPEND

INTO TABLE "테이블명" -- 테이블명

FILELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"'

TRAILING NULLCOLS --값이 없으면 NULL로

(칼럼명기술 CONSTANT '기본값'

)

BEGINDATA

IMPORT할 데이타 기술 형식에 맞춰서


4. 명령어 실행

sqlldr scott/tiger@db접속정보 control=samplectl.ctl


'IT > Oracle' 카테고리의 다른 글

오라클 날짜기준 컬럼으로 주단위 합계 쿼리 방법  (0) 2024.01.30
오라클 GRANT 조회  (0) 2022.03.08
Comments