How to Create an Oracle DB Link
An Oracle DB link connects your database server to another network database server, so you can query from one location. You create queries on one Oracle server, and you reference the link to the secondary server. The linked server returns the data from the query. This linking feature makes it more convenient for database administrators, because all stored procedures and SQL code is centralized on one server.
Instructions
-
-
1
Open the Oracle Enterprise Manager application from the Windows program menu and log in to your database server.
-
2
Open the PL-SQL editor and create the database linking code. The following code shows you the syntax for the Oracle link:
CREATE PUBLIC DATABASE LINK anotherserver
USING 'Oracle2';In this example, Oracle connects to the server named "anotherserver," and the link's name is set to "Oracle2." Click "Run" to create the link.
-
-
3
Query the remote server. After the link is created, you use the new link name to query the remote database. The following code shows you how to query a remote server linked by Oracle:
select * from customers@Oracle2
where customerid=1The code above queries the "customers" table on the linked Oracle2 database. The customer returned has the ID of 1.
-
1