oracle database link and synonyms

1.1  database creation synonyms (synonym)

Oracle synonyms (synonyms) is an alias literally meaning, and function similar view, is a mapping relationship. It can save a lot of database space, the operation of different users is not much difference with a table; it extends the use of the database, enables seamless interaction between different database users; Oracle database management functionality provides synonyms . A synonym is an alias database objects, object access frequently used to simplify and improve the security of access to the object. When using synonyms, Oracle Database will be translated into the name of the corresponding program object. Similar views, synonyms does not take actual storage space, saving only a synonym definition in the data dictionary. Most Oracle database objects in the database, such as tables, views, materialized views, sequences, functions, procedures, packages, synonyms, etc., the database administrator can define the actual situation for their synonyms. Create synonyms, access tables under a different user, do not add a user name. (Meaning to take a public alias)

1.2 create synonyms in the same database

 (1) query the data dictionary synonyms

 (2) query creation, you have the right to delete synonyms

 (3) Creating a synonym

    A user needs to access the user B in Table teacher

    Then create synonyms in user B: create synonym teacher for A.teacher;

    B user queries teacher: select * from teacher; this time can access the table

 

1.3 create synonyms in different databases

      If: 192.168.200.00 192.168.200.11 need access to objects under the database, and the two are not in a library server,

You can access the object by creating a database link and synonyms combined method

 (1) query database link owned by permission

 (2) Create a database link

      Create a database link on 192.168.200.00

create database link db_clp_itf
connect to clp_itf identified by itf072
using'
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.200.00)(PORT = 1521))
)
(CONNECT_DATA =
(sid = orcl)
)
) ';

 db_clp_itf: is the name of the database link

 clp_itf: a remote database user name

 itf072: is the password for the remote database

 using: the database server is configured tnsnames

 

 (3) Creating a synonym

      Create a synonym on 192.168.200.00

 create synonym t_synonym_test for t_synonym_test@db_clp_itf; 

Guess you like

Origin www.cnblogs.com/jason3361/p/11119704.html