有人可以告诉我如何在sql-console中显示特定用户的所有特权/规则吗?

最佳答案

您可以尝试以下 View 。

SELECT * FROM USER_SYS_PRIVS;
SELECT * FROM USER_TAB_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;

DBA和其他 super 用户可以使用这些相同 View 的DBA_版本找到授予其他用户的特权。它们包含在documentation中。

这些 View 仅显示直接授予用户的特权。查找所有特权,包括通过角色间接授予的特权,都需要更复杂的递归SQL语句:
select * from dba_role_privs connect by prior granted_role = grantee start with grantee = '&USER' order by 1,2,3;
select * from dba_sys_privs  where grantee = '&USER' or grantee in (select granted_role from dba_role_privs connect by prior granted_role = grantee start with grantee = '&USER') order by 1,2,3;
select * from dba_tab_privs  where grantee = '&USER' or grantee in (select granted_role from dba_role_privs connect by prior granted_role = grantee start with grantee = '&USER') order by 1,2,3,4;

关于sql - 如何在oracle中显示用户的所有特权?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9811670/

10-09 18:08