如何理解Oracle中“通过角色授权”需要用户重新登陆

2014-11-24 18:57:17 · 作者: · 浏览: 2

1,DBA做如下的操作:


create user u1 identified by u1


create role r1;


grant create session to r1;


grant r1 to u1;


通过查询 select * from dba_sys_privs where grantee='R1',发现权限已经付给了角色.



通过查询 select * from dba_role_privs where grantee='U1',发现角色r1已经付给了用户u1.




R1


3,u1尝试建表:没有建表的权限.


SQL> create table t(i int);
create table t(i int)
*
ERROR at line 1:
ORA-01031: insufficient privileges


4,DBA建立另外一个角色r2,授予r2建表的权限,建r2授予u1.


create role r2;
grant create table to r2;
grant r2 to u1;


通过查询 select * from dba_role_privs where grantee='U1',发现角色r2已经付给了用户u1.