SQL*LOADER是ORACLE的数据加载工具,通常用来将操作系统文件迁移到oracle数据库中。SQL*LOADER是大型数据仓库选择使用的加载方法,
先用简单的实验来快速了解SQL*LOADER的使用方法
在操作系统上创建一个文本文件
[oracle@PROD1 oracle]$ pwd
/u01/app/oracle
[oracle@PROD1 oracle]$ vi data.txt
xa0010011,88721,201207
xa0010012,88722,201207
xa0010013,88723,201207
创建一张空表
[oracle@PROD1 oracle]$ sqlplus / as sysdba
SYS@PROD1>create table sqlldr_text
2 (user_no varchar2(100),
3 user_rate number,
4 month_id varchar2(6));
Table created.
编写一个sqlloader的控制文件
[oracle@PROD1 oracle]$ vi control.ctl
load data
infile '/u01/app/oracle/data.txt'
append
into table sqlldr_text
fields terminated by ','
trailing nullcols
(
user_no,
user_rate,
month_id
)
通过命令行的方式将data.txt中的内容导入表sqlldr_test
[oracle@PROD1 oracle]$ sqlldr "'sys/ether as sysdba'" control=control.ctl log=ll.log
SQL*Loader: Release 11.2.0.4.0 - Production on Tue Jan 19 18:56:58 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 3
[oracle@PROD1 oracle]$ sqlplus / as sysdba
SYS@PROD1>col USER_NO for a10
SYS@PROD1>select * from sqlldr_text;
USER_NO USER_RATE MONTH_
---------- ---------- ------
xa0010011 88721 201207
xa0010012 88722 201207
xa0010013 88723 201207
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30606744/viewspace-1979224/
,如需转载,请注明出处,否则将追究法律责任。