Home » Oracle » How do I create a SSH tunnel (Port Forwarding) in PuTTY to connect to Oracle database on Cloud

How do I create a SSH tunnel (Port Forwarding) in PuTTY to connect to Oracle database on Cloud

When a oracle database cloud instance is created, network access to the instance is limited to Secure Shell (SSH) connections on port 22. This access restriction ensures that the instance is secure by default.

You can either ask your cloud service administrator to open ports or, as you will learn in this tutorial, you can use SSH client software to create an SSH tunnel to connect securely to the database and its tools. Several SSH clients are freely available, including the SSH utility on Linux platforms and the PuTTY utility on Windows platforms. Here in this article we will concentrate on ssh tunnel with putty and check How to create an SSH tunnel in PuTTY to connect to Oracle database on Cloud

How do I create a SSH tunnel in PuTTY to connect to Oracle cloud database


We will see How do I create a SSH tunnel in PuTTY in details with clear steps. I am explaining with respect to Oracle database but it can be used in other stuff also

  1. First login to Oracle cloud service

you can go to http://cloud.oracle.com, click Sign In, and select the Public Cloud Services value for your region from the My Services – Select Data Center dropdown list. Either way you must provide an identity domain, user name, and password to sign in.

  1. Identify your service and click on it
  2. Make a note of the public IP address for the server
  3. Create SSH tunnel

Find putty.exe in the PuTTY folder on your computer, for example, C:\Program Files (x86)\PuTTY. Double-click putty.exe. to open it.

See also  How to check RMAN backup status in sql

The PuTTY Configuration window is displayed, showing the Session panel.

In the Host Name (or IP address) box, enter the IP address of the VM. Leave the port number at the default 22 and Make sure connection type is SSH

In the Category tree, expand Connection if necessary and then click Data.

The Data panel is displayed.

In autologin, put OPC as the username

In the Category tree, click SSH.

The Options controlling SSH connections panel is displayed.

Under Protocol options, check Don’t start a shell command at all.

This optional step ensures that only the SSH tunnel is enabled. You will not be able to use the SSH session to run commands in the command shell (although you will be able to enter the passphrase for your SSH key, as prescribed later in this tutorial).

In the Category tree, expand SSH, and then click Auth.

In the Select private key file window, click PuTTY Private Key Files (.ppk) to find and open the private key file that matches the public key used when the instance was created.

In the Category tree, click Tunnels.

The Options controlling SSH port forwarding panel is displayed.

In the Destination box, enter database_server_ip:1521, where database_server_ip is the public IP address for the Database Server that you found and recorded earlier in this tutorial. Also select Local and Auto, if they aren’t already selected.

In the Source Port box, type 1521, to match the the VM’s port number.

Click Add to add the forwarded port. The local and remote ports appear in the Forwarded ports list.

See also  Oracle tkprof utility : How to generate and read

In the Category tree, click Session. to display the Session panel again.

In the saved session ,type test_cloud to identify that setting and then save

Now we can use test_cloud anytime by selecting it and pressing the load button

Click Open to open the connection to the VM. If this is the first time you are connecting to the VM, the PuTTY Security Alert window is displayed, prompting you to confirm the public key.

ssh tunnel putty

Click Yes to continue connecting.

The PuTTY Configuration window closes and the PuTTY command window is displayed. The user name is the value you supplied earlier, in the Auto-login username box in step 5.

When prompted, enter the passphrase for the key, if one was defined.

Now the SSH tunnel is created

Now you can connect to the Oracle database on cloud using localhost:1521 in SQL Developer

Related Articles
Port Forwarding from Putty in windows
Oracle Cloud Infrastructure
Putty Commands:- 41 Useful SSH commands to help you manage the VPS /Dedicated Server
ssh passwordless:- How to Enable ssh passwordless login set up between two servers
Remote Desktop Manager: – Awesome Free Remote Desktop manager
install SSH on Ubuntu: How to install SSH on Ubuntu with Detailed steps and Problem faced

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top