Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / User Privilege
 

Checking Roles Granted to a User

You can check which roles have been granted to a user by querying user_role_privs. A user who creates a role is also granted that role by default. SQL> desc user_role_privs;  Name                  Type              Description  USERNAME                    VARCHAR2(30) --Name of the user to whom the role has been granted.  GRANTED_ROLE                VARCHAR2(30) --Name of the role granted to the user.  ADMIN_OPTION                VARCHAR2(3)  --Whether the user is able to grant the role to another user or role. Equal to YES or NO.  DEFAULT_ROLE                VARCHAR2(3)  --Whether the role is enabled by default when the user connects to the database. Equal to YES or NO.  OS_GRANTED                  VARCHAR2(3)  --Whether the role was granted by the operating system. SELECT * FROM user_role_privs;