resource角色隐式授权unlimited tablespace权限测试


由于有需要授权用户resource权限,而这会给用户隐式授予unlimited tablespace 权限,无法控制其表空间使用,

所以测试下先授予resource权限,再回收 unlimited tablespace权限的方式


 --创建测试表空间TEST和测试用户test
SQL> create tablespace TEST datafile '/data/oradata/TEST01.dbf' size 1g;
 
Tablespace created
 
SQL> 
SQL> CREATE USER test
  2    IDENTIFIED BY xxxx
  3    DEFAULT TABLESPACE TEST
  4    TEMPORARY TABLESPACE TEMP
  5    PROFILE DEFAULT
  6    ACCOUNT UNLOCK;
 

User created


--授予连接权限和resource角色权限

SQL>   GRANT CONNECT TO test;
 
Grant succeeded
SQL>  grant RESOURCE to test;
 
Grant succeeded
SQL>   ALTER USER test DEFAULT ROLE ALL;
 
User altered
SQL>   GRANT CREATE SESSION TO test;
 
Grant succeeded




--在其他表空间users创建测试表,有权限
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 
Connected as test
 
SQL> 
SQL> create table test(id number,com varchar2(10)) tablespace users;
 
Table created
SQL> drop table test purge;
 
Table dropped








--收回UNLIMITED TABLESPACE权限
 
SQL> revoke UNLIMITED TABLESPACE from test;
 
Revoke succeeded




--在其他表空间users和默认表空间创建表,均报错,无权限


SQL> create table test(id number,com varchar2(10)) tablespace users;
 
create table test(id number,com varchar2(10)) tablespace users
 
ORA-01950: 对表空间 'USERS' 无权限
 
SQL> create table test(id number,com varchar2(10)) ;
 
create table test(id number,com varchar2(10))
 
ORA-01950: 对表空间 'TEST' 无权限




--给用户单独授予默认表空间的权限
SQL>   alter user test quota  unlimited on  TEST;
 
User altered
 
SQL> 


 
--在默认表空间创建表,有权限。
 
SQL>  create table test(id number,com varchar2(10)) ;
 
Table created
 
SQL> drop table test purge;
 
Table dropped
 
--在其他表空间users创建表,无权限
SQL> create table test(id number,com varchar2(10)) tablespace users;
 
create table test(id number,com varchar2(10)) tablespace users
 
ORA-01950: 对表空间 'USERS' 无权限
 
SQL> 




--结论:
当给用户授予resource角色权限的时候,会隐式的授予unlimited tablespace系统权限。
如果想限制用户的表空间权限,可以回收unlimited tablespace系统权限后,在通过 quota 授予对应的权限。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值