9

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.

5 Answers 5

11

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.

2
  • 3
    The issue is that Oracle SQLNet, used by SQLPlus and other oracle network connection tools, isn't an ASCII protocol, it's an Oracle specific binary one. Apr 18, 2009 at 15:29
  • 1
    indeed yes, although attempting the telnet connection should at least show whether the server is up.
    – Alnitak
    Apr 18, 2009 at 15:37
8

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.

3

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.

1

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 to telnet 1521 port from other system.

-6

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.

2
  • 1
    instantclient doesn't come with a configuration wizard. Apr 21, 2009 at 3:58
  • 9
    Using the telnet application in this way is a legitimate troubleshooting technique to determine if there is a network-level issue (such as a port being blocked) as opposed to an application layer issue (such as a misconfigured tnsnames). For certain protocols, such as HTTP or SMTP, one can even test application-layer actions with telnet since they are well-defined text protocols.
    – JasonCG
    Dec 12, 2014 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.