Oracle permissions-related queries really a bit more views, record the common statements, easy to query:
1. View All Users:
SELECT * from Dba_users;
SELECT * from All_users;
SELECT * from User_users;
2. View user or role system permissions (System permissions that are directly assigned to a user or role):
SELECT * from Dba_sys_privs;
SELECT * from User_sys_privs;
3. View the permissions that are included in the role (can only view the roles owned by the logged-on user)
SELECT * from Role_sys_privs where role= ' DBA ';
4. View User Object permissions:
SELECT * from Dba_tab_privs;
SELECT * from All_tab_privs;
SELECT * from User_tab_privs;
5. View all roles:
SELECT * from Dba_roles;
6. View the roles owned by the user or role:
SELECT * from Dba_role_privs;
SELECT * from User_role_privs;
7. See which users have SYSDBA or Sysoper system permissions (requires appropriate permissions when querying)
SELECT * from V$pwfile_users;
For example, I want to check the permissions of user xxx:
SELECT * from Dba_sys_privs where grantee= ' XXX ';
GRANTEE PRIVILEGE admin_option
------------------------------ ---------------------------------------- ------------
XXX CREATE TRIGGER NO
XXX UNLIMITED tablespace NO
For example, I want to see the user xxx's own role:
SELECT * from Dba_role_privs where grantee= ' XXX ';
GRANTEE granted_role admin_option Default_role
------------------------------ ------------------------------ ------------ ------------
XXX DBA NO YES
View all permissions and roles for a user
Select privilege from Dba_sys_privs where grantee= ' XXX '
Union
Select privilege from Dba_sys_privs where grantee in
(select Granted_role from Dba_role_privs where grantee= ' XXX ');
Oracle Permissions-related queries