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

时间:2019-03-07 17:46:29

标签: database oracle oracle12c

我正在使用的应用程序使用服务名称连接到数据库。预期的格式为<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

1 个答案:

答案 0 :(得分:1)

检查db_name,db_domain并从global_name中选择global_name;