SQL加载程序未在某些环境中加载所有列

时间:2016-12-08 14:26:39

标签: sqlplus sql-loader

我面临一个非常奇怪的问题,问题与SQL Loader有关。它会加载某些数据库中的所有列,同时跳过其他数据库中的最后一列。是的,目标表结构在所有数据库中是相同的。

以下是csv文件的外观:

OPTIONS (ERRORS=50, DIRECT=TRUE, SKIP=1)
LOAD DATA
INFILE *
REPLACE
INTO TABLE STAGING.PRODUCTS
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS (
"PRODUCT_ID",
"PRODUCT_NAME",
"CLIENT_TECHNOLOGY")
BEGINDATA

1;Product1;N/A
2;Product2;N/A
....
100;Product100;N/A

这是日志文件,来自dev01。这就是我的期望,即所有数据都成功加载:

SQL*Loader: Release 11.2.0.3.0 - Production on Thu Dec 8 15:29:21 2016

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

Control File:   products.csv
Data File:      products.csv
  Bad File:     products.bad
  Discard File:  none specified

 (Allow all discards)

Number to load: ALL
Number to skip: 1
Errors allowed: 50
Continuation:    none specified
Path used:      Direct

Table STAGING.PRODUCTS, loaded from every logical record.
Insert option in effect for this table: REPLACE
TRAILING NULLCOLS option in effect
   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
Message 3053 not found;  product=RDBMS; facility=UL
Message 3054 not found;  product=RDBMS; facility=UL
"PRODUCT_ID"                        FIRST     *   ;       CHARACTER            
"PRODUCT_NAME"                       NEXT     *   ;       CHARACTER            
"CLIENT_TECHNOLOGY"                  NEXT     *   ;       CHARACTER            


Table STAGING.PRODUCTS:
  100 Rows successfully loaded.
  0 Rows not loaded due to data errors.
  0 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.

另一方面,说dev12有不同的日志。最后一栏完全跳过了小镇。

SQL*Loader: Release 11.2.0.3.0 - Production on Thu Dec 8 15:29:21 2016

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

Control File:   products.csv
Data File:      products.csv
  Bad File:     products.bad
  Discard File:  none specified

 (Allow all discards)

Number to load: ALL
Number to skip: 1
Errors allowed: 50
Continuation:    none specified
Path used:      Direct

Table STAGING.PRODUCTS, loaded from every logical record.
Insert option in effect for this table: REPLACE
TRAILING NULLCOLS option in effect
   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
Message 3053 not found;  product=RDBMS; facility=UL
Message 3054 not found;  product=RDBMS; facility=UL
"PRODUCT_ID"                        FIRST     *   ;       CHARACTER            
"PRODUCT_NAME"                       NEXT     *   ;       CHARACTER          


Table STAGING.PRODUCTS:
  100 Rows successfully loaded.
  0 Rows not loaded due to data errors.
  0 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.

任何想法背后的原因是什么?目标表在所有环境中都是相同的。

create table STAGING.PRODUCTS
(
  product_id               VARCHAR2(64) not null,
  product_name             VARCHAR2(64) not null,
  client_technology        VARCHAR2(64) 
)

提前致谢: - )

1 个答案:

答案 0 :(得分:1)

你可能会遇到更大的问题。请注意两个日志文件中的这些行:

Message 3053 not found;  product=RDBMS; facility=UL
Message 3054 not found;  product=RDBMS; facility=UL

他们不应该在那里。根据一些搜索和这篇文章,一个文件丢失,也许客户端重新安装是有序的? http://www.orafaq.com/forum/t/51572/2

此外,您不需要在控制文件中的列名称周围使用双引号。我想知道双引号是否意味着区分大小写的列名称,例如在SQL中,或者dev12中的列名称可能不匹配?只是一个猜测。