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/[email protected]: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/[email protected]: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/[email protected]:1521/ORCL error ORA-12541 returned: no listener.
How can i open the connection between internal docker to AWS database server? Thank you.
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:
AWS.AWSshould be opened to Internet, something that it is a security issue and probably it is not enabled.As you are using a
VPNlogin that allows you to access theAWS Cloudresources because you are connecting through it ( probably usingActive Directoryand/or acertificate, perhaps even usingSSO federationbetween yourADin your company and the resources inAWS), 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
dockerwith the database inAWSand then create the database link there.