当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
  Oracle用户角色权限管理(二)
发布时间:2010/11/26 10:07:53 来源:www.xue.net 编辑:城市总裁吧

  grant create table to user.

  用户对象权限例子:

  grant select on table_name to schema_name;

  与用户对象权限相关的试图:

  角色:

  角色就是一些权限的集合:

  为了方便管理,我们把某些常用的权限组织成一个集合。赋予角色。然后把角色赋予用户。提高管理的效率。例如创建一个数据库某个模式,某几个用户下的的只读用户,可读可插入用户,等等。在实质生产中还是有很大的意义。

  1.创建角色,不指定密码:

  create role testrole;

  2.创建角色,指定密码:

  create role testrole identified by tanfufa;

  3.修改角色:

  alter role testrole identified by luqiaoling;

  给角色授予权限。

  Grant select on t1 to testrole;

  Grant select on t2 to testrole;

  Grant select on t3 to testrole;

  把角色赋予用户:(特别说明,授予角色不是实时的。如下:)

  grant testrole to testdb;

  起用角色:给用户赋予角色,角色并不会立即起作用。

  1.角色不能立即起作用。必须下次断开此次连接,下次连接才能起作用。

  2.或者执行命令:有密码的角色set role testrole   identified by tanfufa 立即生效;

  3.无密码的角色:set role testrole;或set   role all except rolename_withpassword.

  把角色赋予角色,角色嵌套。

  create role testrole1;

  grant select on t1 to testrole1;

  create role testrole2;

  grant testrole1 to testrole2;

  grant r2 to testdb;

  角色管理:

  与角色有关系的视图:

  所有角色:

  select * from dba_roles;

  当前用户scott有哪些角色:

  select * from session_roles;

  建立角色模板:只举一个例子。大家去触类旁通。

  只读用户角色的建立的脚本:

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved