Tuesday, May 20, 2014

FIND privillages of a TABLE and SCHEMA and ROLE

VIEWs and QUERIES to find  privileges of a TABLE and SCHEMA and ROLE


#################### VIEWS ################

ALL_COL_PRIVS
ALL_COL_PRIVS_MADE
ALL_COL_PRIVS_RECD
ALL_REPGROUP_PRIVILEGES
ALL_TAB_PRIVS
ALL_TAB_PRIVS_MADE
ALL_TAB_PRIVS_RECD


USER_AQ_AGENT_PRIVS
USER_COL_PRIVS
USER_COL_PRIVS_MADE
USER_COL_PRIVS_RECD
USER_REPGROUP_PRIVILEGES



USER_ROLE_PRIVS
USER_SYS_PRIVS
USER_TAB_PRIVS
USER_TAB_PRIVS_MADE
USER_TAB_PRIVS_RECD


DBA_ROLE_PRIVS
ALL_ROLE_PRIVS


DBA_ROLE_PRIVS - Roles granted to users and roles
ROLE_ROLE_PRIVS - Roles which are granted to roles
ROLE_SYS_PRIVS - System privileges granted to roles
ROLE_TAB_PRIVS - Table privileges granted to roles


set heading off
set pages 0
set long 9999999
select dbms_metadata.get_granted_ddl('ROLE_GRANT', user)  from dual;
select dbms_metadata.get_granted_ddl('SYSTEM_GRANT', user)  from dual;
select dbms_metadata.get_granted_ddl('OBJECT_GRANT', user)  from dual;




select * from dba_role_privs where GRANTEE=<SCHEMA NAME>; ------------------ For DBA privillage roles
select * from dba_sys_privs where GRANTEE=<SCHEMA NAME>; -------------------- For system Privillages
select * from dba_tab_privs where GRANTEE=<SCHEMA NAME> and TABLE_NAME=<TABLE NAME>; --------------------- For table Privilllages



******************* Find the ROLES privillages ****************

select * from DBA_ROLE_PRIVS where role='ROLE NAME';
select * from ROLE_ROLE_PRIVS where role='ROLE NAME';
select * from ROLE_SYS_PRIVS where role='ROLE NAME';
select * from ROLE_TAB_PRIVS where role='ROLE NAME';





No comments:

Post a Comment