如何在sqoop import命令中指定oracle数据库模式名

zvokhttg  于 2021-06-03  发布在  Sqoop
关注(0)|答案(2)|浏览(359)

我有一个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.
cpjpxq1n

cpjpxq1n1#

问题在于表名和用户名区分大小写。
根据sqoop文件,
以大写形式指定sqoop连接的用户名(除非它是用引号中的混合/小写形式创建的)。
以大写形式指定正在使用的表名(除非它是用引号中的混合/小写形式创建的)。

fnx2tebb

fnx2tebb2#

你可能需要用这样的东西 sqoop import -–connect jdbc:oracle:thin:system/system@localhost:1521:xe

相关问题