tags:

views:

2661

answers:

4

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.

+2  A: 

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.

nsayer
+2  A: 

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.

+2  A: 

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.

Alnitak
The issue is that Oracle SQL*Net, used by SQL*Plus and other oracle network connection tools, isn't an ASCII protocol, it's an Oracle specific binary one.
Thomas Jones-Low
indeed yes, although attempting the telnet connection should at least show whether the server is up.
Alnitak
A: 

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.

Oliver Michels
instantclient doesn't come with a configuration wizard.
Mark Harrison