dgf*_*dgf 32 oracle permissions role select
我确定以前有人问过这个问题,但我似乎无法找到以下内容的相关详细信息。
是否有某种预建表可以执行以下操作(我使用了 dba_tab_privs 但它是有限的并且不能满足我的所有需求),如果没有,是否有人对回答以下问题有疑问?
Phi*_*lᵀᴹ 36
列出已分配特定角色的所有用户
-- Change 'DBA' to the required role
select * from dba_role_privs where granted_role = 'DBA'
Run Code Online (Sandbox Code Playgroud)
列出赋予用户的所有角色
-- Change 'PHIL@ to the required user
select * from dba_role_privs where grantee = 'PHIL';
Run Code Online (Sandbox Code Playgroud)
列出授予用户的所有权限
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;
Run Code Online (Sandbox Code Playgroud)
注意:摘自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';
Run Code Online (Sandbox Code Playgroud)
列出用户可以从中选择的所有表?
--Change 'PHIL' to the required user
select * from dba_tab_privs where GRANTEE ='PHIL' and privilege = 'SELECT';
Run Code Online (Sandbox Code Playgroud)
列出可以对特定表进行 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' ;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
290077 次 |
| 最近记录: |