oracle授权对象不存在,oracle 系统权限与对象权限

1、以SYSTEM用户登录数据库

sqlplus system/password

2、创建用户test1,默认表空间是users,默认的临时表空间是TEMP,在USERS表空间用1M的限额。

SQL>create user test1 identified by test1 default tablespace users temporary tablespace temp quota 1M on users;

3、创建用户test2,默认表空间是users,默认的临时表空间是TEMP,在USERS表空间用1M的限额。

SQL>create user test2 identified by test2 default tablespace users temporary tablespace temp quota 1M on users;

4、测试系统权限

授权test1用户建立会话权限并有管理选项

SQL>grant create session to test1 with admin option;

SQL>conn test1/test1 (看看test1是否可以连接)

SQL>grant create session to test2;(用test1授权create session 给test2)

SQL>conn test2/test2

SQL>conn system/password

SQL>revoke create session from test1;(撤销test1的连接权限)

SQL>conn test1/test1

ERROR:

ORA-01045: user TEST1 lacks CREATE SESSION privilege; logon denied

警告: 您不再连接到 ORACLE。

SQL>conn test2/test2

test2还可以连接,说明系统权限不支持级联收回

SQL>conn system/password

SQL> revoke create session from test2;(dba 可以跨级收回权限)

SQL> conn test2/test2

ERROR:

ORA-01045: user TEST2 lacks CREATE SESSION privilege; logon denied

警告: 您不再连接到 ORACLE。

5、对象权限测试

SQL> conn system/password

SQL> create table t1 (id number);

表已创建。

SQL> insert into t1 values(10);

已创建 1 行。

SQL> commit;

提交完成。

(在SYSTEM用户下创建一个表)

SQL> grant create session to test1,test2;

SQL> grant select on t1 to test1 with grant option;(授给test1有查看权限,并且有管理选项)

SQL> conn test1/test1

SQL> select * from system.t1;

ID

----------

10

SQL> grant select on system.t1 to test2;

SQL> conn test2/test2

已连接。

SQL> select * from system.t1;

ID

----------

10

SQL> conn system/password

已连接。

SQL> revoke select on t1 from test2;

revoke select on t1 from test2

*

第 1 行出现错误:

ORA-01927: 无法 REVOKE 您未授权的权限

SQL> revoke select on t1 from test1;

撤销成功。

SQL> conn test1/test1

SQL> select * from system.t1;

select * from system.t1

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

SQL> conn test2/test2

已连接。

SQL> select * from system.t1;

select * from system.t1

*

第 1 行出现错误:

ORA-00942: 表或视图不存在

总结:系统权限admin option不支持级联收回,但支持跨级收回

对象权限 grant option 不支持跨级收回,但支持级联收回

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值