sqlloader不上传数据

时间:2018-08-26 19:14:09

标签: oracle sql-loader

例如,我从维基百科下载了此文件

https://dumps.wikimedia.org/other/pageviews/2018/2018-04/pageviews-20180407-130000.gz

下载并解压缩后,我尝试使用sqlloader加载到表中,但失败了。你能帮我吗?

    LOAD 
 INFILE D:\pageviews\year=2016\month=06\*
 INTO TABLE teste
skip 1
fields terminated BY WHITESPACE,OPTIONALLY ENCLOSED BY '"'

文件示例

aa File:Cash_payment_timeline_on_foreclosures.jpg 1 0
aa Main_Page 4 0
aa Special:AllPages 1 0
aa Special:ListUsers 1 0
aa Special:SpecialPages 1 0
aa User:å°èº 1 0
aa.m.b Main_Page 1 0
ab Ðкатегориа:User_sk 1 0
ab БурÑа 1 0
ab Гай_Юлий_Цезарь 1 0
ab ИеÑуа_ҚьырÑта 1 0
ab Ихадоу_адаҟьа 3 0
ab УильÑм_ШекÑпир 1 0
ab Франциа 1 0

列分隔符为空格,表可以为c1 char 4000, c2 char 4000, c3 char 4000, c4 c 4000,仅用于测试第一个负载。该表始终为4列

1 个答案:

答案 0 :(得分:1)

好的,谢谢您发布其他信息。

测试表:

SQL> create table test
  2    (c1 varchar2(4000), c2 varchar2(4000), c3 varchar2(4000), c4 varchar2(4000));

Table created.

控制文件(为简单起见,我将示例数据包含在其中):

load data 
infile *
replace
into table test
fields terminated by whitespace
trailing nullcols
(
c1,
c2,
c3,
c4
)

begindata
aa File:Cash_payment_timeline_on_foreclosures.jpg 1 0
aa Main_Page 4 0
aa Special:AllPages 1 0
aa Special:ListUsers 1 0
aa Special:SpecialPages 1 0
aa User:å°èº 1 0
aa.m.b Main_Page 1 0
ab Ðкатегориа:User_sk 1 0
ab БурÑа 1 0
ab Гай_Юлий_Цезарь 1 0
ab ИеÑуа_ҚьырÑта 1 0
ab Ихадоу_адаҟьа 3 0
ab УильÑм_ШекÑпир 1 0
ab Франциа 1 0

加载会话:

SQL> $sqlldr scott/tiger@xe control=test03.ctl log=test03.log

SQL*Loader: Release 11.2.0.2.0 - Production on Ned Kol 26 23:43:17 2018

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

Commit point reached - logical record count 13
Commit point reached - logical record count 14

SQL>

结果:

SQL> col c1 format a7
SQL> col c2 format a60
SQL> col c3 format a2
SQL> col c4 format a2
SQL>
SQL> select * From test;

C1      C2                                                           C3 C4
------- ------------------------------------------------------------ -- --
aa      File:Cash_payment_timeline_on_foreclosures.jpg               1  0
aa      Main_Page                                                    4  0
aa      Special:AllPages                                             1  0
aa      Special:ListUsers                                            1  0
aa      Special:SpecialPages                                         1  0
aa      User:├ą┬░├Ę┬║                                                1  0
aa.m.b  Main_Page                                                    1  0
ab      ├É├É┬║├É┬░├ĹÔÇÜ├É┬Á├É┬│├É┬ż├ĹÔéČ├É┬Ş├É┬░:User_sk             1  0
ab      ├ÉÔÇś├ĹĂĺ├ĹÔéČ├Ĺ├É┬░                                         1  0
ab      ├ÉÔÇť├É┬░├É┬╣_├É┬«├É┬╗├É┬Ş├É┬╣_├É┬Ž├É┬Á├É┬Ě├É┬░├ĹÔéČ├Ĺ┼ĺ     1  0
ab      ├É╦ť├É┬Á├Ĺ├ĹĂĺ├É┬░_├ĺ┼í├Ĺ┼ĺ├ĹÔÇ╣├ĹÔéČ├Ĺ├ĹÔÇÜ├É┬░             1  0
ab      ├É╦ť├ĹÔÇŽ├É┬░├É┬┤├É┬ż├ĹĂĺ_├É┬░├É┬┤├É┬░├ĺ┼Ş├Ĺ┼ĺ├É┬░           3  0
ab      ├É┬ú├É┬Ş├É┬╗├Ĺ┼ĺ├Ĺ├É┬╝_├É┬Ę├É┬Á├É┬║├Ĺ├É┬┐├É┬Ş├ĹÔéČ           1  0
ab      ├É┬Ą├ĹÔéČ├É┬░├É┬Ż├ĹÔÇá├É┬Ş├É┬░                               1  0

14 rows selected.

SQL>

对我来说,大多数看起来像是垃圾,但原因可能是代码页差异。希望一旦加载数据,您会看到比这更智能的东西。祝你好运!