SQL 加载程序在某些环境中未加载所有列
SQL loader not loading all columns in some environments
我遇到了一个很奇怪的问题,这个问题与 SQL Loader 有关。它加载某些数据库中的所有列,而跳过其他数据库中的最后一列。是的,目标 table 结构在所有数据库中都是相同的。
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.
知道背后的原因是什么吗?目标 table 在所有环境中都是相同的。
create table STAGING.PRODUCTS
(
product_id VARCHAR2(64) not null,
product_name VARCHAR2(64) not null,
client_technology VARCHAR2(64)
)
提前致谢:-)
你可能有更大的问题在起作用。请注意两个日志文件中的这些行:
Message 3053 not found; product=RDBMS; facility=UL
Message 3054 not found; product=RDBMS; facility=UL
他们不应该在那里。根据一点搜索和这个post,一个文件丢失了,也许需要重新安装客户端? http://www.orafaq.com/forum/t/51572/2
此外,您不需要在控制文件中的列名称周围加上双引号。我想知道双引号是否暗示区分大小写的列名,例如 SQL 中的 when ,也许 dev12 中的列名不匹配?只是猜测。
我遇到了一个很奇怪的问题,这个问题与 SQL Loader 有关。它加载某些数据库中的所有列,而跳过其他数据库中的最后一列。是的,目标 table 结构在所有数据库中都是相同的。
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.
知道背后的原因是什么吗?目标 table 在所有环境中都是相同的。
create table STAGING.PRODUCTS
(
product_id VARCHAR2(64) not null,
product_name VARCHAR2(64) not null,
client_technology VARCHAR2(64)
)
提前致谢:-)
你可能有更大的问题在起作用。请注意两个日志文件中的这些行:
Message 3053 not found; product=RDBMS; facility=UL
Message 3054 not found; product=RDBMS; facility=UL
他们不应该在那里。根据一点搜索和这个post,一个文件丢失了,也许需要重新安装客户端? http://www.orafaq.com/forum/t/51572/2
此外,您不需要在控制文件中的列名称周围加上双引号。我想知道双引号是否暗示区分大小写的列名,例如 SQL 中的 when ,也许 dev12 中的列名不匹配?只是猜测。