Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the privileges and roles granted to a user in Oracle? [duplicate]

I am using Linux, Oracle10g. I have created one user called test. and granted create session and select any dictionary permission to the same user.

i also granted sysdba and sysoper roles to the same users.

Now i want to display all the privileges and roles granted to the user. I found following query but it shows only create session and select dictionary privileges.

select privilege  from dba_sys_privs  where grantee='SAMPLE'  order by 1; 

please help to resolve the issue.

Thanks

like image 457
Abhimanyu garg Avatar asked Feb 25 '13 11:02

Abhimanyu garg


People also ask

Where can I find user privileges in Oracle?

Querying DBA/USER Privilege Views A database administrator (DBA) for Oracle can simply execute a query to view the rows in DBA_SYS_PRIVS , DBA_TAB_PRIVS , and DBA_ROLE_PRIVS to retrieve information about user privileges related to the system , tables , and roles , respectively.

What are the privileges in DBA role Oracle?

DBA is the standard role that can be granted by an administrator to another administrator. It includes all system privileges and should only be granted to the most trusted and qualified of users. Assigning this role to a user enables the user to administer the database.

What is Grantable in Dba_tab_privs?

GRANTABLE. VARCHAR2(3) Indicates whether the privilege was granted with the GRANT OPTION ( YES ) or not ( NO ) HIERARCHY.


2 Answers

In addition to VAV's answer, The first one was most useful in my environment

select * from USER_ROLE_PRIVS where USERNAME='SAMPLE'; select * from USER_TAB_PRIVS where Grantee = 'SAMPLE'; select * from USER_SYS_PRIVS where USERNAME = 'SAMPLE'; 
like image 99
user2668478 Avatar answered Oct 22 '22 05:10

user2668478


Look at http://docs.oracle.com/cd/B10501_01/server.920/a96521/privs.htm#15665

Check USER_SYS_PRIVS, USER_TAB_PRIVS, USER_ROLE_PRIVS tables with these select statements

SELECT * FROM USER_SYS_PRIVS;  SELECT * FROM USER_TAB_PRIVS;  SELECT * FROM USER_ROLE_PRIVS; 
like image 33
VAV Avatar answered Oct 22 '22 04:10

VAV