PostgreSQL14下使用Ora2Pg报authentication method 10错如何解决
ora2pg 22.1连接PostgreSQL 14报authentication method 10错误解决方案
报错内容如下:
[========================>] 2/2 tables (100.0%) end of scanning.
DBI connect('dbname=postgres;host=hostname;port=5432','username',...) failed: authentication method 10 not supported at C:/Strawberry/perl/site/lib/Ora2Pg.pm line 2100.
FATAL: 1 ... authentication method 10 not supported
Aborting export...
支持性说明
ora2pg 22.1版本完全支持PostgreSQL 14默认的SCRAM认证(即报错中的authentication method 10),安装Authen::SCRAM后仍未解决问题的核心原因是PostgreSQL对应的Perl驱动DBD::Pg版本过低,未兼容SCRAM认证逻辑。
完整修复步骤
- 第一步:升级
DBD::Pg模块到3.7.0及以上版本,这是Perl生态中连接PostgreSQL的核心驱动,仅3.7.0以上版本原生支持SCRAM认证。
不同环境安装命令参考:- Windows Strawberry Perl环境:
cpanm DBD::Pg - Debian/Ubuntu环境:
apt update && apt install -y libdbd-pg-perl - CentOS/RHEL环境:
yum install -y perl-DBD-Pg - 通用cpan安装:
cpan DBD::Pg
- Windows Strawberry Perl环境:
- 第二步:修改ora2pg配置文件
properties.conf,新增/修改认证方式配置项:pg_auth_method scram-sha-256 - 第三步:验证配置生效,重新执行迁移命令即可:
ora2pg -c properties.conf
异常排查
如果执行上述操作后仍有报错,可做如下检查:
- 检查PostgreSQL服务端
pg_hba.conf中对应客户端访问的规则,认证方式配置为scram-sha-256,修改后执行pg_ctl reload重载配置生效。 - 确认迁移使用的PostgreSQL用户密码为SCRAM加密格式,执行SQL查询:
select rolpassword from pg_authid where rolname = '你的用户名';,返回结果以SCRAM-SHA-256$开头即为正常,否则需要重新设置用户密码生成SCRAM格式的加密串。
内容的提问来源于stack exchange,提问作者Squirrel
相关产品推荐
相关产品推荐

