SQL*Loader是Oracle数据库导入外部数据的一个工具,一般用来导入文本文件,也可以导入二进制的文件,比如图片等。常用的就是导入文本就行了。(这里只记录最简单的数据导入)
当然前提是OracleOraDb10g_home1TNSListener和OracleDBConsole<SID>两个服务确保是开启的,还有提前建立表test_load。
1.控制文件loader.ctl:
load data?
infile 'd:/datafile.txt'?
append into table test_load?
fields terminated by ',' optionally enclosed by '"'?
(id, name, phone)
2.数据源文件datafile.txt:
001,"avid","0551-1234567"?
002,"dave","1552-2341212"?
003,"adfa","4242-1242343"?
004,"gdsf","4242-1287533"
3.开始加载外部数据:?基本格式:
sqlldr?userid= [email protected]=D:/loader.ctl (log=D:/log.LOG bad=D:/bad.BAD direct=true readsize=4194304)
()里面的内容可以省略
然后从表中检索信息:
[email protected]>select *from test_load;
ID NAME PHONE
---------- -------------------- --------------------
1 avid 0551-1234567
2 dave 1552-2341212
3 adfa 4242-1242343
4 gdsf 4242-1287533
成功!!