ora2pg 无法连接但 sqlplus 工作

ora2pg fails to connect but sqlplus works

我正在使用 https://oracle-base.com/articles/19c/minimum-viable-oracle-database-19c-installation-on-ol8#download-software 中的设置来执行此操作:

sqlplus / as sysdba <<EOF
alter session set container=ORCLPDB1;

create user testuser1 identified by testuser1 quota unlimited on users;
grant connect, resource to testuser1;

exit;
EOF

成功登录数据库:

sqlplus testuser1/testuser1@//localhost:1521/ORCLPDB1

但是 ora2pg.conf 文件是这样设置的:

ORACLE_DSN      dbi:Oracle:host=localhost;service_name=ORCLCDB;port=1521
ORACLE_USER     testuser1
ORACLE_PWD      testuser1

...登录失败。我试过了

  1. 正在更改 DSN,它正确地说根本找不到数据库;好
  2. 更改service_name,它说不存在这样的服务;好
  3. 同时尝试 service_name=ORCLCDB(如 tnsnames.ora 中所示)和 ORACLE_DSN 中的 service_name=ORCLCDB1ORCLCDB稍等片刻失败; ORCLCDB1 快速失败:
FATAL: 12514 ... ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBD ERROR: OCIServerAttach)

ora2pg.conf 是 dist 版本的副本,仅更改了 DNS、USER 和 PWD。

有什么想法吗?

您的可插拔数据库的服务名称是 ORCLPDB1,因此请使用它代替 CDB 服务名称(ORCLCDB):

ORACLE_DSN      dbi:Oracle:host=localhost;service_name=ORCLPDB1;port=1521
ORACLE_USER     testuser1
ORACLE_PWD      testuser1