Oracle Database 中对同义词的操作Operations on Synonyms in Oracle Database
06/08/2017
本文内容
Oracle 数据库适配器Oracle Database adapter允许你对同义词执行操作。The Oracle 数据库适配器Oracle Database adapter allows you to perform operations on synonyms. 同义词是数据库对象 ((如表、视图、存储过程、函数和包) )的别名或友好名称。A synonym is an alias or friendly name for the database objects (such as tables, views, stored procedures, functions, and packages). For more information about synonyms in Oracle, see https://go.microsoft.com/fwlink/?LinkId=138058.
使用同义词的优点Advantages of Using Synonyms
同义词在下列情况下非常有用:Synonyms are helpful in the following scenarios:
使用 不同的架构:如果使用的是不同的架构,并且需要跨架构访问对象,则必须使用不同的 SQL 语句来访问这些对象。Working with different schemas: If you are working with different schemas, and need to access the objects across schemas, you have to use different SQL statements to access those objects. 您可以为架构中的对象创建同义词,并使用 SQL 语句中的同义词来访问该对象。You can create a synonym for an object in a schema, and use the synonym in your SQL statement to access the object. 如果需要访问其他架构中的基础对象,请修改该同义词的定义,使其指向不同架构中的对象。If you need to access the underlying object in a different schema, modify the definition of the synonym to point to the object in a different schema. 因此,基于同义词的应用程序将继续运行,而无需在 SQL 语句中进行修改。Thus, the applications based on the synonym continue to function without modification in the SQL statement.
例如,假设您的测试环境和生产环境都有两个相同的架构: "Test" 和 "生产"。For example, suppose you have two identical schemas for your test and production environments: “Test” and “Pr