The link between the database is built on the Database Link. To create a DB Link, you must first set a link string on each database server.
1. Link string is the service name, first configure a service name locally, address the remote database address, the service name is the database chain name you want to use in the future:
2. Create a database link, enter the system administrator SQL> operator, run the command:
SQL> CREATE PUBLIC DATABASE LINK GCGL Connect To LGGCGCGLTEST IDENTIFIED BY LGGCGCGLTEST Using 'LGGCGL'
Then create a link to Scott User and Beijing Database, beijing, we query Beijing's Scott data:
SQL> SELECT * from Employee @ gcgl;
This allows the data of Shenzhen and Beijing Scott users to handle it.
3. Establish synonyms, in order to make the relevant distributed operation more transparent, the Oracle database has synonyms Synonym
SQL> CREATE SYNONYM EMPLOYETEST for Employee @ gcgl;
Then you can use BJSCotTemp to replace the distributed link with @ symbols EMP @ Beijing.
4. View all database links, enter the system administrator SQL> operator, run the command:
SQL> SELECT OWNER, OBJECT_NAME FROM DBA_OBJECTS Where Object_Type = 'Database Link';