Database Link ( DBlink )

Database Links

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 Syntax:

CREATE PUBLIC DATABASE LINK dblink_salesdb USING ‘sales1’;

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.

tnsping sales1

 

Access data through DB Link:

select * from .@

Example:
select * from hr.emp@sales1;

 

Check the dblink:

select * from DBA_DB_LINKS;

SELECT db_link, username, password, host, created FROM dba_db_links;

 

Drop the db link:

drop database link ;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s