1

On oracle server i can connect clear

sqlplus  user/pass@hostremote/SID

If i make a tunnel

ssh -L 1521:localhost:1521 -F -n hostremote -vvv

give me

debug1: Connection to port 1521 forwarding to localhost port 1521 requested.
debug2: fd 7 setting TCP_NODELAY
debug2: fd 7 setting O_NONBLOCK
debug3: fd 7 is O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
channel 2: open failed: connect failed: Connection refused
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 1521 for localhost port 1521, connect from 127.0.0.1 port 60882 to 127.0.0.1 port 1521, nchannels 3
debug3: channel 2: status: The following connections are open:

ERROR:
ORA-12537: TNS: connection close

Why?

Usually i do ssh tunnel on directly connected server,for example

ORACLESERVER=192.168.0.15
CLIENT=192.168.0.4

On client i make the tunnel and connect with sqlplus on localhost,easy.

The situation now is a little different and more complex

PSHYSICAL SERVER=192.168.0.44
VIRTUALMACHINE WITH NAT=192.168.0.45 eth0 10.3.1.1 eth1
ORACLESERVER=virtual machine 10.3.1.4

I have make a DNAT on VIRTUALMACHINE,i can use telnet 1521 VIRTUALMACHINE and tcptraceroute 1521 return succesfully connection. But after tunnel(succesfully) i have TNS error and no connection.

This is the dnat make with firewalld

 forward-ports: port=1521:proto=tcp:toport=1521:toaddr=10.3.1.4
    port=1521:proto=udp:toport=1521:toaddr=10.3.1.4
1

The issue is that Oracle opens additional connections, not to port 1521, after the initial connection, so your tunnel won't work this way. Set up Oracle Connection Manager on the server side so you can do all your talking to it and have it do multiple connections inside the server network.

Oracle docs (not public): https://support.oracle.com/rs?type=doc&id=Note:361284.1 Open, uhh, mirror: http://blog.itpub.net/161195/viewspace-1053131/

1
  • Oracle TCP protocol is not wired. In some situations it behaves similarly as FTP. e.i. it might open additional TCP connections on dynamically allocated port.

  • Oracle TCP protocol uses OOB bit in TCP header. This sometimes might cause problems when wrapping TCP into TCP.

Most probably you have problems with the 1st one point. Use strace/tcpdump to find out whether sqlplus is trying to open 2nd connection.

  • I forgot to add something about network situation, i add now,usually i do ssh tunnel sucessfully on simple net connection(direct) – elbarna Nov 16 '15 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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