0

I have public IP, the Oracle cloud DB installed in private IP. through the public IP we can establish ssh tunnel to private IP and forward localhost port to access Oracle cloud DB.

My task is to create DB link from my localhost oracle DB to cloud Oracle DB. So I can access Oracle cloud DB schema from my localhost oracle DB.

I using Putty to establish SSH & localhost port forward and I can access Oracle Cloud DB using SQL developer/Toad. So public/private IP and SSH details are correct.

In this case, how to create DB link?

1 Answer 1

0

You already have forwarded connections coming to localhost port X to the target private IP in AWS (let it be RDS:1521). So your config is localhost:X -> RDS:1521. You also need schema name (myusername) and its password (mypassword).

CREATE DATABASE LINK mylink 
    CONNECT TO myusername IDENTIFIED BY mypassword
    USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=X))
           (CONNECT_DATA=(SERVER=dedicated)
           (SERVICE_NAME=myrdsservicename)))';

Oracle's 12c syntax for creating db links can be found here.

Instead of using RAW connection parameters (as above) you my prefer to create an entry in tnsnames.ora for the connection string above and use the symbolic name for the localhost forwarded connection.

2
  • I have tried below syntax, CREATE DATABASE LINK mylink CONNECT TO myusername IDENTIFIED BY mypassword USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=X)) (CONNECT_DATA=(SERVER=dedicated) (SERVICE_NAME=myrdsservicename)))';
    – Parthiban
    Nov 15, 2017 at 14:56
  • I have tried below syntax, CREATE DATABASE LINK mylink CONNECT TO myusername IDENTIFIED BY mypassword USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=X)) (CONNECT_DATA=(SERVER=dedicated) (SERVICE_NAME=myrdsservicename)))'; I given local forwarded port and service name, but i got error as ORA-12541 “TNS no listener.” I have used same port and service in toad/sql developer, it got connected. But while trying through DB link it throw no listener error.
    – Parthiban
    Nov 15, 2017 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.