Database Link: The main purpose is to access the remote database. You can directly access the remote database through the database link.
Synonym: To make distributed operations more transparent, the Oracle database has a synonym object synonym. As its name implies, it is a synonym for an object and can be used instead of an object.
The database link creation syntax is generally:
Create database link [db_link_name] connect to [user_name] identified by [Password] Using '[tns_name]';
Where:
[Db_link_name]: Service name of the database to be connected, that is, the real name of the database (usually Sid ).
[Usre_name]: name of the user to be connected.
[Password]: the password of the user to be connected.
[Tns_name]: the service name of the database to be connected, that is, the net8 service name created on the local machine.
Usage:
Select * from [table_name] @ [db_link_name]; insert, update, and delete are the same.
Example:
Database Link
Create public database link Beijing connect to Scott identified by tiger using 'tobeijing ';
Then, a link Beijing with Scott user and Beijing database is created. We can query Scott data in Beijing:
Select * from EMP @ Beijing;
In this way, the data of Scott users in Shenzhen and Beijing can be processed as a whole.
Synonym
Create synonym bjscottemp for EMP @ Beijing;
Therefore, you can use bjscottemp to replace the Distributed Link operation with the @ symbol EMP @ Beijing.