Answers:
列出分配了特定角色的所有用户
-- Change 'DBA' to the required role
select * from dba_role_privs where granted_role = 'DBA'
列出授予用户的所有角色
-- Change 'PHIL@ to the required user
select * from dba_role_privs where grantee = 'PHIL';
列出授予用户的所有特权
select
lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from
(
/* THE USERS */
select
null grantee,
username granted_role
from
dba_users
where
username like upper('%&enter_username%')
/* THE ROLES TO ROLES RELATIONS */
union
select
grantee,
granted_role
from
dba_role_privs
/* THE ROLES TO PRIVILEGE RELATIONS */
union
select
grantee,
privilege
from
dba_sys_privs
)
start with grantee is null
connect by grantee = prior granted_role;
注意:摘自http://www.adp-gmbh.ch/ora/misc/recursively_list_privilege.html
列出某个角色赋予SELECT访问权限的表?
-- Change 'DBA' to the required role.
select * from role_tab_privs where role='DBA' and privilege = 'SELECT';
列出用户可以从中选择的所有表?
--Change 'PHIL' to the required user
select * from dba_tab_privs where GRANTEE ='PHIL' and privilege = 'SELECT';
列出所有可以在特定表上进行SELECT的用户(通过授予相关角色或通过直接授予(即,可以在joe上进行授予选择))?该查询的结果还应显示用户通过哪个角色拥有此访问权限,或者它是否是直接授予权限。
-- Change 'TABLENAME' below
select Grantee,'Granted Through Role' as Grant_Type, role, table_name
from role_tab_privs rtp, dba_role_privs drp
where rtp.role = drp.granted_role
and table_name = 'TABLENAME'
union
select Grantee,'Direct Grant' as Grant_type, null as role, table_name
from dba_tab_privs
where table_name = 'TABLENAME' ;
有很多方法可以获取所需的信息:
数据字典视图
目前在甲骨文。
您可以查询视图并检索详细信息:例如:
从DBA_COL_PRIVS选择*;
从ALL_COL_PRIVS中选择*;
从USER_COL_PRIVS中选择*;
这告诉您:
DBA视图描述了数据库中所有列对象的授予。ALL视图描述当前用户或PUBLIC是其对象所有者,授予者或被授予者的所有列对象授予。USER视图描述了列对象授予,当前用户为其对象的所有者,授予者或被授予者。
有关更多信息,请查看
希望这可以帮助。
SELECT
由于角色而可用的特权,而#6则缺失。