简体   繁体   English

从Oracle 12c到SQLServer 2012的异构数据库链接

[英]heterogeneous database link from Oracle 12c to SQLServer 2012

My problem: I want to link a Oracle 12c Enterprise with SQLServer 2012. I tried different tutorials but I didn't succeed. 我的问题:我想将Oracle 12c Enterprise与SQLServer 2012链接。我尝试了不同的教程,但没有成功。 On my latest approach with heterogeneous services i got the following error when i try to query something: 在使用异构服务的最新方法中,当我尝试查询某些内容时出现以下错误:

select * from conf@PAS; 从conf @ PAS选择*;

ORA-28545: Unable to retrieve text of NETWORK/NCR message 65535 ORA-28545:无法检索NETWORK / NCR消息65535的文本

conf is a table from the SQL Server and PAS is the name of my database link. conf是来自SQL Server的表,而PAS是我的数据库链接的名称。

The different guides I followed said that I have to change 3 files to make the connection. 我遵循的不同指南说,我必须更改3个文件才能建立连接。 I will post them below: 我将它们发布在下面:

Note: Both of my databases are running on the same machine. 注意:我的两个数据库都在同一台计算机上运行。

listener.ora: listener.ora中:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\OracleDB\product\12.1.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\OracleDB\product\12.1.0\dbhome_1\bin\oraclr12.dll")
    )
    (SID_DESC =
        (SID_NAME=PAS) 
        (ORACLE_HOME = C:\OracleDB\product\12.1.0\dbhome_1) 
        (PROGRAM = dg4odbc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = PASSRV1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

tnsnames.ora: tnsnames.ora中:

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

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PASSRV1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

PAS =
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1433))
      (CONNECT_DATA=(SID=PAS))
      (HS=OK)
    )

initPAS.ora: initPAS.ora:

HS_FDS_CONNECT_INFO = PAS
HS_FDS_TRACE_LEVEL = OFF

I created the link with this command: 我使用以下命令创建了链接:

CREATE DATABASE LINK PAS CONNECT TO "user" IDENTIFIED BY "password" USING 'PAS';

The thing is that i don't really know the cause of the error and I don't know how to resolve it. 问题是我真的不知道错误的原因,也不知道如何解决。 So I hope one of you can help me. 所以我希望你们中的一个能帮助我。

If there is a easier way to create the link I would appreciate it if you tell me. 如果有更简单的方法来创建链接,请告诉我。 I am open for suggestions. 我愿意征求意见。

Thank you! 谢谢!

我通过使用oracle网关并遵循一个简单的教程解决了该问题。

I used to have a similar problem, try first to test tnsping to PAS 我曾经有过类似的问题,请先尝试测试对PAS tnsping

cmd> tnsping PAS

after it if you don't have any problem about try to change the port of PAS 1433 is already used by SQL Server in default configuration. 如果您对尝试更改PAS 1433的端口没有任何问题,则默认配置下SQL Server已经使用它。 Try to start listener without any errors. 尝试启动侦听器,而不会出现任何错误。

Take in account that oracle database gateway for SQL Server has additional cost, if you install cd 5 from oracle installation you could have problems with oracle audit. 考虑到SQL Server的oracle数据库网关具有额外的成本,如果从oracle安装中install cd 5 ,则可能会遇到oracle审核问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM