二十、Oracle中的用户和权限

目录

20.1. 创建用户

20.2. 把连接权限授予用户

20.3. 删除用户

20.4. 修改用户

20.5. 对象授权

20.6. 级联授权 

20.7. 系统授权

20.8. 级联授权

20.9. 通过角色控制权限

20.10. 一般开发用到的权限

20.11. 如果要查询其他用户的表,使用下面语句

20.12. 解除对象授权

20.13. 解除系统授权

20.14. 解除角色授权

20.15. 示例


 

20.1. 创建用户

create user test identified bytest123;


20.2. 把连接权限授予用户

grant connect to test;

 


20.3. 删除用户

drop user test;


 

20.4. 修改用户

alter user test default tablespace users;

alter user test identified bytest111;

alter user test account lock;

alter user test account unlock;

grant resource to test;

 


20.5. 对象授权

grant select on scott.dept to test;

grant execute on scott.proc_test to test;


20.6. 级联授权 

--对象授权的级联授权用  with grant option

--级联授权后test用户也有授权给其他用户select on scott.dept 的权限

grant select on scott.dept to test with grant option;

grant insert on scott.dept to test with grant option;

grant all on scott.dept to test with grant option;


 

20.7. 系统授权

grant create table  to test;

grant create user to test;

grant drop user to test;


20.8. 级联授权

--系统的级联授权用  with admin option

grant create user to test with admin option;

 


 

20.9. 通过角色控制权限

create role myrole;

grant select on scott.dept to myrole;

grant select on scott.emp to myrole;

grant myrole to test;

 


 

20.10. 一般开发用到的权限

grant connect to test;

grant resource to test;

 


20.11. 如果要查询其他用户的表,使用下面语句

grant select any table to test;

 


 

20.12. 解除对象授权

revoke select on scott.dept from test;

revoke select any table from test;

 


20.13. 解除系统授权

revoke create user  from test;

 


20.14. 解除角色授权

revoke myrole from test;


20.15. 示例

周所周知,grant是给别的用户赋权限。他不只能够给表,视图赋权限,而且对存储过程,方法,以及包都可以,具体语法参考如下:

    1.grant给表赋权限:

    grant  select/update on  table to user;

    grant  权限 on 表  to 用户。

    2.grant 给存储过程赋权限:

    grant execute on package/function/procedure to user;

    grant execute on 过程、包、方法 to user

    还可以一次给所有的过程赋权限:

    grant execute any procedure to user;

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

发哥1997

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值