Search code examples
sqloracledblink

How to reach database via another database that has link to that database


Databases

Hi, let's use this picture as an example. I want to reach ABASE while on CBASE. I can reach it while on BBASE using

SELECT * FROM TABLE@ABASE_LINK

I can reach BBASE while on CBASE using

SELECT * FROM BBASE.table.

But how do i reach ABASE while on CBASE.

If I try

SELECT * FROM BBASE.TABLE@ABASE_LINK

I get the following error

ORA-02019: connection description for remote database not found 02019. 00000 - "connection description for remote database not found" *Cause: The referenced database link did not exist. *Action: Create the database link before running the SQL statement. Error at Line: 1 Column: 21


Solution

    • If you use CREATE DATABASE LINK ... then you are creating a private database link only for that user; so CBASE would not be able to see a private database link belonging to BBASE.
    • If you use CREATE PUBLIC DATABASE LINK ... then you are creating a public database link that all users can use.

    You probably have a private database link so it will not be available to another user. Recreate the database link so that it is public and then you can use:

    SELECT * FROM TABLE@ABASE_LINK