The database link of a distributed database is one-way
Defining Database Links
CREATE DATABASE LINK [Db_link_name] CONNECT to
[USER_NAME] identified by [password] USING ' [tns_name] ';
[Db_link_name]: is the service name of the database to which you want to connect, that is, the real name of the database (usually the SID).
[Usre_name]: is the name of the user you want to connect to.
[PASSWORD]: Is the password of the user you want to connect to.
[Tns_name]: is the service name of the database to which you want to connect.
1. First configure local name with local Net Manager
1. Open Net Manager
2. Expand Local and select service naming. Click the Plus + on the left side of the page:
3. The Network Service Name wizard appears. Enter a network service name, for example: REMOTEORCL. Click Next
4. Select the protocol to connect to the database. You can accept the default TCP/IP (network protocol) and click Next:
5. Enter the IP address of the remote database computer and click Next
6. Enter the SID of the remote database and click Next
7. The last page of the wizard enables you to test the connection with the information you enter
8. In the left tree menu, the service name we just configured will appear
9. Save the network configuration
10. To view the file C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora, have added the following:
2. Create a data link
Create DATABASE link L2 Connect to Scott identified by Tiger using ' REMOTEORCL '
3. Enquiry
Select Ename,dname
From dept, [email protected]
where Emp.deptno=dept.deptno;
L2 is the database link that you created earlier. 4, create aliases in order to query the distributed server convenient, you can create an alias created synonym emp1 for [email protected];
Select Dname,ename,sal
From EMP1, Dept
where Emp1.deptno=dept.deptno;
Oracle Distributed Database