以前对角色权限和对象权限有一点概念,但对互相的权限是否影响并不十分清楚,通过这个实验,可以明白两者关系。
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
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博客 ” ,链接:http://blog.itpub.net/30146442/viewspace-2125183/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30146442/viewspace-2125183/