Databases 7 min read

Mastering Oracle Permission Views: Query Roles, Privileges, and Sessions

This guide explains the most commonly used Oracle permission‑view tables, shows how to list role assignments, object privileges, system privileges, session privileges, and role memberships, and demonstrates the impact of the WITH ADMIN OPTION through practical SQL examples.

ITPUB
ITPUB
ITPUB
Mastering Oracle Permission Views: Query Roles, Privileges, and Sessions

1. DBA_ROLE_PRIVS

This view lets you discover which roles a user or role possesses and which users/roles have been granted a particular role.

select * from DBA_ROLE_PRIVS where GRANTEE='FIRGTRS';

Result shows the GRANTEE, the GRANTED_ROLE and whether the grant includes ADMIN OPTION.

select * from DBA_ROLE_PRIVS where GRANTED_ROLE='GTRS_DMM_UPDATE_ROLE';

This query lists all users/roles that have received the specified role.

DBA_ROLE_PRIVS example
DBA_ROLE_PRIVS example

2. DBA_TAB_PRIVS

Despite its name, this view reports object‑level privileges, not only table privileges.

select GRANTOR,GRANTEE,TABLE_NAME,PRIVILEGE 
from DBA_TAB_PRIVS 
where TABLE_NAME='PAYAGENT' 
order by GRANTEE;

The output lists the grantor, grantee, object name and the specific privilege (INSERT, UPDATE, DELETE, SELECT, etc.).

DBA_TAB_PRIVS example
DBA_TAB_PRIVS example

3. DBA_SYS_PRIVS

This view shows which system privileges a user has.

select * from DBA_SYS_PRIVS where GRANTEE='FIRGTRS';

Typical columns are GRANTEE, PRIVILEGE and ADM (ADMIN OPTION flag).

DBA_SYS_PRIVS example
DBA_SYS_PRIVS example

4. ROLE_SYS_PRIVS

Lists system privileges granted to a role.

select * from ROLE_SYS_PRIVS where ROLE='DBA_SUPPORT';

Example output includes privileges such as SELECT ANY SEQUENCE and SELECT ANY DICTIONARY.

ROLE_SYS_PRIVS example
ROLE_SYS_PRIVS example

5. SESSION_PRIVS

Shows the system privileges currently active for the logged‑in user. select * from SESSION_PRIVS; Typical rows include CREATE SESSION, SELECT ANY SEQUENCE, SELECT ANY DICTIONARY, etc.

SESSION_PRIVS example
SESSION_PRIVS example

6. SESSION_ROLES

Lists all roles that are enabled for the current session. select * from SESSION_ROLES; Result includes roles such as DBA_SUPPORT, CONNECT, SELECT_CATALOG_ROLE, HS_ADMIN_ROLE.

SESSION_ROLES example
SESSION_ROLES example

7. WITH ADMIN OPTION (and WITH GRANT OPTION)

The ADMIN OPTION applies to system privileges. Users granted a privilege with ADMIN OPTION, or users holding GRANT ANY PRIVILEGE / GRANT ANY OBJECT PRIVILEGE, can further grant that privilege to others.

Example experiment:

Create two test users as DBA:

A105024@O02DMS1>create user testuser1 identified by test1;
A105024@O02DMS1>create user testuser2 identified by test2;

Grant CREATE SESSION to testuser1 without ADMIN OPTION:

A105024@O02DMS1>grant CREATE SESSION to testuser1;

Login as testuser1 and view its privileges: TESTUSER1@O02DMS1>select * from user_sys_privs; Result shows CREATE SESSION with ADM = NO.

Attempt to grant CREATE SESSION to testuser2 from testuser1 – fails with ORA‑01031 insufficient privileges because ADM is NO.

Grant CREATE SESSION to testuser1 with ADMIN OPTION:

A105024@O02DMS1>grant CREATE SESSION to testuser1 with admin option;

Re‑query user_sys_privs – ADM now shows YES.

Now testuser1 can successfully grant CREATE SESSION to testuser2:

TESTUSER1@O02DMS1>grant CREATE SESSION to testuser2;

For object privileges, the analogous clause is WITH GRANT OPTION.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLdatabaseOracleDBA
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.