參考:http://blog.csdn.net/zleven/article/details/53781111
導入時需要注意:
1)數據庫表名需要大寫; 我試小寫好像也可以 不知道是不是版本問題
Imported Failed: There is no column found in the target table xxx. Please ensure that your table name is correct.
2)數據庫表沒有主鍵時,需要指定--split-by參數或者使用--autoreset-to-one-mapper參數;
Error during import: No primary key could be found for table xxx.
3)使用查詢語句(--e或--query)導入時,需要指定--split-by參數及--target-dir參數;
When importing query results in parallel, you must specify --split-by. Must specify destination with --target-dir.
4)使用查詢語句導入時,需要在where子句中加入$CONDITIONS
java.io.IOException: Query [select * from xxx] must contain '$CONDITIONS' in WHERE clause.
如:
-
$ sqoop import --connect jdbc:oracle:thin:@192.168.1.10:1521:TEST --username test --password test
-
--e 'select * from T_SQOOP_TEST where $CONDITIONS' --verbose --split-by ID --target-dir temp3 --m 1
5)sqoop默認使用“,”(逗號)作爲列分隔符,\n(換行符)作爲行分隔符。當導入的數據中包含","或\n時可以通過--fields-terminated-by <char>參數指定列分隔符;使用--lines-terminated-by <char>參數指定行分隔符。
6)sqoop對大對象(CLOB和BLOB字段)有2種處理方式:一種方式是內嵌方式,直接將大對象和其他字段數據放在一起;另一種方式是將大對象單獨存儲,然後和主數據做一個關聯。
通常,小於16MB的大對象字段採用第一種方式大對象和主數據一起存儲。超過16MB的大對象採用第二種方式單獨存儲在導入目錄的_lobs子目錄下,每個文件最大能容納2^63字節。可以通過--inline-lob-limit參數設置內嵌字段的大小,如果設置爲0,則所有大對象將會單獨存儲。