如何在Sqoop import命令中指定Oracle数据库模式名称

时间:2016-10-17 17:17:35

标签: oracle sqoop

我有一个oracle架构/用户U1(密码P1),其中包含表T1。 还有另一个oracle架构/用户U2(密码P2),它具有对表U1.T1的读取权限。

如何使用凭据U2 / P2导入T1。以下命令似乎不起作用。

sqoop import --connect jdbc:oracle:thin:@//localhost:1521/xe --username U2 --password P2 -m 1 --table U1.T1

使用--verbose标志

登录运行
16/10/19 20:52:23 DEBUG manager.OracleManager: Using column names query: SELECT t.* FROM T1 t WHERE 1=0
16/10/19 20:52:23 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : SELECT t.* FROM T1 t WHERE 1=0
16/10/19 20:52:23 DEBUG manager.OracleManager: Creating a new connection for jdbc:oracle:thin:@//localhost:1521/xe, using username:U2
16/10/19 20:52:23 DEBUG manager.OracleManager: No connection paramenters specified. Using regular API for making connection.
16/10/19 20:52:24 INFO manager.OracleManager: Time zone has been set to GMT
16/10/19 20:52:24 DEBUG manager.SqlManager: Using fetchSize for next query: 1000
16/10/19 20:52:24 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM TABLE_NAME t WHERE 1=0
16/10/19 20:52:24 DEBUG manager.SqlManager: Found column xxxxxxxxxx of type [2, 19, 0]
16/10/19 20:52:24 DEBUG manager.SqlManager: Found column xxxxxxxxxxxxx of type [12, 36, 0]
16/10/19 20:52:24 DEBUG manager.SqlManager: Found column xxxxxxxxxxxxx of type [-9, 512, 0]
....
16/10/19 20:52:24 DEBUG manager.OracleManager$ConnCache: Caching released connection for jdbc:oracle:thin:@//localhost:1521/xe/U2
16/10/19 20:52:24 ERROR tool.ImportTool: Imported Failed: There is no column found in the target table T1. Please ensure that your table name is correct.

2 个答案:

答案 0 :(得分:0)

您可能需要使用类似sqoop import -–connect jdbc:oracle:thin:system/system@localhost:1521:xe

的内容

答案 1 :(得分:0)

问题在于表名和用户名的区分大小写。

根据sqoop docs

  
      
  1. 以大写形式指定Sqoop连接的用户名(除非它是用引号内的混合/小写创建的。)

  2.   
  3. 以大写形式指定您正在使用的表名(除非使用引号内的混合/小写创建)。

  4.