-1

i'm a beginner to Docker, hope everyone can help, much appreciated.

I downloaded a docker image from my company repository and i managed to create a container in my local machine from the image, let's named it mydb. It is created through command below: docker run --name mydb -p 1521:1521 -d mycompany.com:5000/docker-db:20.0.04

I am able to access the database with following connection string through my sqldqveloper : system/abc123@127.0.0.1:1521/ORCL

Our company have a database server in AWS, let's name it awsdb. I can access it after vpn login. I am able to access the database with following connection string in sqldqveloper : system/abc123@awsdb.amazonaws.com:1521/awsdb

Question: How can i create a database link in mydb to awsdb with database link "my_dblink"? eg. select sysdate from dual@my_dblink.

I try with following command:

CREATE PUBLIC DATABASE LINK my_dblink
CONNECT TO system
IDENTIFIED BY abc123
USING 'awsdb.amazonaws.com:1521/awsdb';

but it return error ORA-12543: TNS:destination host unreachable.

I tried remove the container and recreated it by set the net=host: docker run --name mydb -p 1521:1521 -d --net=host mycompany.com:5000/docker-db:20.0.04 then now i can't even connect is with system/abc123@127.0.0.1:1521/ORCL error ORA-12541 returned: no listener.

How can i open the connection between internal docker to AWS database server? Thank you.

akira
  • 51
  • 6

1 Answers1

0

First of all, I do believe you need to understand what you are trying to accomplish. When you create a database link between two databases, the main requirement you must fulfil is to have network connectivity between both of them in the ports you are using. As one of them is stored in public cloud, at least you would need:

  • A network connection between the network where the docker is installed and the public cloud in AWS.
  • But, as your docker is installed in your local laptop, the AWS should be opened to Internet, something that it is a security issue and probably it is not enabled.
  • Moreover, you would need Firewall rules in all the ports you might need to use in this connectivity.

As you are using a VPN login that allows you to access the AWS Cloud resources because you are connecting through it ( probably using Active Directory and/or a certificate, perhaps even using SSO federation between your AD in your company and the resources in AWS ), the database can't connect using that.

Summarizing, that is not possible, and if I were someone in Security I would never allow it. The only option for you would be to create a docker with the database in AWS and then create the database link there.

Roberto Hernandez
  • 8,231
  • 3
  • 14
  • 43