oracle under any view,关于under any table/view 权限的解释

关于under any table/view 权限的解释

用户拥有这个权限之后,对其它用户下的对象如果存在的话会显示 权限不足,而不会显示 表或视图不存在了,废话少说,直接看例子吧:

C:\Users\Administrator>sqlplus sys/lhr@orclasm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 9月 10 11:10:20 2014

Copyright (c) 1982, 2010, Oracle. All rights reserved.

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE 11.2.0.3.0 Production

TNS for Linux: Version 11.2.0.3.0 - Production

NLSRTL Version 11.2.0.3.0 - Production

---回收scott用户的2个权限

SQL> revoke under any table from scott;

撤销成功。

SQL> revoke under any view from scott;

撤销成功。

--查看lhr用户下的表products_lhr和视图vw_tmp_lhr,不存在表ttttttt

SQL> conn lhr/lhr@orclasm

已连接。

SQL> select count(1) from lhr.products_lhr;

COUNT(1)

----------

0

SQL> select count(1) from lhr.vw_tmp_lhr;

COUNT(1)

----------

0

SQL> select * from lhr.ttttttt;

select * from lhr.ttttttt

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

--使用scott用户来查看lhr用户下的表products_lhr和视图vw_tmp_lhr,不存在表ttttttt

---这里的错误为 不存在

SQL> conn scott/tiger@orclasm

已连接。

SQL> select count(1) from lhr.products_lhr;

select count(1) from lhr.products_lhr

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

SQL> select count(1) from lhr.vw_tmp_lhr;

select count(1) from lhr.vw_tmp_lhr

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

--- 使用sys用户对scott用户授权

SQL> conn sys/lhr@orclasm

已连接。

SQL> grant under any table to scott;

授权成功。

---使用scott用户查询,错误变为了权限不足,至此大家就明白了这个权限的干啥用的了

SQL> conn scott/tiger@orclasm

已连接。

SQL> select count(1) from lhr.products_lhr;

select count(1) from lhr.products_lhr

*

第 1 行出现错误:

ORA-01031: 权限不足

SQL> select count(1) from lhr.vw_tmp_lhr;

select count(1) from lhr.vw_tmp_lhr

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

SQL> conn sys/lhr@orclasm as sysdba

已连接。

SQL> grant under any view to scott;

授权成功。

SQL> conn scott/tiger@orclasm

已连接。

SQL> select count(1) from lhr.vw_tmp_lhr;

select count(1) from lhr.vw_tmp_lhr

*

第 1 行出现错误:

ORA-01031: 权限不足

SQL> select * from lhr.ttttttt;

select * from lhr.ttttttt

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

SQL>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值