Search This Blog

Tuesday, October 10, 2006

SSH Tunneling for DB Connections

This is actually very simple ,

I want to connect to my db "infra2" running on machine asdtbde.idc.oracle.com
with the listner port as say 1521.

To use the connect string as my local machine and port 1621 I need to set the following ,

for example ,

SECURED_SERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1621))
)
(CONNECT_DATA =
(SID = infra2)
)
)

From my local machine run the following from the root user ,

ssh -NfL 1621:localhost:1521 asdtbde.idc.oracle.com
--
output :
ssh -NfL 1621:localhost:1521 asdtbde.idc.oracle.com
The authenticity of host 'asdtbde.idc.oracle.com (152.69.168.61)' can't be established.
RSA key fingerprint is 7b:ee:40:82:f9:7e:1e:24:e9:00:cf:e9:e8:b5:c4:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'asdtbde.idc.oracle.com' (RSA) to the list of known hosts.
root@asdtbde.idc.oracle.com's password:
---

Now from the local machine connect using

sqlplus scott/tiger@SECURED_SERVER

No comments: