Tuesday, December 18, 2012

Data dictionary tables for Roles and Privileges in Oracle



/* Issue this query to find out what roles have been created for the    */
/* oracle db you are accessing. the 1st 19 roles are default roles that */
/* are created when you install oracle; */

select * from dba_roles;

/* Use this query to find what usrs (grantees) have been granted what roles */


select grantee, granted_role from dba_role_privs where grantee not in
('SYS', 'SYSTEM') order by grantee;


/* use this query to see tables that were created by others (=owner),*/
/* that you have been granted access too, including what privileges  */
/* you were granted (=privilege) and whether you can grant access to */
/* others (=GRA) */

select * from user_tab_privs_recd;


/* to find what system privileges have been granted to roles */

Select privilege, admin_option from role_sys_privs where role like ‘ROLENAME%’;


/* to find what roles have been granted to roles */

Select granted_role, admin_option from role_role_privs where role like ‘ROLENAME%’;


/* to find what table privileges have been granted to roles */

Select * from role_tab_privs where role like ‘ROLENAME%’;

/* to find what system privileges have been granted to users and roles */

Select * from dba_sys_privs where grantee like ‘USERORROLENAME;



No comments:

Post a Comment