一尘不染

如何列出用户收到的所有补助?

sql

我需要查看Oracle数据库上的所有赠款。

我使用TOAD功能比较架构,但未显示临时授权等。因此,我有一个问题:

如何在Oracle数据库上列出所有赠款?


阅读 142

收藏
2021-03-17

共1个答案

一尘不染

如果您不仅需要直接表授予(例如,通过角色进行的授予,诸如选择任何表之类的系统特权等),还可以使用以下一些附加查询:

用户的系统特权:

SELECT PRIVILEGE
  FROM sys.dba_sys_privs
 WHERE grantee = <theUser>
UNION
SELECT PRIVILEGE 
  FROM dba_role_privs rp JOIN role_sys_privs rsp ON (rp.granted_role = rsp.role)
 WHERE rp.grantee = <theUser>
 ORDER BY 1;

直接授予表/视图:

SELECT owner, table_name, select_priv, insert_priv, delete_priv, update_priv, references_priv, alter_priv, index_priv 
  FROM table_privileges
 WHERE grantee = <theUser>
 ORDER BY owner, table_name;

间接授予表/视图的权限:

SELECT DISTINCT owner, table_name, PRIVILEGE 
  FROM dba_role_privs rp JOIN role_tab_privs rtp ON (rp.granted_role = rtp.role)
 WHERE rp.grantee = <theUser>
 ORDER BY owner, table_name;
2021-03-17