一般DBA根据自己的需要来定义角色,在建立角色时可以指定验证方式(不验证,数据库验证等)。
具有create role的系统权限
创建自定义的新角色(不验证)
角色是公用的角色,可以采用不验证的方式建立角色
sql>create role 自定义角色名
not identified;
创建自定义的新角色(数据库验证)
在建立这种角色时,需要为其提供口令,角色名、口令存放在数据库中,当激活该角色时,必须提供口令。
create role 自定义角色名
identified by 口令
;
角色授权
建立自定义角色时,角色没有任何权限,为了使得角色完成特定任务,必须为其授予相应的系统权限和对象权限。
sql>grant
create session to自定义角色名
with admin option;
sql> grant
select on emp to自定义角色名
;
sql>grant
insert,update,delete on emp to自定义角色名
;
分配自定义角色给用户
具有grant any role的系统权限
sql>grant 自定义角色名 to 用户名 with admin option;
备注:with admin option选项,用户可把该角色的权限再分配给其他的用户。