您的位置:首页 > 其它

Overview of Synonyms【每日一译】--20121208

2012-12-12 08:48 337 查看
A synonym is an alias for any table, view, materialized view, sequence, procedure,

function, package, type, Java class schema object, user-defined object type, or another

synonym. Because a synonym is simply an alias, it requires no storage other than its

definition in the data dictionary.

一个同义词对于任何表,视图,物化视图,序列,过程,函数,包体,类,J***A类别对象

,用户定义对象类型,或者其它同义词它就是一个别名。因为同义词是一个简化别名,除

了它定义在数据字典外它不要求存储空间。

Synonyms are often used for security and convenience. For example, they can do the

following:

■ Mask the name and owner of an object

■ Provide location transparency for remote objects of a distributed database

■ Simplify SQL statements for database users

■ Enable restricted access similar to specialized views when exercising fine-grained

access control

同义词经常用于安全和便利。比如,它们可以做如下事情:

#掩盖对象的名字和用户名

#提供们位置透明的对于分布式数据库的远程对象

#允许限制访问类似于特定视图当使用细粒度的访问控制

You can create both public and private synonyms. A public synonym is owned by the

special user group named PUBLIC and every user in a database can access it. A

private synonym is in the schema of a specific user who has control over its

availability to others.

你可以创建公共的和私有的同义词。一个公共的同义词是属于指定的用户组名叫PUBLIC和

数据库中的每一个用户可以访问它。一个私有的同义词它是在一个可以通过它的权限赋给其它用户来控制

同义词的指定用户。

Synonyms are very useful in both distributed and nondistributed database

environments because they hide the identity of the underlying object, including its

location in a distributed system. This is advantageous because if the underlying object

must be renamed or moved, then only the synonym needs to be redefined.

Applications based on the synonym continue to function without modification.

Synonyms can also simplify SQL statements for users in a distributed database system.

The following example shows how and why public synonyms are often created by a

database administrator to hide the identity of a base table and reduce the complexity

同义词在分布式和非分布式的数据库环境中是非常有用的,因为它们隐藏了基表的标识,包含

它的位置在一个分布式系统中。这是有利的因为如果基表对象必须重命名或者移除时,那

么同义词只需要重定义。应用基于同义词继续工作而不需要修改。同义词也可以以简化SQL语句对于

在一个分布式数据库系统的用户。以下的例子显示了怎么和为什么公共同义词经常创建通过DBA去

隐藏数据库基表标识和减少复杂性。

of SQL statements. Assume the following:

■ A table called SALES_DATA is in the schema owned by the user JWARD.

■ The SELECT privilege for the SALES_DATA table is granted to PUBLIC.

At this point, you have to query the table SALES_DATA with a SQL statement similar

to the following:

SELECT * FROM jward.sales_data;

Notice how you must include both the schema that contains the table along with the

table name to perform the query.

Assume that the database administrator creates a public synonym with the following

SQL statement:

CREATE PUBLIC SYNONYM sales FOR jward.sales_data;

After the public synonym is created, you can query the table SALES_DATA with a

simple SQL statement:

SELECT * FROM sales;

Notice that the public synonym SALES hides the name of the table SALES_DATA and

the name of the schema that contains the table.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: