Necessity is the mother of invention ,对这句话的感受越来越深。
上午有人问我关于Oracle synonym 的问题。虽然知道 synonym这个东西,不过还真没有用过。翻了翻10gr2的文档以及google了一下,整理之。
synonym是什么?
an alias for a schema object (别名)
synonym用途,好处?
-
- provide a level of security by masking the name and owner of an object and by providing location transparency for remote objects of a distributed database. (通过隐藏object的名字和所有者 以及 为分布式数据库对象提供透明的位置 来提高安全性)
- they are convenient to use and reduce the complexity of SQL statements for database users.(方便使用,减少SQL的复杂度)
synonym分类?
-
-
A public synonym is owned by the special user group named PUBLIC and is accessible to every user in a database.
-
A private synonym is contained in the schema of a specific user and available only to the user and the user's grantees.
-
具体的操作,权限方面的可以参考10gr2的文档。
| 这是需要满足的需求吧。 Z用户想要不指定STA这个用户名来访问STA.TEST这张表STA.TEST是STA用户的表 sta@PDB> grant select on TEST to z; z@PDB> create synonym TEST for STATISTICS.TEST; --z用户要有create synonym的权限 |
另外看到一篇Steve Adams 的一篇文章 Public synonym performance 。解析表名时的影响并不值得关注,需要关注的是 public synonym usage clutters the library cache and dictionary cache with information needed to track the negative dependencies on non-existent objects.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23650854/viewspace-700653/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23650854/viewspace-700653/
本文介绍了Oracle数据库中同义词(synonym)的概念及其用途,包括如何为对象创建别名以增强安全性及简化SQL语句,并提供了具体的创建及使用示例。
2274

被折叠的 条评论
为什么被折叠?



