Prerequisites:
Install putty, it can be downloaded here: www.putty.org/
Database = testdb and Oracle Names/Tnsnames.ora has this alias.
Host = testdb.dev.net
Port = 1545
You have Putty installed.
Assumptions:
Tunneling your SQL*Net traffic over an SSH link is the smart option in case you are not encrypting your passwords and they are sent as clear text.
Setup:
Tnsnames.ora
Note the host and port.
testdb_ssh =
(DESCRIPTION =
(SOURCE_ROUTE = OFF)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 5555))
)
(CONNECT_DATA =
(SID = testdb)
(SRVR = DEDICATED)
)
)
Ensure sqlnet.ora will actually look in tnsnames.ora:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Place Putty is on your %PATH% and run the following:
Command Line
ssh -N -L 5555:testdb.dev.net:1545 username@server_name_to_which_db_is_installed
Traffic on localhost:5555 is forwarded via SSH to port 1545 on server testdb.dev.net. This is where you have a listener already running.
Type the ssh password when prompted. Setup your ssh key to avoid being prompted – good practice is to generate a key with a pass-phrase.
Connect to a username@testdb_ssh to use the SSH tunnelling.
Putty Setup
Start Putty as normal.
On the Connection page, enter username@server_name_to_which_db_is_installed.
On the SSH→Tunnels page:
Uncheck
- “Local ports accept connections from other hosts”
- “Remote ports do the same (SSH-2 only)”.
Enter for the Source Port 5555 – the port in your tnsnames.ora file.
Enter testdb.dev.net:1545 as the Destination.
Make sure that Local is selected.
Leave Auto selected for IP version.
Click the Add button.
On the Connection tab, fill in a name for the saved session, ssh_testdb for example.
Click the Save button.
Now, and in future, simply select this saved session and click the Open button to create your tunnel.