读书人

OCP考试题解析_007: 同义词

发布时间: 2013-03-06 16:20:31 作者: rapoo

OCP考题解析_007: 同义词
同义词是基表的别名、只在数据字典里有其定义、没有存储
同义词为分布式数据库提供位置透明性、访问异地的资源就像访问本地的资源一样无差别

㈠ 语法

创建同义词的语法:

OCP考试题解析_007: 同义词

没有带public的是私有同义词
私有同义词就是普通用户所创建的同义词,之所以说它是私有,是因为只有创建该同义词的用户才能使用此同义词
而公用同义词是指数据库管理员创建的,当然,公用同义词是允许所有的用户来使用的
如果要创建一个远程的数据库上的某张表的同义词,需要先创建一个Database Link,然后再使用@DB_Link_name

当出现同名时、优先级如下:
私有同义词 > 公有同义词
基表 > 公有同义词
存在同名对象和公共同义词时,数据库优先选择对象作为目标
存在同名私有对象和公共对象时,数据库优先选择私有同义词作为目标
基表与私有同义词不能同名、否则会报ORA-00955错误

㈡ 同义词的操作

① 查看同义词

Q: 16 Mary has a view called EMP_DEPT_LOC_VU that was created based onthe EMPLOYEES, DEPARTMENTS, and LOCATIONS tables. She granted SELECT privilege to Scotton this view. Which option enables Scott to eliminate the need to qualify the view with the nameMARY.EMP_DEPT_LOC_VU each time the view is referenced?A. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE PRIVATE SYNONYM EDL_VU FOR mary.EMP_DEPT_LOC_VU; then he can prefix the columns with this synonym. B. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE SYNONYM EDL_VU FOR mary.EMP_DEPT_LOC_VU; then he can prefix the columns with this synonym. C. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE LOCAL SYNONYM EDL_VU FOR mary.EMP_DEPT_LOC_VU; then he can prefix the columns with this synonym. D. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE SYNONYM EDL_VU ON mary(EMP_DEPT_LOC_VU); then he can prefix the columns with this synonym. E. Scott cannot create a synonym because synonyms can be created only for tables. F. Scott cannot create any synonym for Mary's view. Mary should create a private synonym for the view and grant SELECT privilege on that synonym to Scott. Answer: B


读书人网 >其他数据库

热点推荐