Tuesday, 6 August 2013

What is DB LINK and How To create the DB Link in the Oracle



A DATABASE  LINK is a schema object in one database which helps to access the object on another database. The other database may be other than the Oracle Database.  In another definition it can also be said that , it is a media to communicate with the databases not in in the same database really(It may be also different too). The only condition here is to access the non-Oracle Database System you need to have the Oracle Heterogeneous Services.

It's like on logical database. You can do all kind of database activities  (DDL,DML,TCL.TQL) on the database.

Once you have created a database link, you can use it to refer to tables and views on the other database. In SQL statements, you can refer to a table or view on the other database by appending @dblink to the table or view name. You can query a table or view on the other database with the SELECT statement. You can also access remote tables and views using any INSERT, UPDATE, DELETE, or LOCK TABLE statement.
Also creates a connection between a local database and a remote database. You might want to create a database link, for instance, if you want the data in a remote database updated when the local database is updated.

Division of the Database Link:

Private Database Link: It can be used by the owner of the database link and can be limited to some specific databases only.

Public Database Link: All user in the database can use it.

Global Database Link: Defined in an OID and Any other in network can use it.


 Basic requirment need be there before you are going to create a DB Link.

1. You need to have the previleges to create the DB Link. Usually DBA's are have this previleges. Same for Public Database Link we need to have the previleges otherwise you cann't .

Action1:
Creation of the DBLINK:


                      
Where other_db is the other database to which you might want to connect from the oracle database.
scott/tiger - The schema and password respectively.

You can check also whether the datalink has created or not by writting the below command :




 Action2:  Dropping a DB Link

DROP DATABASE LINK link_name;

Action3: Viewing inforamtion about database link

DBA_DB_LINKS: It will list all the database link in the database.
ALL_DB_LINKS: It will list out all those accesible datalink to the connected users.
UAER_DB_LINK: Database links owned by the connected users.

Action4: Close the DB Link


  


Refer For more knoweledge

Important link:     http://searchoracle.techtarget.com/tip/How-to-create-a-database-link-in-Oracle



No comments:

Post a Comment