You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, gvenzl. It’s a pleasure to greet you again.
First of all, I want to express my appreciation for the fantastic work you do. It’s incredibly valuable to our community, and we follow your work with great enthusiasm.
Today I bring you a new requirement, which involves ensuring a dblink to a database when they are created in multiple mode.
How could we generate a dblink to one or more databases when they are created in multiple mode?
The text was updated successfully, but these errors were encountered:
habolanos
changed the title
Schema to apply the initial scripts associated with the /container-entrypoint-initdb.d volume
Multi Database connected by dblink
Nov 4, 2024
Likewise!
Thanks for the kind words, and also, thank you for your continued interest in these images!
I'm afraid I will need more details to provide a good answer.
First of all, when you say multiple databases, do you mean pluggable databases inside the container database within one running Docker container, or do you mean multiple Docker containers running and trying to facilitate DB Link communication across these?
I'm also not aware of the multiple mode, could you elaborate more?
For the former of having multiple PDBs within a CDB, a DB link is fairly easily created. As everything is within the same network, you can easily reference the individual PDBs via their service name, for example:
CREATE DATABASE LINK gerald_remote
CONNECT TO gerald IDENTIFIED BY LetsTest1
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=<PDB_name>))
)';
For the latter, this is where container networking comes in, and depending on the containerization solutions (docker, podman, minikube, etc) it will work differently.
For Podman, you have to first create a network and make sure that all containers are within the same network.
That's done also very easily, just:
Make sure that you properly name your containers with the --name parameter, then the container can be referenced via this name from other containers. It essentially becomes the hostname for the container. So in the example of the first container having the name container1 above, in a second container sharing the same network (the podman run also had the --network <network_name>), you can reference the container1 in the DB link, for example:
CREATE DATABASE LINK gerald_remote
CONNECT TO gerald IDENTIFIED BY LetsTest1
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=container1)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=<PDB_name>))
)';
Hello, gvenzl. It’s a pleasure to greet you again.
First of all, I want to express my appreciation for the fantastic work you do. It’s incredibly valuable to our community, and we follow your work with great enthusiasm.
Today I bring you a new requirement, which involves ensuring a dblink to a database when they are created in multiple mode.
How could we generate a dblink to one or more databases when they are created in multiple mode?
The text was updated successfully, but these errors were encountered: