Forum Stats

  • 3,837,503 Users
  • 2,262,265 Discussions
  • 7,900,307 Comments

Discussions

SQL*Net connection to remote Oracle DB, through SSH, fails with ORA-12545

969533
969533 Member Posts: 2
edited Oct 19, 2012 12:21PM in General Database Discussions
Hi all,

I have the following issue: I am unable to log in to an Oracle database using SSH tunnel. I have the following network setup:

laptop (network1) server1 (network2) oracledb (network2)

server1 is reachable via SSH from outside world ,while oracledb is not reachable outside of network2.

The listener is running on default port 1521 on oracledb server.

server1 has direct visibility with oracledb.

First, I've tried to connect using only a LOCAL tunneling like this:

laptop> ssh -L 10000:oracledb:1521 [email protected]

But then, when I issue a connection attempt (using SQL*Plus, SQL Developer and/or Toad) towards laptop:10000, I get the following error:

C:>sqlplus [email protected] as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 19 14:51:03 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter password: ERROR: ORA-12545: Connect failed because target host or object does not exist

and the following log in listener.log on oracledb:

19-OCT-2012 06:31:33 * (CONNECT_DATA=(SID=PROD01)(CID=(PROGRAM=C:\app\rr2\product\11.2.0\client_2\bin\sqlplus.exe)(HOST=RR2-23247)(USER=rr2))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.104)(PORT=48025)) * establish * PROD01 * 0

I've also tried to connect using a LOCAL and REMOTE tunnels like this way:

laptop> ssh -L 10000:localhost:9999 [email protected] server1> ssh -R 9999:oracledb:1521 [email protected]

and then when I issue a connection on laptop:10000 again I am hitting the above errors.

I suppose that the issue is because when connected to the listener, it then spawns a server process on another port, and your connection should bind to the server port on the server process, which is different every time with a range between 20000 - 50000 TCP.

I am stuck on this and I don't know how to make it work.

Please advise!!

Thanks a lot in advance.

Edited by: 966530 on 2012-10-19 5:54
Tagged:

Answers

  • Sunny kichloo
    Sunny kichloo Member Posts: 2,459 Gold Trophy
    Look into this doc of Ed Stevens

    http://edstevensdba.wordpress.com/2011/03/05/ora-12545/
  • Niket Kumar
    Niket Kumar Member Posts: 721 Bronze Badge
    check this command

    tnsping HOME11G

    check status for remote database whether that is reachable or not.
  • 969533
    969533 Member Posts: 2
    Hi,

    Thanks for that link. It seems that when you define your TNS entry, you should choose a hostname, and define it into the hosts file on Windows. Otherwise you will not be allowed to connect through the tunnel.

    Issue solved.
  • EdStevens
    EdStevens Member Posts: 28,778 Gold Crown
    966530 wrote:
    Hi,

    Thanks for that link. It seems that when you define your TNS entry, you should choose a hostname, and define it into the hosts file on Windows. Otherwise you will not be allowed to connect through the tunnel.

    Issue solved.
    I don't think the tunneling has anything to do with it. That is, your phrase "you will not be allowed to connect through the tunnel" was true before you added the qualifier "through the tunnel".

    sqlnet uses the tnsnames.ora file to resolve an alias to a specific host destination, port, and service name. Just like the OS uses the local 'hosts' file to resolve a host name to an ip address. After tns parses out the tnsnames.ora entry, it simple creates a standard ip request to the OS. Of course, if tnsames specified HOST=myserver, then the OS will have to use either DNS or the local hosts file to resolve 'myserver' to an ip address.

    SQLNET sits at the application layer of the OSI network stack. All sqlnet requests go through the standard OSI network stack.
  • Mark Malakanov (user11181920)
    Mark Malakanov (user11181920) Member Posts: 1,389 Silver Badge
    edited Oct 19, 2012 12:16PM
    >
    laptop> ssh -L 10000:oracledb:1521 [email protected]

    But then, when I issue a connection attempt (using SQL*Plus, SQL Developer and/or Toad) towards laptop:10000, I get the following error:

    C:>sqlplus [email protected] as sysdba
    >

    show us HOME11G in tnsnames.ora.
    what is OS where Oracle runs?

    For SQL Developer what driver do you use, thin or OCI?
    The Thin one does not have this type of issue (another port).

    Edited by: user11181920 on Oct 19, 2012 12:15 PM
    Also I tested it with SQL*Plus, it works well via SSH.
    Oracle runs on Linux.
  • Mark Malakanov (user11181920)
    Mark Malakanov (user11181920) Member Posts: 1,389 Silver Badge
    It seems that when you define your TNS entry, you should choose a hostname, and define it into the hosts file on Windows. Otherwise you will not be allowed to connect through the tunnel.
    No. You do not need to choose a hostname.
    It works perfectly with localhost.
    SSH =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 11521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = ORCL)
        )
      )
This discussion has been closed.