解决sqoop 导入oracle表时 --split-by参数为日期类型时的报错:ORA-01861: literal does not match format string

报错栈:

2017-06-08 18:46:13,422 INFO [main] org.apache.sqoop.mapreduce.db.DBRecordReader: Executing query: select "JFRQ","ZYH","FYKS","KSSE","YBJE","YPJE","ZJJE" from BSHIS."DEPCS_T_DEPCS_BRMXCOST_DAY" tbl where ( JFRQ >= ‘2009-01-01 00:00:00.0‘ ) AND ( JFRQ < ‘2009-10-13 04:00:00.0‘ )
2017-06-08 18:46:13,439 ERROR [main] org.apache.sqoop.mapreduce.db.DBRecordReader: Top level exception:
java.sql.SQLDataException: ORA-01861: literal does not match format string
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
    at org.apache.sqoop.mapreduce.db.DBRecordReader.executeQuery(DBRecordReader.java:111)
    at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:235)
    at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
    at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
    at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
2017-06-08 18:46:13,448 INFO [Thread-12] org.apache.sqoop.mapreduce.AutoProgressMapper: Auto-progress thread is finished. keepGoing=false
2017-06-08 18:46:13,468 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.IOException: SQLException in nextKeyValue
    at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277)
    at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
    at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
    at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.sql.SQLDataException: ORA-01861: literal does not match format string
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
    at org.apache.sqoop.mapreduce.db.DBRecordReader.executeQuery(DBRecordReader.java:111)
    at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:235)
    ... 12 more

报错为sql抛出,sql改写后执行成功,下面两句都可以:

sqoop的一个bug: https://issues.apache.org/jira/browse/SQOOP-1946, 解决方案大致为转换成string类型即可。发现这个列的类型为date, 因此解决方案为: --split-by "to_char(我的日期列,‘yyyy-mm-dd hh24:mi:ss‘)"。
参考:https://my.oschina.net/pomo/blog/725060

时间: 2024-12-21 23:18:18

解决sqoop 导入oracle表时 --split-by参数为日期类型时的报错:ORA-01861: literal does not match format string的相关文章

接收的参数为日期类型时

1.1新建动态web工程 1.2导入springmvc相关jar包 1.3配置web.xml文件(已经安装了插件,使用插件加载后再修改相关参数,快捷键:Alt+/) *修改如下地方 1.4创建Spring Bean Configuration File文件,配置springmvc配置文件(创建的xml文件名需要与web.xml中classpath后的文件名对照) *使用插件引入jar包路径 *添加包扫描.开启驱动.视图解析器 1.5在WEB-INF目录下新建view文件夹,添加index.jsp

Oracle问题之literal does not match format string

问题: oerr ora 186101861, 00000, "literal does not match format string"// *Cause: Literals in the input must be the same length as literals in// the format string (with the exception of leading whitespace). If the// "FX" modifier has bee

Linux下编译程序时,经常会遇到“undefined reference to XXX” 报错,

Linux下编译程序时,经常会遇到“undefined reference to XXX” 报错, 这里总结一些可能的原因和解决方案,给需要的朋友: 说道undefined reference error,先提一下Linux gcc链接规则: 链接的时候查找顺序是: -L 指定的路径, 从左到右依次查找 由 环境变量 LIBRARY_PATH 指定的路径,使用":"分割从左到右依次查找 /etc/ld.so.conf 指定的路径顺序 /lib 和 /usr/lib (64位下是/lib

【Note2】用keil对工程编译时,工程中已经包含的文件会报错:cannot open source input file usb_conf.h No such file or directory

错误举例: ..\..\Libraries\STM32_USB-FS-Device_Driver\inc\usb_type.h(21): error:  #5: cannot open source input file "usb_conf.h": No such file or directory 这是因为没有设置 STM32 固件库的目录, 编译器就默认到 "Keil"根目录下的某某目录找去了.如果现在编译程序,会报错的 解决方法:引用固件库文件所在的目录需要在

js函数传递参数时,如果是路径类型的参数,里边包含:&#39;\&#39;字符报错

在函数中,传递的参数中有“\”字符,js会将它默认为转义字符串,如果没有出现与他匹配的转义字符串,就会缺失,例如: 将这样的一个字符串作为一个参数:C:\Program Files (x86)\MySQL\MySQL Server 5.7\data\ 传递到函数里边的值就会被默认转化为:C:Program Files (x86)MySQLMySQL Server 5.7data 如果要实现这个参数的精确传递,就需要将字符串进行处理,一般会有两种方式: ①:将字符串里边的 ‘\’ 字符替换成 ‘/

解决sqoop导入关系库更新联合主键的问题

[Author]: kwu sqoop导入关系库更新联合主键的问题,把数据从hive中导入关系库,如果关系库表有联合主键的情况,且需要把新导入的数据更新原来的数据. 1.创建关系库表 CREATE TABLE test123 ( id INT NOT NULL, name VARCHAR(25) NOT NULL, age INT, PRIMARY KEY (id, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 2.创建hive表 drop table d

解决sqoop导入报错:Caused by: java.sql.SQLException: Protocol violation

报错信息: 2017-06-15 15:02:15,374 INFO [main] org.apache.hadoop.mapred.MapTask: Ignoring exception during close for [email protected]0 java.io.IOException: java.sql.SQLException: Protocol violation at org.apache.sqoop.mapreduce.db.DBRecordReader.close(DB

py+selenium 直接给日期赋值,控制台调试报错【已解决】

目标:给带日期控件的输入框赋值. 百度去搜索让你各种去只读readonly属性,再send_keys 方法: 其实既然可以去除readonly属性,那就可以直接给属性赋值,将两行代码缩为一行. driver.execute_script("document.getElementById('planDate').value=20181010;") 这样一行直接搞定. 个人遇到过的一些问题: 当在控制台调试js的时候,可能会遇到控制台报错.控制台报错:无法设置未定义或null引用的属性&q

ssm整合shiro时web。xml中配置filter,tomcat报错

当我们使用ssm框架整合进行项目开发,使用Shiro作为安全验证管理,在web.xml中配置Shiro过滤器后 启动Tomcat会报错: Error during artifact deployment. See server log for details. <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property na