Want to post your scripts here in this blog ? Email it to snojha@gmail.com. You will be rewarded for your scripts if selected by our experts.

Wednesday, January 13, 2010

Check which user has been granted with the 'RESOURCE' role

select grantee
from dba_role_privs r, dba_users u
where granted_role ='RESOURCE' and
r.grantee = u.username and
u.account_status not like '%LOCKED%' and
grantee not in ('SYS','SYSTEM','DBSNMP')
union
select grantee
from dba_role_privs r, dba_users u
where r.grantee = u.username and
u.account_status not like '%LOCKED%' and
grantee not in ('SYS','SYSTEM','DBSNMP') and
granted_role in
( select grantee
from dba_role_privs
where granted_role = 'RESOURCE' and
grantee <> 'DBA');

No comments: