sqldatabaseoracle-databasesqlplusdatabase-link

Create database link between three instances oracle


How to create database link between three instances? For eg i have database named orcl,orcl1,orcl2 how to link them? Thanks


Solution

  • These are the below SQL that might be helpful to you :)

    At database ORCL:

    CREATE DATABASE LINK db_link_orcl1
    CONNECT TO orcl1_user_name IDENTIFIED BY orcl1_user_password 
    USING 'localhost:1521/orcl1';
    
    CREATE DATABASE LINK db_link_orcl2
    CONNECT TO orcl2_user_name IDENTIFIED BY orcl2_user_password 
    USING 'localhost:1521/orcl2';
    

    At database ORCL1:

    CREATE DATABASE LINK db_link_orcl
    CONNECT TO orcl_user_name IDENTIFIED BY orcl_user_password 
    USING 'localhost:1521/orcl';
    
    CREATE DATABASE LINK db_link_orc2
    CONNECT TO orcl2_user_name IDENTIFIED BY orcl2_user_password 
    USING 'localhost:1521/orcl2';
    

    At database ORCL2:

    CREATE DATABASE LINK db_link_orcl
    CONNECT TO orcl_user_name IDENTIFIED BY orcl_user_password 
    USING 'localhost:1521/orcl';
    
    CREATE DATABASE LINK db_link_orcl1
    CONNECT TO orcl1_user_name IDENTIFIED BY orcl1_user_password 
    USING 'localhost:1521/orcl1';