How to view the permissions or roles of the current Login User in Oracle
View the role of the current user
SQL> select * from user_role_privs;
SQL> select * from session_privs
View the system and table-level permissions of the current user
SQL> select * from user_sys_privs;
SQL> select * from user_tab_privs;
Appendix:
1. View users:
1. view the current user:
Select * from v $ session;
2. View All Users:
Select * from dba_users;
Select * from all_users;
Select * from user_users;
Ii. View roles:
1. All roles activated by the current user
Select * from session_roles;
2. role assigned to the current user
Select * from user_role_privs;
2. Roles granted to all users
Select * from dba_role_privs;
3. view all roles:
Select * from dba_roles;
4. query the roles assigned to the current role
Select GRANTED_ROLE from ROLE_ROLE_PRIVS where ROLE = & ROLE; -- for example, role = 'dba'
3. View permissions:
1. Basic permission query:
Select * from session_privs; -- all permissions of the current user
Select * from user_sys_privs; -- system permission of the current user
Select * from user_tab_privs; -- table-level permissions of the current user
Select * from dba_sys_privs; -- query the system permissions of a user
Select * from role_sys_privs; -- view the permissions of a role (only the roles owned by the login user can be viewed)
2. View user object permissions:
Select * from dba_tab_privs;
Select * from all_tab_privs;
Select * from user_tab_privs;
3. Check which users have sysdba or sysoper system permissions (the corresponding permissions are required for query)
Select * from V $ PWFILE_USERS
Note:
1. Run the following statement to view the system permissions provided by Oracle:
Select name from sys. system_privilege_map
2. View All system permissions of a user (including the system permissions of the role)
SQL code
Select privilege from dba_sys_privs where grantee = 'datauser'
Union
Select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee = 'datauser ');