A Database Links is used to connect the one Oracle Database Server to other Database Server. It’s save in data dictionary. Through database link you can access the data of remote database.
Database links created with public or private way:
Public: all database users have access to remote database.
Private: only user created have access to remote database.
CREATE PUBLIC DATABASE LINK dblink_salesdb CONNECT TO username IDENTIFIED BY password USING ‘sales1’;
You need to check the connectivity of sales1 through tnsping that its working file before creating the database link.
Access data through DB Link:
select * from hr.emp@sales1;
Check the dblink:
SELECT db_link, username, password, host, created FROM dba_db_links;
Drop the db link: