Imported Failed: Cannot convert SQL type 2005==> during importing CLOB data from Oracle database

筅森魡賤 提交于 2020-01-02 23:13:15

问题


I am trying to import a Oracle table's data with CLOB data type using sqoop and it is failing with the error Imported Failed: Cannot convert SQL type 2005. I am using Running Sqoop version: 1.4.5-cdh5.4.7.

Please help me how to import CLOB data type.

I am using the below oozie workflow to import the data

<workflow-app xmlns="uri:oozie:workflow:0.4" name="EBIH_Dly_tldb_dly_load_wf">
        <credentials>
                <credential name="hive2_cred" type="hive2">
                        <property>
                                <name>hive2.jdbc.url</name>
                                <value>${hive2_jdbc_uri}</value>
                        </property>
                        <property>
                                <name>hive2.server.principal</name>
                                <value>${hive2_server_principal}</value>
                        </property>
                </credential>
        </credentials>

        <start to="sqp_imp_tldb_table1"/>        

        <action name="sqp_imp_tldb_table1">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
                        <job-tracker>${jobTracker}</job-tracker>
                        <name-node>${nameNode}</name-node>
                        <arg>import</arg>
                        <arg>-Dmapreduce.output.fileoutputformat.compress=false</arg>
                        <arg>--connect</arg>
                        <arg>${connect_string}</arg>
                        <arg>--username</arg>
                        <arg>${username}</arg>
                        <arg>--password</arg>
                        <arg>${password}</arg>
                        <arg>--num-mappers</arg>
                        <arg>8</arg>
                        <arg>--as-textfile</arg>
                        <arg>--append</arg>
                        <arg>--fields-terminated-by</arg>
                        <arg>|</arg>
                        <arg>--split-by</arg>
                        <arg>created_dt</arg>
                        <arg>--target-dir</arg>
                        <arg>${sqp_table1_dir}</arg>
                        <arg>--map-column-hive</arg>
                        <arg>ID=bigint,XML1=string,XML2=string,APP_PAYLOAD=string,created_dt=date,created_day=bigint</arg>
                        <arg>--query</arg>
                        <arg>"select * from schema1.table1 where $CONDITIONS AND trunc(created_dt) BETWEEN  to_date('${load_start_date}','yyyy-mm-dd') AND to_date('${load_end_date}','yyyy-mm-dd')"</arg>
        </sqoop>
                <ok to="dly_load_wf_complete"/>
                <error to="fail"/>
        </action>


<kill name="fail">
 <message>Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
 </kill>

<end name="dly_load_wf_complete"/>
</workflow-app>     

回答1:


Finally it worked for me with an additional clause -D oraoop.disabled=true in sqoop import option.

The below worked

<action name="sqp_imp_tldb_table1">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
                        <job-tracker>${jobTracker}</job-tracker>
                        <name-node>${nameNode}</name-node>
                        <arg>import</arg>
                        <arg>-Dmapreduce.output.fileoutputformat.compress=false</arg>
                        <arg>-Doraoop.disabled=true</arg>
                        <arg>--connect</arg>
                        <arg>${connect_string}</arg>
                        <arg>--username</arg>
                        <arg>${username}</arg>
                        <arg>--password</arg>
                        <arg>${password}</arg>
                        <arg>--num-mappers</arg>
                        <arg>8</arg>
                        <arg>--as-textfile</arg>
                        <arg>--append</arg>
                        <arg>--fields-terminated-by</arg>
                        <arg>\t</arg>
                        <arg>--split-by</arg>
                        <arg>created_dt</arg>
                        <arg>--target-dir</arg>
                        <arg>${sqp_table1_dir}</arg>
                        <arg>--map-column-hive</arg>
                        <arg>ID=bigint,XML1=string,XML2=string,APP_PAYLOAD=string,created_dt=date,created_day=bigint</arg>
                        <arg>--query</arg>
                        <arg>"select * from schema1.table1 where $CONDITIONS AND trunc(created_dt) BETWEEN  to_date('${load_start_date}','yyyy-mm-dd') AND to_date('${load_end_date}','yyyy-mm-dd')"</arg>
        </sqoop>
                <ok to="dly_load_wf_complete"/>
                <error to="fail"/>
        </action>


来源:https://stackoverflow.com/questions/36259565/imported-failed-cannot-convert-sql-type-2005-during-importing-clob-data-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!