Get the App
SLTechnology News&Howtos  ›  Database  › 

A brief introduction to the creation and function of synonyms in Dameng Database

Shulou Source: shulou.com Published: 2022-06-01 06:16:05 10月27日 Update

1. The concept of synonyms

The function of synonym management is provided in Dameng database. A synonym is an alias for database schema objects, which is often used to simplify object access and improve object access security. When a synonym is used, the Dameng database translates it into the name of the corresponding scheme object. Similar to the view, synonyms do not take up actual storage space, only the definition of synonyms is saved in the data dictionary. Database administrators can define synonyms for most of the database objects in the Dameng database, such as tables, views, synonyms, sequences, stored procedures, packages, and so on.

two。 Create a user:

Description: when you create a user, a corresponding pattern is automatically generated and authorized.

Create user "YTH" identified by "yth"-create a user

Grant "PUBLIC", "RESOURCE" to "YTH";-- authorization

3. Create synonyms:

CREATE SYNONYM "YTH". "AAAA" FOR "SG_DATACENTER". AAAA "

4. Test query results:

Select * from AAAA

5. The functions and characteristics of synonyms for Dream:

1) in multi-user collaborative development, the names of objects and their holders can be shielded. If there is no synonym, you must pass the (schema name) when manipulating other users' tables. Table name), after using the synonym of Dameng, the pattern name can be hidden.

2) simplify sql statements for users. The above is actually a way to simplify sql, and if you create a table with a long name, you can create a synonym for the table to simplify sql development.

3) provide location transparency for remote objects in distributed databases.

The advantages of synonyms: save a lot of database space, there is no difference in the operation of the same table for different users; the expanded scope of use of the database can achieve seamless interaction between different database users; synonyms can be created on a different database server and connected through the network.

Delete synonym: drop public synonym table_name

View all synonyms: select * from dba_synonyms

Tags: Synonyms synonyms data database user object different name schema at the same time actual scheme space view storage development management function security between Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei Shulou Tech Info MariaDB OPPO Reno