Database Link (DB Link) is schema object in one database. This object can access other database object using DB Link. To access object from one database to other database without having users we need to create DB link. In this case DB Link Creation in Oracle Database needed.
Why DB Link is required
After creation of DB Link we can use it to access tables and views of other database. We need not to have a user in target Database to access the objects. This is why DB link is important.
Pre-Requisite before Creation of DB Link
Few important input we need to have before the DB Link Creation.
1. TNS Details
2. Username & Password of user who will access the objects
3. Instance Name
Command to Create DB Link
DB Link Creation in Oracle Database can be done using following command.
SQL > CREATE DATABASE LINK PROD_TO_DEV
CONNECT TO <User_Name> IDENTIFIED BY <pwd>
USING ‘(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = <host>)(PORT = 1521))(CONNECT_DATA = (SERVER= DEDICATED) (SERVICE_NAME = <Service_name>)) )’;
Database link created.
Query to check DB Link Status
SQL> select sysdate from dual@PROD_TO_DEV;
Now DB Link is created and you can access the objects from PROD DB to DEV DB.
In this post we have seen DB Link Creation in Oracle Database. We have also seen the command to create DB link. Once DB link created we can also verify whether the DB link is created successfully or not.
Hope this Post is helpful to understand about Oracle Database Link.
Suggest Cloud Services
Cloud Technology Course- AWS & OCI
Oracle Application DBA and Core DBA Course
Crash Courses for AWS, OCI, DBA Performance
Mock Interview Tips
Blogs ,Free Article & Documents
Web Development & Designing
Oracle DBA Skills have become important and critical. Up skill your knowledge with our Online Sessions on Oracle Application DBA & Oracle Performance