我在如下环境下运行成功 环境说明: 数据库:Oracle8.1.6OEM; 系 统:Windows2000 Server/Windorws xp ******************************************************************************************* 用记事本创建控制文件input.ctl,内容如下:load data infile 'test.txt' --数据文件 append into table Test fields terminated by '|' --或者是x'09'来标识,也即字段终止与制表符TAB ( --字段名称 cp_bh char(30), mc char(50), cp_ljmc char(100), zyh char(20), dj )*******************************************************************************************文本文件test.txt中的内容格式,例如下面10300108200|XPB65-113S|后盖 PP 0.34kg|0030200525 |3.42000008 10300108200|XPB65-113S|洗涤桶盖 浅兰透明ABS|0030200877 |15.52000046一般情况都是相互之间导出导入数据,比方说从excel导出的数据你可以将其保存为:制表符分隔,起名为test,……,等等。 ******************************************************************************************* 使用sql*loader进行数据导入(sqlldr -? 查看帮助)在“运行”里执行,命令如下: sqlldr username/pw control=路径\input.ctl data=路径\test.txt log=路径 bad=路径
OPTIONS(DIRECT=TRUE,ROWS=1000,ERRORS=100000000) LOAD DATA INFILE 'R00009.csv' BADFILE 'R00009.bad' TRUNCATE INTO TABLE R00009 FIELDS TERMINATED BY '|' TRAILING NULLCOLS ( SS_NO, ZIP )SQLLDR USERID=USR/PAS@SID CONTROL=R00009.ctl LOG=MYLOG.TXT DISCARD =MYERR.TXT DIRECT=FALSE
用法: SQLLOAD 关键字 = 值 [,keyword=value,...]有效的关键字: userid -- ORACLE username/password control -- Control file name log -- Log file name bad -- Bad file name data -- Data file name discard -- Discard file name discardmax -- Number of discards to allow (全部默认) skip -- Number of logical records to skip (默认0) load -- Number of logical records to load (全部默认) errors -- Number of errors to allow (默认50) rows -- Number of rows in conventional path bind array or between direct p ath data saves (默认: 常规路径 64, 所有直接路径) bindsize -- Size of conventional path bind array in bytes(默认65536) silent -- Suppress messages during run (header,feedback,errors,discards,part itions) direct -- use direct path (默认FALSE) parfile -- parameter file: name of file that contains parameter specification s parallel -- do parallel load (默认FALSE) file -- File to allocate extents from skip_unusable_indexes -- disallow/allow unusable indexes or index partitions(默 认FALSE) skip_index_maintenance -- do not maintain indexes, affected indexes as unus able(默认FALSE) commit_discontinued -- commit loaded rows when load is discontinued(默认FALSE) readsize -- Size of Read buffer (默认1048576)PLEASE NOTE: 命令行参数可以由位置或关键字指定 。前者的例子是 'sqlload scott/tiger foo';后者的例子是 'sqlload control=foo userid=scott/tiger'.位置指定参数的时间必须早于 但不可迟于由关键字指定的参数。例如, 'SQLLOAD SCott/tiger control=foo logfile=log', 但 '不允许 sqlload scott/tiger control=foo log',即使允许 参数 'log' 的位置正确。
一楼兄弟,如果我要导入自定义数据类型,
就不能用Excel了吧!
例如:有一列类型位:MDSYS.SDO_GEOMETRY
啥格式?
环境说明:
数据库:Oracle8.1.6OEM;
系 统:Windows2000 Server/Windorws xp
*******************************************************************************************
用记事本创建控制文件input.ctl,内容如下:load data
infile 'test.txt' --数据文件
append into table Test
fields terminated by '|' --或者是x'09'来标识,也即字段终止与制表符TAB
( --字段名称
cp_bh char(30),
mc char(50),
cp_ljmc char(100),
zyh char(20),
dj
)*******************************************************************************************文本文件test.txt中的内容格式,例如下面10300108200|XPB65-113S|后盖 PP 0.34kg|0030200525 |3.42000008
10300108200|XPB65-113S|洗涤桶盖 浅兰透明ABS|0030200877 |15.52000046一般情况都是相互之间导出导入数据,比方说从excel导出的数据你可以将其保存为:制表符分隔,起名为test,……,等等。
*******************************************************************************************
使用sql*loader进行数据导入(sqlldr -? 查看帮助)在“运行”里执行,命令如下: sqlldr username/pw control=路径\input.ctl data=路径\test.txt log=路径 bad=路径
LOAD DATA
INFILE 'R00009.csv'
BADFILE 'R00009.bad'
TRUNCATE
INTO TABLE R00009
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
SS_NO,
ZIP
)SQLLDR USERID=USR/PAS@SID CONTROL=R00009.ctl LOG=MYLOG.TXT DISCARD =MYERR.TXT DIRECT=FALSE
control -- Control file name
log -- Log file name
bad -- Bad file name
data -- Data file name
discard -- Discard file name
discardmax -- Number of discards to allow (全部默认)
skip -- Number of logical records to skip (默认0)
load -- Number of logical records to load (全部默认)
errors -- Number of errors to allow (默认50)
rows -- Number of rows in conventional path bind array or between direct p
ath data saves
(默认: 常规路径 64, 所有直接路径)
bindsize -- Size of conventional path bind array in bytes(默认65536)
silent -- Suppress messages during run (header,feedback,errors,discards,part
itions)
direct -- use direct path (默认FALSE)
parfile -- parameter file: name of file that contains parameter specification
s
parallel -- do parallel load (默认FALSE)
file -- File to allocate extents from
skip_unusable_indexes -- disallow/allow unusable indexes or index partitions(默
认FALSE)
skip_index_maintenance -- do not maintain indexes, affected indexes as unus
able(默认FALSE)
commit_discontinued -- commit loaded rows when load is discontinued(默认FALSE)
readsize -- Size of Read buffer (默认1048576)PLEASE NOTE: 命令行参数可以由位置或关键字指定
。前者的例子是 'sqlload
scott/tiger foo';后者的例子是 'sqlload control=foo
userid=scott/tiger'.位置指定参数的时间必须早于
但不可迟于由关键字指定的参数。例如,
'SQLLOAD SCott/tiger control=foo logfile=log', 但
'不允许 sqlload scott/tiger control=foo log',即使允许
参数 'log' 的位置正确。