我需要连接到远程 Oracle 数据库,所以我请求打开 1521 端口上的防火墙到数据库和副本。
[root@ansible-test ~]$ telnet <oracle_db_active> 1521
Trying <oracle_db_active>...
Connected to <oracle_db_active>.
Escape character is '^]'.
^CConnection closed by foreign host.
[root@ansible-test ~]$ telnet <oracle_db_replica> 1521
Trying <oracle_db_replica>...
Connected to <oracle_db_replica>.
Escape character is '^]'.
^CConnection closed by foreign host.
我可以远程登录到端口 1521 上的数据库。
但是当我尝试使用 SQLPlus 连接时,由于主机不存在,我得到一个错误。
[root@ansible-test ~]$ echo exit |sqlplus "<user>/<pass> @(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <oracle_db_active>)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = <oracle_db_replica>)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = <service>)(FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 12)(DELAY = 5))))"
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Sep 7 17:37:23 2020
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Enter user-name: Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
我在与数据库相同的网络中有另一台服务器,并且可以使用相同的字符串进行连接。
我没有在任何服务器上配置 sql.ora 或 tnsname.ora。
两台服务器的唯一区别是一台是RedHat,另一台是centos。
我是否需要向数据库打开任何其他端口,这是配置问题吗?
谢谢(对不起所有的编辑)