Tuesday, June 1, 2010

table import with Oracle SQL Loader (sqlldr)

Samlpe sql loader command:

sample 1:
sqlldr \'SYS/password AS SYSDBA\' control=/data1/dump/control2.ctl log=/data1/dump/test2.log

sample 2:
sqlldr userid=xxx/xxx control=/data01/DEV/control.ctl log=/data01/DEV/test.log




control file content:

OPTIONS (SKIP=0)
LOAD DATA
INFILE "/data1/dump/XXX_TABLE_NAME.txt"
BADFILE "/data1/dump/aaa.bad"
DISCARDFILE "/data1/dump/aaa.dsc"
TRUNCATE

INTO TABLE "XXX"."TABLE_NAME"
FIELDS TERMINATED BY "|"
trailing nullcols
(
SOURCE_SYSTEM_KEY CHAR(4000),
NAME_SURNAME CHAR(4000),
WORK_TEL CHAR(4000),
MOBILE_TEL CHAR(4000),
EMAIL CHAR(4000),
STATE CHAR(4000),
CITY CHAR(4000),
SSN CHAR(4000),
SSN2 CHAR(4000),
SEX CHAR(4000),
DATE_OF_BIRTH CHAR(4000),
NOTES CHAR(4000),
ADRESS CHAR(4000),
SOURCE_SYSTEM2 CHAR(200)
)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.