What is DB Link?
A Database Link (DB Link) is a connecting string between two different physical database servers which allow a client to access them as logical database.
In simple word , If you are logged into one database and want to access only few tables , objects or schema of different database then DB link string will provide you access to that particular objects, table etc.
Following data dictionary views can give you basic information about the db link.
query-
SQL> desc dba_db_links
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER NOT NULL VARCHAR2(30)
DB_LINK NOT NULL VARCHAR2(128)
USERNAME VARCHAR2(30)
HOST VARCHAR2(2000)
CREATED NOT NULL DATE
Pre-requisite information for DB Link:
1. Owner
2. DB_LINK name
3. Username and Password
4. HOST TNS details
How to create db link strings:
I need to create a db link in database name "India" to database name "Development" then we should have all pre-requisite information of database "Development"
CREATE DATABASE LINK IND2DEV CONNECT TO
<User_Name> IDENTIFIED BY <PWD>
USING
'(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST=development.com)(PORT = 1524)) (CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME = DEV)))';
Database link created.
How to check DB link created successfully:
select sysdate from dual@IND2DEV;
SYSDATE
------------------
04-MAY-18
Note: If you get sysdate output then db link created successfully.
A Database Link (DB Link) is a connecting string between two different physical database servers which allow a client to access them as logical database.
In simple word , If you are logged into one database and want to access only few tables , objects or schema of different database then DB link string will provide you access to that particular objects, table etc.
Following data dictionary views can give you basic information about the db link.
query-
SQL> desc dba_db_links
Name Null? Type
----------------------------------------- -------- ----------------------------
OWNER NOT NULL VARCHAR2(30)
DB_LINK NOT NULL VARCHAR2(128)
USERNAME VARCHAR2(30)
HOST VARCHAR2(2000)
CREATED NOT NULL DATE
Pre-requisite information for DB Link:
1. Owner
2. DB_LINK name
3. Username and Password
4. HOST TNS details
How to create db link strings:
I need to create a db link in database name "India" to database name "Development" then we should have all pre-requisite information of database "Development"
CREATE DATABASE LINK IND2DEV CONNECT TO
<User_Name> IDENTIFIED BY <PWD>
USING
'(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST=development.com)(PORT = 1524)) (CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME = DEV)))';
Database link created.
How to check DB link created successfully:
select sysdate from dual@IND2DEV;
SYSDATE
------------------
04-MAY-18
Note: If you get sysdate output then db link created successfully.
No comments:
Post a Comment