Oracle/admin

SQL LOADER

소마후니 2016. 6. 24. 11:11

ctl 파일 작성


vi test.ctl


load data
infile '/app/oracle/backup/sqlldr/test.dat'
append
into table test
fields terminated by '.' optionally enclosed by '"'
(id,name,phone)


 


데이터가 들어가는 테이블을 만들어준다.


SQL > create table test (id number(30), name varchar2(200), phone varchar2(20));



'/app/oracle/backup/sqlldr/test.dat' 파일에는 데이터가 있다.

데이터는 위에 ctl파일에 정의한 대로 구분자 " . " 로 되어있다.


test.dat

1.aaa.111
2.bbb.222
3.aaa.333
4.bbb.444
5.aaa.555
6.bbb.666
7.aaa.777
8.bbb.888

....



sqlloader 실행

$ sqlldr userid=scott/tiger control=test.ctl


확인