Oracle synonym learning

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.