关于ORA-01031: 权限不足的问题

今天遇到一个 ORA-01031: 权限不足[@more@]

scott@ORCL> CREATE OR REPLACE VIEW stats
2 as select 'STAT...' || a.name name, b.value
3 from v$statname a, v$mystat b
4 where a.statistic# = b.statistic#
5 union all
6 select 'LATCH.' || name, gets
7 from v$latch;
from v$statname a, v$mystat b
*
第 3 行出现错误:
ORA-01031: 权限不足;

SQL> create role pub_role;

Role created

SQL> grant select on v$statname to pub_role;

grant select on v$statname to pub_role

ORA-02030: 只能从固定的表/视图查询

SQL> grant select on V_$MYSTAT to pub_role;

Grant succeeded

SQL> grant select on v_$latch to pub_role;

Grant succeeded

SQL> grant select on V_$TIMER to pub_role;

Grant succeeded

scott@ORCL> select 'STAT...' || a.name name, b.value
2 from v$statname a, v$mystat b
3 where a.statistic# = b.statistic#
4 union all
5 select 'LATCH.' || name, gets
6 from v$latch;

NAME VALUE
----------------------------------------------------------------------- ----------
STAT...logons cumulative 1

scott@ORCL> CREATE OR REPLACE VIEW stats
2 as select 'STAT...' || a.name name, b.value
3 from v$statname a, v$mystat b
4 where a.statistic# = b.statistic#
5 union all
6 select 'LATCH.' || name, gets
7 from v$latch;
from v$statname a, v$mystat b
*
第 3 行出现错误:
ORA-01031: 权限不足

------------竟然还是01031错误。

SQL> grant select on v_$statname to u_omar;

Grant succeeded

SQL> grant select on V_$MYSTAT to u_omar;

Grant succeeded

scott@ORCL> CREATE OR REPLACE VIEW stats
2 as select 'STAT...' || a.name name, b.value
3 from v$statname a, v$mystat b
4 where a.statistic# = b.statistic#
5 union all
6 select 'LATCH.' || name, gets
7 from v$latch;

视图已创建。

----视图和存储过程一样。需要直接授权,通过角色获得的权限无效----------

---对动态性能表赋予权限的时候要 v$session ==>v_$session

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9925929/viewspace-916573/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9925929/viewspace-916573/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值