如何使用 telnet 检查与 Oracle 的连接?
我一直在尝试让 sqlplus 从我的 OS X 机器连接到 Oracle。 我在此处提出了另一个问题。
有人建议我尝试 telnet。 查阅手册页,我尝试了:
[ ethan@gir ~ ]$ telnet DBHOST:1521
Trying xxx.xxx.xxx.xxx...
telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out
telnet: Unable to connect to remote host
另外...
[ ethan@gir ~ ]$ telnet DBHOST 1521
...结果相同。
我不知道如何解释这些结果。 无论如何,这似乎都是您所期望的。 您不会这样做...
$ ssh some_mysql_host:3306
telnet 到 Oracle 有何不同?
或者也许我没明白他们的意思。
如果有人能帮助我了解如何使用 telnet 测试与 Oracle 的连接,我将不胜感激。
I've been trying to get sqlplus to connect to Oracle from my OS X machine. I asked another question about it here.
One person suggested that I try telnet. Consulting the man page, I tried:
[ ethan@gir ~ ]$ telnet DBHOST:1521
Trying xxx.xxx.xxx.xxx...
telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out
telnet: Unable to connect to remote host
Also...
[ ethan@gir ~ ]$ telnet DBHOST 1521
...with same result.
I'm not sure how to interpret these results. Seems like what you'd expect in any case. You wouldn't do this...
$ ssh some_mysql_host:3306
How is telnet to Oracle different?
Or maybe I didn't understand what they meant.
If anyone could help me understand how one uses telnet to test a connection to Oracle I would be grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
他们提议使用
telnet
只是因为它是最简单的 TCP/IP 客户端之一,而且几乎到处都安装了它。 这是从命令行检查您是否确实能够与任何特定服务建立 TCP/IP 连接的简单方法。此外,在许多基于 ASCII 的 IP 协议上,可以直接与服务器进行实际交互,通过输入命令并查看响应来检查其工作情况 - 我自己已经使用 SMTP 服务器多次这样做过。
在您的情况下,当您超时时,要么整个主机已关闭,要么对该特定主机或服务的访问被防火墙阻止。 如果您可以通过
ping
到达服务器,那么后者的可能性更大。还有一种外部可能性是,您的名称解析实际上将您带到了错误的主机,但您应该能够通过查看
telnet
表示它试图连接的 IP 地址来确认这一点。另一个常见的响应是“连接被拒绝”。 这意味着主机已启动,但指定端口上没有运行任何服务。
They're proposing use of
telnet
simply because it's one of the simplest TCP/IP clients and because it's installed almost everywhere. It's just an easy way to check from the command line whether you're actually able to make a TCP/IP connection to any particular service.Also, on many of the ASCII based IP protocols it's straight forward to actually interact with the server to check its working by typing in commands and looking at the responses - I've done this numerous times myself with SMTP servers.
In your case, as you're getting a timeout, either the whole host is down, or the access to that particular host or service is being blocked by a firewall. If you can reach the server with a
ping
then the latter is more likely.There's also an outside chance that your name resolution is actually taking you to the wrong host, but you should be able to confirm that by looking at the IP address that
telnet
said it was trying to connect to.Another common response is "connection refused". That means that the host is up, but that there's no service running on the specified port.
基本上,当您指定端口号(例如
Telnet myserver 1521
)时,它会尝试连接到该端口上的计算机。 如果您看到返回任何数据,甚至看到空白控制台,则表明它已连接。 如果您收到无法连接消息,则表明计算机未侦听该端口或防火墙阻止了连接。
Basically when you specify a port number e.g
Telnet myserver 1521
It will try to connect to the machine on that port. If you see any data returned or even a blank console then it has connected. If you receive an unable to connect message then the machine is not listening on that port or a firewall is blocking the connection.
您尝试 telnet 到 dbhost 1521 时出现“无法连接”并超时,这表明您的“dbhost”主机名解析给出了错误的答案,或者该主机已脱机、关闭,或者您存在网络问题。
如果 Oracle 正常工作,您就会获得连接。 您实际上无法用它做任何事情,但它会确认 Oracle 已启动并正在监听。
Your attempt to telnet to dbhost 1521 getting 'unable to connect' with a timeout suggests that either your hostname resolution for 'dbhost' is giving you the wrong answer, or that host is offline, down or you have network problems.
If oracle was working, you'd get a connection. You wouldn't really be able to do anything with it, but it would confirm that oracle was up and listening.
Oracle 实例未从其他系统连接,而它是从
localhost
连接的,我认为端口未打开,并且从其他系统到telnet 1521
端口显示问题。Oracle instance is not connected from other systems, while it is connected from
localhost
, I think port is not opened and it is showing problem totelnet 1521
port from other system.为什么不以“正确”的方式去做呢? 如果数据库及其侦听器工作正常,则远程登录到某个任意网络端口不会给您提供正确的信息。
只需安装oracle instantclient 软件并使用配置即可向导。
Why not do it the 'right' way? Telnetting to some arbitrary network port will not give you correct information, if the database and it's listener is working correctly.
Just install the oracle instantclient software and use the configuration wizard.