Oracle synonym learning. To create a synonym for a table on a remote database, you must first create a DatabaseLink (database connection) to expand
Oracle synonym learning. To create a synonym for a table on a remote Database, you must first create a Database Link (Database connection) to expand
Synonym: literally, it means an alias, which is similar to an attempt. Is a ing relationship.
(1. Create a synonym statement:
Create public synonym table_name for user. table_name;
The first table_name and the second table_name can be different.
In addition, to create a synonym for a table on a remote Database, you must first create a Database Link (Database connection) to expand the access, and then create a Database synonym using the following statement:
Create synonym table_name for table_name @ DB_Link;
Of course, you may need to authorize the current user (user2) in the user: grant select/delete/update on user2
Working instance:
Create a synonym TBL_USERS for the current user. The ing table is the V_TBL_USERS table under the user lisi on the database lsxy (A dblink.
Create or replace synonym TBL_USERS for lisi. V_TBL_USERS @ lsxy;
(2. Delete Synonyms:
Drop public synonym table_name;
(3. view all synonyms:
Select * from dba_synonyms;
Synonyms have the following benefits:
1. Saves a lot of database space and there is no much difference in operating the same table for different users;
2. the extended scope of use of databases enables seamless interaction between different database users;
3. synonyms can be created on different database servers and connected over the network.
For more information about Oracle, see the Oracle topic page? Tid = 12