1.创建数据文件:

[oracle@host03 ~]$ vi base_data.dat

1zhangfei  zhangyide
2guanyu    guangchangyun
3liubei    liuxuande
4zhugeliang

2.创建控制文件:

[oracle@host03 ~]$ vi base.ctl

load data
infile 'base_data.dat'
into table s1_base
truncate
trailing nullcols
(
id position(1:1),
fname position(2:11),
lname position(12:23)
)

3.查看生成的相关文件:

[oracle@host03 ~]$ ls 
base.ctl  base_data.dat

4.知悉sqlldr:

[oracle@host03 ~]$ sqlldr scott/tiger control=base.ctl

SQL*Loader: Release 11.2.0.4.0 - Production on Tue Dec 13 22:03:20 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Commit point reached - logical record count 4

5.查看生成的文件:

[oracle@host03 ~]$ ls
base.ctl  base_data.bad  base_data.dat  base.log

6.查看导入的数据:

21:41:09 SCOTT@ORA11GR2>select * from s1_base;

        ID FNAME      LNAME
---------- ---------- ----------
         1 zhangfei   zhangyide
         3 liubei     liuxuande
         4 zhugeliang

 

posted on 2016-12-16 15:39  Tomatoes  阅读(490)  评论(0编辑  收藏  举报