Oracle 权限查询

--查询  直接赋予用户的系统权限

SELECT * FROM USER_SYS_PRIVS;
或
COL privilege FOR a50
SELECT privilege
FROM dba_sys_privs
WHERE grantee = UPPER ('&grantee')

示例:
GRANT SELECT ANY TABLE,INSERT ANY TABLE,UPDATE ANY TABLE,DELETE ANY TABLE,SELECT ANY SEQUENCE  TO usr01;

--查询 用户通过角色获取的系统权限

SELECT privilege    
  FROM dba_sys_privs
 WHERE grantee IN (SELECT granted_role  
                     FROM dba_role_privs 
                    WHERE grantee = UPPER ('&grantee')); 

--查询 用户具有的所有权限(包含直接被赋予的及通过角色间接赋予的)

--用当期用户查询
SELECT * FROM SESSION_PRIVS;

或

--用DBA用户
COL privilege FOR a50
SELECT privilege 
  FROM dba_sys_privs
 WHERE grantee = UPPER ('&grantee')
UNION   
SELECT privilege    
  FROM dba_sys_privs
 WHERE grantee IN (SELECT granted_role  
                     FROM dba_role_privs 
                    WHERE grantee = UPPER ('&grantee')); 

 

posted @ 2020-08-31 17:34  PoleStar  阅读(397)  评论(0编辑  收藏  举报