ITPub博客

首页 > 数据库 > Oracle > 角色权限和对象权限互不影响

角色权限和对象权限互不影响

原创 Oracle 作者:cqjzh1979 时间:2016-09-20 10:48:42 0 删除 编辑
以前对角色权限和对象权限有一点概念,但对互相的权限是否影响并不十分清楚,通过这个实验,可以明白两者关系。

SQL> create user oe identified by oe;
SQL> grant connect,resource to oe;
SQL> conn oe/oe@xgc
SQL> create table orders(id number);
SQL> insert into orders values(1);
SQL> insert into orders values(2);
SQL> commit;

SQL> conn scott/tiger@xgc
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 
Connected as scott
SQL> select * from oe.orders;

select * from oe.orders
ORA-00942: 表或视图不存在


create role r1;
grant select, insert on oe.orders to r1;
grant r1 to scott;
grant select on oe.orders to scott;
revoke select on oe.orders from scott;

SQL> insert into oe.orders values(3);
SQL> insert into oe.orders values(4);
SQL> commit;
SQL> commit;

SQL> select * from oe.orders;


        ID
----------
         1
         2
         3
         4


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

请登录后发表评论 登录
全部评论

注册时间:2015-02-27

  • 博文量
    30
  • 访问量
    40868