Connect to a Database with a Public IP by Using SSH Tunneling

You can access the services of DB system databases with public IP addresses by using SSH tunneling.

The main advantage of this method is that port 1521 does not need to be opened to the public internet. However, just like accessing the database with a public IP using a SQL*Net client, load balancing and failover for multi-node DB systems cannot work because they rely on SCANs and hostnames.

Oracle SQL Developer and Oracle SQLcL and are two tools that facilitate the use of tunneling for Oracle Database access.

To open a tunnel, and then connect to a database service by using SQLcL, you run the following commands:

sshtunnel opc@<public_IP> -i <private_key> -L <local_port>:<private_IP>:1521

connect system/<password>@localhost:<local_port>/<service_name>.<DB_domain>

For more information about these tools, see Oracle SQL Developer and Oracle SQLcL.