Tuesday, June 4, 2013

Database Links

How to Create Link Between Two Databases?

Database link is use to enables the access of objects between databases. Databases that are linked can be oracle or different one.

Method 1: Create Database Link via SQL-Developer
 
Method 2: Create Database Link Manually 

Step A: Create an entry in tnsnames.ora file for service naming.

My_DB_Link =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.5.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcldb)
)
)


Step B: Connect to database with DB Admin user privileges.

Conn username/password

Step C: Create database link.

CREATE DATABASE LINK  MY_TEST_DB_LINK
USING 'My_DB_Link';

Step D: Using database links.

SELECT * FROM dept@MY_TEST_DB_LINK;

No comments:

Post a Comment