sqlldr

sqlldr 是oracle的sql*loader工具,他可以把外部的文本格式数据导入到oracle 的内部表中,适用于不同数据库之间的数据转化迁移。缺点速度慢,clob和blob等数据类型支持性低。(mysql有自己的load 工具)

直接输入sqlldr可以看到帮助,这里不详细介绍了

举例:

导入insall.log文件


查看文件行数
[oracle@oracle ~]$ cat install.log |wc -l
1098    


文件格式
[oracle@oracle ~]$ cat install.log |tail -1
Installing words-3.0-17.el6.noarch


编写control file

[oracle@oracle ~]$ cat install.ctl
load data
infile '/home/oracle/install.log'        ----绝对路径,也可以写相对路径
insert into table install                     -----insert 表示插入,要求表为空  append表示追加  replace删除旧记录,替换新记录   truncate 通replace
(time char terminated by ' ',            ------以空格分隔
install char terminated by whitespace)   -----空白结尾


执行命令

sqlldr userid=ogg/oracle control=/home/oracle/install.ctl  log=load.log




[oracle@oracle ~]$ sqlldr userid=ogg/oracle control=install.ctl log=load.log


SQL*Loader: Release 11.2.0.3.0 - Production on Wed Apr 20 14:48:04 2016


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


SQL*Loader-941: Error during describe of table INSTALL
ORA-04043: object INSTALL does not exist                     提示表不存在,登录数据创建表


[oracle@oracle ~]$ sqlldr userid=ogg/oracle control=install.ctl log=load.log


SQL*Loader: Release 11.2.0.3.0 - Production on Wed Apr 20 14:48:54 2016


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


Commit point reached - logical record count 64
Commit point reached - logical record count 128
Commit point reached - logical record count 192
Commit point reached - logical record count 256
Commit point reached - logical record count 320
Commit point reached - logical record count 384
Commit point reached - logical record count 448
Commit point reached - logical record count 512
Commit point reached - logical record count 576
Commit point reached - logical record count 640
Commit point reached - logical record count 704
Commit point reached - logical record count 768
Commit point reached - logical record count 832
Commit point reached - logical record count 896
Commit point reached - logical record count 960
Commit point reached - logical record count 1024
Commit point reached - logical record count 1088
Commit point reached - logical record count 1098      再次执行,插入了1098条数据和一开始吻合





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值