Tuesday, May 20, 2014

session_privs and session_roles

So my friend was getting 'SYS.DBA_IND_COLUMNS table does not exit' while he was trying to run

desc dba_ind_coulmns

I was able to run the same query. So of course we are in the territory of authorizations. But how do I prove it?

Then can session_privs and session_roles into picture. For me the result was

SQL> select * from session_privs;

PRIVILEGE
----------------------------------------
CREATE SESSION
ALTER SESSION
SELECT ANY TABLE
SELECT ANY SEQUENCE

SQL> select * from session_roles;

ROLE
------------------------------
CONNECT
SELECT_CATALOG_ROLE
HS_ADMIN_ROLE
HS_ADMIN_SELECT_ROLE
HS_ADMIN_EXECUTE_ROLE
ADHOC

6 rows selected.

His user has more privilege but less roles.

For him the role was ADHOC_DML and no admin table roles and hence it was proved why he got 'table does not exist' error.

Another interesting table to know is v$session.

select SID,MACHINE,USERNAME from V$SESSION;

No comments: