这篇文章《》,介绍的知识点中,有一处细节问题,描述信息如下,
SQL UPDATE (SELECT b.name b_name, b.class b_class, a.name, a.class
FROM tbl_a a, tbl_b b
WHERE a.id = b.id)
SET name = b_name, class = b_class;
FROM tbl_a a, tbl_b b
*
ERROR at line 2:
ORA-00942: table or view does not exist会提示TBL_B不存在,因为用户没有该表的任何权限,(注:此处和eygle的示例中反馈不同,他提示的是ORA-01031: insufficient privileges)
为什么一个提示ORA-00942: table or view does not exist,一个提示ORA-01031: insufficient privileges?
麦苗兄在之前的文章评论中,给出了问题方向,这个和一个权限有关,下面我们测试下。
用户phibisal检索用户bisal的表A,
SQL select * from bisal.a; select * from bisal.a * ERROR at line 1: ORA-00942: table or view does not exist
因为未设置phibisal有权限访问bisal的A表,所以无法访问,此时提示ORA-00942。
我们为phibisal授予under any table权限,
SQL grant under any table to a; Grant succeeded.
再次使用phibisal检索,
SQL select * from bisal.a; select * from bisal.a * ERROR at line 1: ORA-01031: insufficient privileges
此时提示的就是ORA-01031。
当然,revoke权限,会恢复原来的错误信息,
SQL revoke under any table from a; Revoke succeeded.
SQL select * from bisal.a; select * from bisal.a * ERROR at line 1: ORA-00942: table or view does not exist
MOS这篇文章《What Privileges Can Be Audited (文档 ID 976713.1)》,提到了这个权限,这个权限没有被官方标记,所以从文档找不出其他信息,
This privilege (UNDER ANY TABLE) was never exposed to users. It is unsupported and therefore intentionally undocumented. It was part of the table hierarchy functionality, which was never implemented. Type hierarchy was implemented instead.
OTN论坛中,也有人指出了,这个权限未标记,
https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrl-state=u3dotd8qh_9&_afrLoop=289029305698244
UNDER ANY TABLE - not documented
我们从数据字典,可以看见,还有另外两个under,一个是under any view,一个是under any type,
SQL select name from SYSTEM_PRIVILEGE_MAP where name like 'UNDER%'; NAME -------------------------------------------------------------------------------- UNDER ANY TABLE UNDER ANY VIEW UNDER ANY TYPE
对于这一个小知识点,既然官方unsupported,了解一下就行了,无伤大雅。
如果您觉得本文有帮助,欢迎关注转发:bisal的个人杂货铺,