Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I chain database links in Oracle?

I have 3 databases. 1 links to 2, 2 links to 3. I'd like to query tables in 3, from 1. I tried third_db_tab@3@2 and it did not work. Wondering if this is possible and if so, what the syntax is.

like image 758
aw crud Avatar asked Jun 07 '10 13:06

aw crud


People also ask

How can I connect two databases in Oracle?

Oracle CREATE DATABASE LINK statement In this syntax: First, specify the name of the database link after the CREATE DATABASE LINK keywords. Second, provide user and password of the remote database after the CONNECT TO and IDENTIFIED BY keywords. Finally, specify the service name of the remote database.

How do I create a database link between two Oracle instances?

To create a private database link, you must have the CREATE DATABASE LINK system privilege. To create a public database link, you must have the CREATE PUBLIC DATABASE LINK system privilege. Also, you must have the CREATE SESSION system privilege on the remote Oracle database.

How does Dblink work in Oracle?

A database link is a pointer that defines a one-way communication path from an Oracle Database server to another database server. The link pointer is actually defined as an entry in a data dictionary table. To access the link, you must be connected to the local database that contains the data dictionary entry.

What is shared database link in Oracle?

Every application that references a remote server using a standard database link establishes a connection between the local database and the remote database. Many users running applications simultaneously can cause a high number of connections between the local and remote databases.


1 Answers

I think you can do this by creating synonyms. In database 2 create a synonym:

CREATE SYNONYM third_db_tab for third_db_tab@3;

then in database 1 create a second synonym:

CREATE SYNONYM third_db_tab for third_db_tab@2;

This is untested (I don't have three databases running right now), but I think Oracle is smart enough to untangle the synonyms.

like image 116
Thomas Jones-Low Avatar answered Oct 16 '22 05:10

Thomas Jones-Low