如何理解Oracle中“通过角色授权”需要用户重新登陆
我们经常听到在Oracle中,通过角色授予用户权限的时候需要用户重新登陆才能获得授予的权限,这句话到底怎么理解呢?通过下面的步骤我们来理解这句话的含义.
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.
USER is "U1"
SQL> select * from session_privs;
PRIVILEGE
----------------------------------------
CREATE SESSION
SQL> select * from session_roles;
ROLE
------------------------------
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.
相关推荐
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16
ktyl000 2020-08-16
dbasunny 2020-08-16