适用版本
OBLOADER/OBDUMPER 所有版本。
问题现象
使用 OBLOADER/OBDUMPER 连接 OceanBase 数据库进行导入、导出操作时,报如下错误。
Access denied for user 'proxyro@sys#xxxx'@'xxx.xxx.xxx.xxx' (Using password: YES)
或者如下错误。
ERROR create connection SQLException. url: jdbc:oceanbase://...,errorcode -1, state 0800 java.sql.SQLNonTransientConnectionException: Could not connect to address(host=xxx): Could not connect to xxx:xxx: unexpected end of stream. read 0 bytes from 4 (socket was closed by server)
...
Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to xxx:xxx: unexpected end of stream.
at com.oceanbase.jdbc.internal.io.input.StandardPacketInputStream.getPacketArray(StandardPacketInputStream.java:249) ~(oceanbase-client-2.2.6.jar:?)
at com.oceanbase.jdbc.internal.io.input.StandardPacketInputStream.getPacket(StandardPacketInputStream.java:217) ~(oceanbase-client-2.2.6.jar:?)
at com.oceanbase.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:700) ~(oceanbase-client-2.2.6.jar:?)
问题原因
OBLOADER/OBDUMPER 需要访问 sys 租户获取 schema 信息,但在命令中没有使用 --sys-user、--sys-password 来指定 sys 租户的用户和密码,而是通过秘钥文件来使用 ODP 的内部用户 proxyro 访问 sys租户。使用 proxyro 用户连接 OBProxy 需要设置 skip_proxyro_check = True,否则会拒绝访问。
解决方法
修改 ODP 参数,把 skip_proxyro_check 设置为 True。
obclient> alter proxyconfig set skip_proxyro_check = True