Oracle12c SQL*Loader(12.2.0.1)を動かしてみる
概要
こちらでインストールしたSQL*Loaderを動かしてみます。
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production CentOS Linux release 7.3.1611 (Core)
検証
テスト用テーブル作成
ロード用CSVデータ
[standingzzz@apl work]$ wc -l KEN_ALL_ROME_u.CSV 124117 KEN_ALL_ROME_u.CSV [standingzzz@apl work]$ 0060050,北海道,札幌市 手稲区,星置南,HOKKAIDO,SAPPORO SHI TEINE KU,HOSHIOKIMINAMI 0060811,北海道,札幌市 手稲区,前田 一条,HOKKAIDO,SAPPORO SHI TEINE KU,MAEDA 1-JO 0060812,北海道,札幌市 手稲区,前田 二条,HOKKAIDO,SAPPORO SHI TEINE KU,MAEDA 2-JO 0060813,北海道,札幌市 手稲区,前田 三条,HOKKAIDO,SAPPORO SHI TEINE KU,MAEDA 3-JO
コントロールファイル
options ( errors=-1, rows=10000 ) load data append into table tab_KEN_ALL_ROME fields terminated by ',' trailing nullcols ( postal_cd char(7) , pref_jp char(256) , city_jp char(256) , town_jp char(256) , pref_en char(256) , city_en char(256) , town_en char(256) )
ロード
$ sqlldr test01@PDB1 control=KEN_ALL_ROME.ctl data=KEN_ALL_ROME_u.CSV log=KEN_ALL_ROME.log bad=KEN_ALL_ROME.bad readsize=100000000 bindsize=100000000 Password: SQL*Loader: Release 12.2.0.1.0 - Production on Wed Oct 11 19:32:54 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. LRM-00104: '-1' is not a legal integer for 'errors' SQL*Loader-114: Error in OPTIONS statement [standingzzz@apl work]$
errors=-1のところで、integerじゃ無いからエラーだと言われました。
確かにマニュアル見るとこのような記述があります。12cから変わったのですね。
エラーを許容しない場合は、ERRORS=0を設定します。 エラーを無制限に許容する場合は、非常に大きい値を指定します。
再ロード errors=2147483648
型はintergerなので、integerのmax+1をあえて設定してみます。
$ sqlldr test01@PDB1 control=KEN_ALL_ROME.ctl data=KEN_ALL_ROME_u.CSV log=KEN_ALL_ROME.log bad=KEN_ALL_ROME.bad readsize=100000000 bindsize=100000000 Password: SQL*Loader: Release 12.2.0.1.0 - Production on Thu Oct 12 20:40:38 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. SQL*Loader-350: Syntax error at line 1. Expecting non-negative integer, found "-2147483648". options ( errors=2147483648, rows=10000 ) ^ [standingzzz@apl work]$
エラーになりました。
再ロード errors=2147483647
それではintegerのmaxにしてみます。
$ sqlldr test01@PDB1 control=KEN_ALL_ROME.ctl data=KEN_ALL_ROME_u.CSV log=KEN_ALL_ROME.log bad=KEN_ALL_ROME.bad readsize=100000000 bindsize=100000000 Password: SQL*Loader: Release 12.2.0.1.0 - Production on Thu Oct 12 20:42:06 2017 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. Path used: Conventional Commit point reached - logical record count 10000 Commit point reached - logical record count 20000 Commit point reached - logical record count 30000 Commit point reached - logical record count 40000 Commit point reached - logical record count 50000 Commit point reached - logical record count 60000 Commit point reached - logical record count 70000 Commit point reached - logical record count 80000 Commit point reached - logical record count 90000 Commit point reached - logical record count 100000 Commit point reached - logical record count 110000 Commit point reached - logical record count 120000 Commit point reached - logical record count 124117 Table TAB_KEN_ALL_ROME: 124117 Rows successfully loaded. Check the log file: KEN_ALL_ROME.log for more information about the load. [standingzzz@apl work]$
正常に動きました。まあ、0で良いのでしょうけど。