Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle synonym

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Introduction of synonyms

There are many synonyms in the application scenario of object simplification and data linking. With synonyms, non-autonomous objects can simplify writing without the schema of objects.

Create synonym table_name for table_name@DB_Link, here you can achieve a certain operation by establishing synonyms under the premise of firewall problems and under the three libraries of ABC. (a cannot access C, A can access B, B can access C)

The function of synonyms is similar to that of views, which is a kind of mapping relationship, which does not take up the actual storage space, only the definition of synonyms is saved in the data dictionary.

Database administrators can define synonyms for most database objects in Oracle database, such as tables, views, materialized views, sequences, functions, stored procedures, packages, synonyms, and so on.

2 synonym classification

There are two types of Oracle synonyms, which are Oracle public synonyms and Oracle private synonyms. Synonyms created by ordinary users are generally private synonyms, while public synonyms are generally created by DBA. Ordinary users need the system permission of CREATE PUBLIC SYNONYM if they want to create synonyms.

1) Oracle common synonym: owned by a special user group, Public. As the name implies, all users in the database can use common synonyms. Common synonyms are often used to indicate some of the more common database objects that everyone needs to refer to.

2) Oracle private synonym: it corresponds to a public synonym, which is owned by the user who created it. Of course, the creator of this synonym can control whether other users have the right to use their own private synonyms through authorization.

-Public synonyms have nothing to do with the user's schema, but the public meaning is that not all users can access it and must be authorized to do so.

CREATE SYNONYM 、 CREATE ANY SYNONYM 、 CREATE PUBLIC SYNONYM

CREATE [OR REPLACE] [PUBLIC] SYNONYM [schema.] Synonym name FOR [schema.] Object [@ dblink]

When there are objects of the same name and public synonyms, the database gives priority to the object as the target, and when there are private synonyms and public synonyms of the same name, the database gives priority to private synonyms as the target.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report