如何从远程客户端连接到 Oracle 10g?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/859491/
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
How to connect to Oracle 10g from remote client?
提问by Shane
Using the standard Delphi dbexpress dbexpora.dll + oci.dll (10g) (the oracle instantclient is installed).
使用标准的Delphi dbexpress dbexpora.dll + oci.dll (10g)(安装了oracle Instantclient)。
When directly on the Oracle Database box we can run dbexpress apps just fine. The local dbxconnections.ini alias used in that case simply specifies our DB service name ORCL as the "database" parameter.
当直接在 Oracle 数据库框上时,我们可以很好地运行 dbexpress 应用程序。在这种情况下使用的本地 dbxconnections.ini 别名只是将我们的数据库服务名称 ORCL 指定为“数据库”参数。
We are trying to connect to this same database from client machines and receiving a series of errors.
我们正在尝试从客户端计算机连接到同一个数据库并收到一系列错误。
Naturally, we are trying all manner of strings in the database parameter. Using a string like, MOHAWK2:1521:ORCL we are at the point where we can at least get a listener error:
当然,我们正在尝试数据库参数中的各种字符串。使用像 MOHAWK2:1521:ORCL 这样的字符串,我们至少可以得到一个侦听器错误:
Failure to Connect: ORA-12514 TNS:listener does not currently know of service requested in connect descripter.
连接失败:ORA-12514 TNS:listener 当前不知道连接描述符中请求的服务。
I imagine there are some tools to test the naming availability...
我想有一些工具可以测试命名可用性......
回答by Brian Evans
Use TNSPING on the server to see how it's resolving the service name. Various configuration options and files can map a simple designation to a full server/port/service.
在服务器上使用 TNSPING 来查看它如何解析服务名称。各种配置选项和文件可以将简单的名称映射到完整的服务器/端口/服务。
C:>TNSPING ORCL
C:>TNSPING ORCL
Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))) OK (0 msec)
使用 TNSNAMES 适配器解析别名 Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))) OK (0 毫秒)
Extract out the server/port/service and construct the connect string in whatever format the component or connection method your using needs.
提取服务器/端口/服务并以您使用的组件或连接方法需要的任何格式构建连接字符串。
回答by MichaelN
Is the listener setup and running on the oracle server? Is it accepting connection for the instance/service of the database you are connecting to? Have you checked with lsnrctl status? Have you try turning on sqlnet logging and listener logging to see if you are even making a connection to the database from the remote site and what error is recorded in the listner log as to why its refusing service? Is the listener accepting tcp connection or is the listener only accepting IPC connection? without listening for tcp connection, it won't accept remote connections.
侦听器是否在 oracle 服务器上设置并运行?它是否接受您要连接的数据库的实例/服务的连接?您是否检查过 lsnrctl 状态?您是否尝试打开 sqlnet 日志记录和侦听器日志记录,以查看您是否甚至从远程站点连接到数据库,以及侦听器日志中记录了哪些错误以解释其拒绝服务的原因?侦听器是接受 tcp 连接还是仅接受 IPC 连接?不监听 tcp 连接,它不会接受远程连接。
回答by stili
Check connectivity using tnsping first. If OK, try connecting with sqlplus. If tnsping fails you are using incorrect service name, or you haven't configured your client properly. If you are relying on local configurations, the file to edit is tnsnames.ora in ORAHOME\NETWORK\ADMIN which will need configuration settings in order to locate the server, and this includes host, port and service name.
首先使用 tnsping 检查连接。如果正常,请尝试使用 sqlplus 连接。如果 tnsping 失败,您使用的服务名称不正确,或者您没有正确配置您的客户端。如果您依赖本地配置,则要编辑的文件是 ORAHOME\NETWORK\ADMIN 中的 tnsnames.ora,它需要配置设置才能定位服务器,其中包括主机、端口和服务名称。
回答by Shane
Sorry, about the CAPS, this is all new to me. I don't have any reputation, what i did have has now been lowered do to this question title being in caps. I dont know how to comment to you all who have answered........casue it wont let me.....i dont have enough reputation. I guess i need to move onto another forum....
抱歉,关于 CAPS,这对我来说是全新的。我没有任何声誉,我所做的现在已经降低了这个问题标题是大写的。我不知道如何向所有回答的人发表评论......因为它不会让我......我没有足够的声誉。我想我需要转移到另一个论坛....
anyway,
反正,
Solved!
解决了!
I setup a new vmware clone - installed the oracle client and our couple of dlls and exes in a dir and it worked.
我设置了一个新的 vmware 克隆 - 在一个目录中安装了 oracle 客户端和我们的几个 dll 和 exe 并且它工作正常。
So I removed everything extraneous on the box I was working with and bingo.
所以我删除了我正在使用的盒子和宾果游戏上所有无关的东西。
I think it was Interference from the delphi 2007 that was already on that machine...despite trying to path everything right around it.
我认为那台机器上已经存在来自 delphi 2007 的干扰......尽管试图将所有内容都放在它周围。