Query for Oracle User Roles

Published by Patrizia Gardis on

The query in the article “Query for Oracle User Roles”, allows us to identify the ROLES assigned to a specific user in the Oracle database by selecting GRANTEE, which is the user receiving the role, and GRANTED_ROLE, which identifies the name of the role.

A ROLE is a container for PRIVILEGES and can be filled with the classic GRANT RESOURCE TO role commands. Assignment occurs as if it were a user. We can create an empty ROLE and assign it the PRIVILEGES that best suit the profile of the user we need to manage.

Therefore, to identify the ROLES assigned to a user, we use the query below.

Note: In case we want to verify the privileges that belong to a role, we must execute the User Privileges query, replacing USERID (the username) with GRANTED_ROLE (the role name).

Query for Oracle User Roles

set lines 200
col GRANTED_ROLE for a40
col grantee for a30
select grantee,granted_role from dba_role_privs where grantee='&USERID';

 

 

To view my guides on CRS Commands, click here!
At this LINK, instead, you’ll find the SQL queies.

Stay updated on our activities by joining our community (remember to like our pages, let’s get in touch, and stay informed about all our new guides!).
Facebook
Youtube
Linkedin

For those who haven’t done so yet, we recommend saving this website to your bookmarks.

So that you always have our solutions to the most common database problems, especially Oracle databases, at your fingertips.


0 Comments

Leave a Reply

Avatar placeholder