来自 oracle 的数据库链接 -> ms sql ORA-28545 & ORA-02063

kul*_*uda 5 sql-server oracle

我们在 Windows Server 2016 上安装了 Oracle 12c,在 Windows Server 2019 上安装了 MS SQL Server 2017。

当我们尝试通过SELECT count(*) FROM SMSOUT@TOSIMSQLSERVER从 Oracle -> MS SQL 使用数据库链接时,我们得到以下错误:

ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from TOSIMSQLSERVER
28545. 0000 -  "error diagnosed by Net8 when connecting to an agent"
*Cause:    An attempt to call an external procedure or to issue SQL
           to a non-Oracle system on a Heterogeneous Services database link
           failed at connection initialization.  The error diagnosed
           by Net8 NCR software is reported separately.
*Action:   Refer to the Net8 NCRO error message.  If this isn't clear,
           check connection administrative setup in tnsnames.ora
           and listener.ora for the service associated with the
           Heterogeneous Services database link being used, or with
           'extproc_connection_data' for an external procedure call.
Error at Line: 1 Column: 29
Run Code Online (Sandbox Code Playgroud)

DB Link 是通过CREATE DATABASE LINK TOSIMSQLSERVER CONNECT TO "oms" IDENTIFIED BY "...our_pwd..." USING 'simsqlserver' 创建的;

\hs\admin\initsimsqlserver.ora:

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = simsqlserver
HS_FDS_TRACE_LEVEL = OFF
Run Code Online (Sandbox Code Playgroud)

\network\admin\listener.ora:

# listener.ora Network Configuration File: C:\app\oracle\product\12.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\oracle\product\12.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\12.2.0\dbhome_1\bin\oraclr12.dll")
    )
    (SID_DESC =
      (SID_NAME = simsqlserver)
      (ORACLE_HOME = C:\app\oracle\product\12.2.0\dbhome_1)
      (PROGRAM = dg4odbc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12.pds.opds.cz)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
Run Code Online (Sandbox Code Playgroud)

\network\admin\tnsnames.ora:

# tnsnames.ora Network Configuration File: C:\app\oracle\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12.pds.opds.cz)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oracle.pds.opds.cz)
    )
  )

LISTENER_ORACLE =
  (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12.pds.opds.cz)(PORT = 1521))

simsqlserver = 
(DESCRIPTION =
  (ADDRESS=(PROTOCOL=TCP)(HOST=oracle12.pds.opds.cz)(PORT=1521)) 
    (CONNECT_DATA=(SID=simsqlserver)) 
    (HS=OK)
)
Run Code Online (Sandbox Code Playgroud)

\network\admin\sqlnet.ora:

# sqlnet.ora Network Configuration File: C:\app\oracle\product\12.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Run Code Online (Sandbox Code Playgroud)

有人可以帮我找出问题出在哪里吗?SQL ODBC 数据源测试正常。另外 TNSPING 到 simsqlserver 也可以。

编辑 11.03.2020: 我们的 Oracle 是:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
PL/SQL Release 12.2.0.1.0 - Production
"CORE   12.2.0.1.0            Production"
TNS for 64-bit Windows: Version 12.2.0.1.0 - Production
NLSRTL Version 12.2.0.1.0 - Production
Run Code Online (Sandbox Code Playgroud)

设置 HS_FDS_TRACE_LEVEL = 16 和 lsnrctl stop + lsnrctl start 后,我​​们有以下日志:

\oracle\diag\rdbms\oracle\oracle\trace\alert_oracle.log:

2020-03-11T13:27:40.813789+01:00
HS:  Unable to establish RPC connection to HS Agent...
HS:  ... Agent SID = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12.pds.opds.cz)(PORT=1521))(CONNECT_DATA=(SID=simsqlserver))), NCR error = 65535 Unable to retrieve text of NETWORK/NCR message 65535

HS:  Unable to establish RPC connection to HS Agent...
HS:  ... Agent SID = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12.pds.opds.cz)(PORT=1521))(CONNECT_DATA=(SID=simsqlserver))), NCR error = 65535 Unable to retrieve text of NETWORK/NCR message 65535
Run Code Online (Sandbox Code Playgroud)

\oracle\diag\rdbms\oracle\oracle\alert\log.xml:

<msg time='2020-03-11T13:27:40.938+01:00' org_id='oracle' comp_id='rdbms'
type='UNKNOWN' level='16' host_id='ORACLE12'
host_addr='::1' module='SQL Developer' pid='2952'>
<txt>HS:  Unable to establish RPC connection to HS Agent...
</txt>
</msg>
<msg time='2020-03-11T13:27:40.938+01:00' org_id='oracle' comp_id='rdbms'
type='UNKNOWN' level='16' host_id='ORACLE12'
host_addr='::1' module='SQL Developer' pid='2952'>
<txt>HS:  ... Agent SID = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle12.pds.opds.cz)(PORT=1521))(CONNECT_DATA=(SID=simsqlserver))), NCR error = 65535 Unable to retrieve text of NETWORK/NCR message 65535
</txt>
</msg>
Run Code Online (Sandbox Code Playgroud)

pmd*_*dba 1

尝试删除

SQLNET.AUTHENTICATION_SERVICES= (NTS) 
Run Code Online (Sandbox Code Playgroud)

来自 sqlnet.ora 的行。根据MOS 文档 ID 1266571.1,这不是 DG4ODBC 指定配置的一部分。