当前位置:   article > 正文

oracle赋予用户权限_oracle某一个表授权给其他用户

oracle某一个表授权给其他用户

oracle赋予用户权限

1、默认的普通用户sun默认未解锁,不能进行那个使用,新建的用户也没有任何权限,必须授予权限

grant create session to sun;            //授予sun用户创建session的权限,即登陆权限
 
grant unlimited tablespace to sun;      //授予sun用户使用表空间的权限
 
grant create table to sun;              //授予创建表的权限
 
grant drop any table to sun;            //授予删除表的权限
 
grant insert any table to sun;          //插入表的权限
 
grant update any table to sun;          //修改表的权限
 
grant all to public;                    //这条比较重要,授予所有权限(all)给所有用户(public)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

2、oralce权限管理比较严谨,普通用户之间也是默认不能互相访问的,需要互相授权

    grant select on tablename to sun;//授予sun用户查看指定表的权限
 
    grant drop on tablename to sun;//授予删除表的权限
 
    grant insert on tablename to sun;//授予插入的权限
 
    grant update on tablename to sun;//授予修改表的权限
 
 
  //授予对指定表特定字段的插入和修改权限,注意,只能是insert和update
    grant insert(id) on tablename to sun;
 
    grant update(id) on tablename to sun;
 
    grant alert all table to sun;//授予sun用户alert任意表的权限
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

3、撤销权限

基本语法同grant,关键字为revoke

4、查看权限

    select * from user_sys_privs;//查看当前用户所有权限
 
    select * from user_tab_privs;//查看所用用户对表的权限
  • 1
  • 2
  • 3

5、权限传递

即用户A将权限授予B,B可以将操作的权限再授予C,命令如下:

    //关键字 with admin option
    grant alert table on tablename to sun with admin option;
 
    //关键字 with grant option效果和admin类似
    grant alert table on tablename to sun with grant option;
  • 1
  • 2
  • 3
  • 4
  • 5

6、角色

角色即权限的集合,可以把一个角色授予给用户

create role myrole;//创建角色

grant create session to myrole;//将创建session的权限授予myrole

grant myrole to sun;//授予sun用户myrole的角色

drop role myrole;删除角色
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

原文链接:https://blog.csdn.net/weixin_42117413/article/details/123245278

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/37847
推荐阅读
相关标签
  

闽ICP备14008679号