-2

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

  • 1
    It's too broad question. Can you describe what you are actually want to achieve as how to create database link really easy to find out from Oracle docs – oreh May 10 '18 at 14:45
  • It's not much complexity to find out on google, but still, I have posted an answer below you can check out. :) –  May 10 '18 at 15:23

1 Answers1

1

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';
  • can i get to know how to create a view for these tables as i am a student and have no idea about sql –  May 10 '18 at 17:31
  • Create or replace view view_name as select * from table_name@db_link_name; That’s all –  May 10 '18 at 17:33