使用SID作为服务名称的Oracle数据库



我正在处理的一个应用程序使用服务名称连接到数据库。预期格式为 <SID>.<domain>。但是,该应用程序无法将其用作服务名称连接到数据库。

该服务器上有9个数据库。我可以使用该格式为服务名称(通过应用程序或SQL开发人员)连接到所有其他数据库。由于某种原因,我可以将SID仅作为服务名称连接到该域 - 但不能与域名连接。

从下面的TNS侦听器状态中可以看到,它仅将SID用于该数据库作为服务名称。我还应该说,我查看过的两个数据库的PFILE具有相同的值。

listener.ora

<...>
 LISTENER_<this sid> =
  (DESCRIPTION=
        (ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>.<domain>)(PORT=1521)))
SID_LIST_LISTENER_KS=
   (SID_LIST=
        (SID_DESC=
          (GLOBAL_DBNAME=<this sid>.<domain>)
          (SID_NAME=<this sid>)
          (ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1)
        )
    )
 LISTENER_<other sid> =
  (DESCRIPTION=
        (ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>.<domain>)(PORT=1521)))
SID_LIST_LISTENER_KS=
   (SID_LIST=
        (SID_DESC=
          (GLOBAL_DBNAME=<other sid>.<domain>)
          (SID_NAME=<other sid>)
          (ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1)
        )
    )
<...>

tnsnames.ora

<...>
<this sid> =
  (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>.<domain>)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <this sid>.<domain>)))
<other sid> =
  (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>.<domain>)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <other sid>.<domain>)))
<...>

tns侦听器状态:

$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 07-MAR-2019 10:24:48
Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                07-MAR-2019 08:46:13
Uptime                    0 days 1 hr. 38 min. 35 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/<hostname>/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>.<domain>)(PORT=1521)))
Services Summary...
<...>
Service "<this sid>" has 1 instance(s).
  Instance "<this sid>", status READY, has 1 handler(s) for this service...
Service "<this sid>XDB" has 1 instance(s).
  Instance "<this sid>", status READY, has 1 handler(s) for this service...
Service "<other sid>.<domain>" has 1 instance(s).
  Instance "<other sid>", status READY, has 1 handler(s) for this service...
Service "<other sid>XDB.<domain>" has 1 instance(s).
  Instance "<other sid>", status READY, has 1 handler(s) for this service...
<...>
The command completed successfully

错误消息当我使用<sid>.<domain>用作服务名称时:

Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

检查db_name,db_domain,并从global_name;

选择global_name

最新更新