网站结构怎么优化,微信小程序云开发收费标准,邯郸之战,闵行区网页设计公司仓库选择使用的加载方法#xff0c;因为它提供了最快速的途径#xff08;DIRECT#xff0c;PARALLEL#xff09;。现在#xff0c;我们抛开其理论不谈#xff0c;用实例来使
您快速掌握SQL*LOADER的使用方法。首先#xff0c;我们认识一下SQL*LOADER。在NT下#xff0c…仓库选择使用的加载方法因为它提供了最快速的途径DIRECTPARALLEL。现在我们抛开其理论不谈用实例来使
您快速掌握SQL*LOADER的使用方法。首先我们认识一下SQL*LOADER。在NT下SQL*LOADER的命令为SQLLDR在UNIX下一般为sqlldr/sqlload。如执行draclesqlldr
SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 11:06:42 2002
(c) Copyright 1999 Oracle Corporation. All rights reserved.
用法: SQLLOAD 关键字 值 [,keywordvalue,...]
有效的关键字:userid -- ORACLE username/passwordcontrol -- Control file namelog -- Log file namebad -- Bad file namedata -- Data file namediscard -- 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 -- Supdivss messages during run (header,feedback,errors,discards,part
itions)direct -- use direct path (默认FALSE)parfile -- parameter file: name of file that contains parameter specification
sparallel -- 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, mark affected indexes as unusable(默认FALSE)
commit_discontinued -- commit loaded rows when load is discontinued(默认FALSE)readsize -- Size of Read buffer (默认1048576)
PLEASE NOTE: 命令行参数可以由位置或关键字指定。
前者的例子是 sqlload scott/tiger foo;
后者的例子是 sqlload controlfoo useridscott/tiger.
位置指定参数的时间必须早于但不可迟于由关键字指定的参数。例如,
SQLLOAD SCott/tiger controlfoo logfilelog,
但不允许 sqlload scott/tiger controlfoo log,
即使允许参数 log 的位置正确。
dracle我们可以从中看到一些基本的帮助信息这里我用到的是中文的WIN2000 ADV SERVER。我们知道SQL*LOADER只能导入纯文本所以我们现在开始以实例来讲解其用法。一、已存在数据源result.csv欲倒入ORACLE中FANCY用户下。result.csv内容1,默认 Web 站点,192.168.2.254:80:,RUNNING2,other,192.168.2.254:80:test.com,STOPPED3,third,192.168.2.254:81:thirdabc.com,RUNNING从中我们看出4列分别以逗号分隔为变长字符串。二、制定控制文件result.ctlresult.ctl内容
load data
infile result.csv
into table resultxt
(resultid char terminated by ,,
website char terminated by ,,
ipport char terminated by ,,
status char terminated by whitespace)说明infile 指数据源文件 这里我们省略了默认的 discardfile result.dsc badfile result.badinto table resultxt 默认是INSERT也可以into table resultxt APPEND为追加方式或REPLACEterminated by , 指用逗号分隔terminated by whitespace 结尾以空白分隔三、此时我们执行加载
D:sqlldr useridfancy/testpass controlresult.ctl logresulthis.out
SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 10:25:42 2002
(c) Copyright 1999 Oracle Corporation. All rights reserved.
SQL*Loader-941: 在描述表RESULTXT时出现错误
ORA-04043: 对象 RESULTXT 不存在提示出错因为数据库没有对应的表。四、在数据库建立表create table resultxt(resultid varchar2(500),website varchar2(500),ipport varchar2(500),status varchar2(500))
/五、重新执行加载D:sqlldr useridfancy/k1i7l6l8 controlresult.ctl logresulthis.out
SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 10:31:57 2002
(c) Copyright 1999 Oracle Corporation. All rights reserved.
达到提交点逻辑记录计数2
达到提交点逻辑记录计数3已经成功我们可以通过日志文件来分析其过程resulthis.out内容如下
SQL*Loader: Release 8.1.6.0.0 - Production on 星期二 1月 8 10:31:57 2002
(c) Copyright 1999 Oracle Corporation. All rights reserved.
控制文件: result.ctl
数据文件: result.csv
错误文件: result.bad
废弃文件: 未作指定
:
(可废弃所有记录)
装载数: ALL
跳过数: 0
允许的错误: 50
绑定数组: 64 行最大 65536 字节
继续: 未作指定
所用路径: 常规
表RESULTXT
已载入从每个逻辑记录
插入选项对此表INSERT生效列名 位置 长度 中止 包装数据类型
------------------------------ ---------- ----- ---- ---- ---------------------
RESULTID FIRST * , CHARACTER
WEBSITE NEXT * , CHARACTER
IPPORT NEXT * , CHARACTER
STATUS NEXT * WHT CHARACTER
表RESULTXT:
3 行载入成功
由于数据错误, 0 行没有载入。
由于所有 WHEN 子句失败, 0 行没有载入。
由于所有字段都为空的, 0 行没有载入。
为结合数组分配的空间: 65016字节63行
除绑定数组外的内存空间分配: 0字节
跳过的逻辑记录总数: 0
读取的逻辑记录总数: 3
拒绝的逻辑记录总数: 0
废弃的逻辑记录总数: 0
从星期二 1月 08 10:31:57 2002开始运行
在星期二 1月 08 10:32:00 2002处运行结束
经过时间为: 00: 00: 02.70
CPU 时间为: 00: 00: 00.10(可六、并发操作sqlldr userid/ controlresult1.ctl directtrue paralleltruesqlldr userid/ controlresult2.ctl directtrue paralleltruesqlldr userid/ controlresult2.ctl directtrue paralleltrue当加载大量数据时大约超过10GB最好抑制日志的产生SQLALTER TABLE RESULTXT nologging;这样不产生REDO LOG可以提高效率。然后在CONTROL文件中load data上面加一行unrecoverable 此选项必须要与DIRECT共同应用。在并发操作时ORACLE声称可以达到每小时处理100GB数据的能力其实估计能到110G就算不错了开始可用结构相同的文件但只有少量数据成功后开始加载大量数据这样可以避免时间的浪费。我的示例
一、在数据库建立表格weather如下
create table weather(
outlook varchar(20),
temperature float,
humidity float,
windy varchar(10),
play varchar(10)
)
二、在F盘建立两个文件 分别如下
#1、result.ctl内容如下
load data
infile result.csv
into table weather
(outlook char terminated by ,,
temperature char terminated by ,,
humidity char terminated by ,,
windy char terminated by ,,
play char terminated by ,
)
#2、result.csv内容如下
sunny,85,85,FALSE,no
sunny,80,90,TRUE,no
overcast,83,86,FALSE,yes
rainy,70,96,FALSE,yes
rainy,68,80,FALSE,yes
rainy,65,70,TRUE,no
overcast,64,65,TRUE,yes
sunny,72,95,FALSE,no
sunny,69,70,FALSE,yes
rainy,75,80,FALSE,yes
sunny,75,70,TRUE,yes
overcast,72,90,TRUE,yes
overcast,81,75,FALSE,yes
rainy,71,91,TRUE,no
三、命令行下执行
F:sqlldr useridcqsb/ctbujx123 controlresult.ctlwww.jhaccp.com.cn