Oracle 通用数据库链接不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1044739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:28:24  来源:igfitidea点击:

Oracle Generic DB Link not working

databaseoraclepostgresqlodbcdblink

提问by Tim Ashman

I'm trying to use oracle's hsodbc generic database link driver to access a postgresql database from my oracle 10gr2 database server. I think I have everything configured but I'm receiving this error from the sqlplus promt after trying a remote query.

我正在尝试使用 oracle 的 hsodbc 通用数据库链接驱动程序从我的 oracle 10gr2 数据库服务器访问 postgresql 数据库。我想我已经配置了所有内容,但是在尝试远程查询后,我从 sqlplus promt 收到了这个错误。

SQL> select * from temp_user@intranet;
select * from temp_user@intranet
                        *
ERROR at line 1:
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 INTRANET

If I use "isql" from the linux command line (in other words test just the odbc connection) the query works.

如果我从 linux 命令行使用“isql”(换句话说,只测试 odbc 连接),则查询有效。

I enter in "isql intranet" (intranet is the name of the odbc connection) I get the prompt I type select * from temp_user and I receive back my 157 records on screen.

我输入“isql 内联网”(内联网是 odbc 连接的名称)我得到提示我输入 select * from temp_user 并在屏幕上收到我的 157 条记录。

So I know the odbc configuration is setup correctly. Here is what I do for oracle.

所以我知道 odbc 配置设置正确。这是我为 oracle 所做的。

%oracle_home/hs/admin/inithsodbc.ora
HS_FDS_CONNECT_INFO = intranet
HS_FDS_TRACE_LEVEL = OFF
HS_FDS_SHAREABLE_NAME = /usr/bin/ODBCConfig
%oracle_home/network/admin/tnsnames.ora
INTRANET =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.1)(PORT = 5432))
    )
    (CONNECT_DATA =
      (SID = INTRANET)
    )
    (HS = OK)

%oracle_home/network/admin/listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = INTRANET)
      (PROGRAM = hsodbc)
      (SID_NAME = INTRANET)
      (ORACLE_HOME = /home/oracle/app/OraHomeTEST)
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.andersen-const.com)(PORT = 5432))
    )
  )

I have restarted the listener. It's status is as follows.

我已经重新启动了监听器。它的状态如下。

Services Summary...
Service "INTRANET" has 1 instance(s).
  Instance "INTRANET", status UNKNOWN, has 1 handler(s) for this service...

I then go into sqlplus from the database server command line and do the following.

然后我从数据库服务器命令行进入 sqlplus 并执行以下操作。

drop database link intranet;

create database link intranet connect to auser identified by apassword using 'intranet';

创建数据库链接 Intranet 使用“intranet”连接到由密码标识的用户;

This is successful.

这是成功的。

However when I run

但是当我跑

 select * from temp_user@intranet

I receive the error

我收到错误

ERROR at line 1:
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 INTRANET

I've spend atleast a good day going back over the configures and trying things and I always get this error.

我至少花了一天的时间来回顾配置并尝试一些事情,但我总是遇到这个错误。

Anybody have any good ideas,

大家有什么好主意,

回答by DCookie

What does "tnsping intranet" report?

“tnsping内网”报告什么?

Are you sure your hsodbc prorgram is in the Oracle_home/bin directory of the your gateway installation? Also, is your LD_LIBRARY_PATH set properly?

您确定您的 hsodbc 程序位于网关安装的 Oracle_home/bin 目录中吗?另外,您的 LD_LIBRARY_PATH 设置是否正确?

I believe your LD_LIBRARY_PATH should be $ORACLE_HOME/lib. Sorry, not sure since I don't do much with *Nix these days.

我相信你的 LD_LIBRARY_PATH 应该是 $ORACLE_HOME/lib。抱歉,不确定,因为这些天我对 *Nix 的处理不多。