Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5838035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:25:30+00:00 2026-05-22T11:25:30+00:00

Given a Oracle normal(not DBA) user I need to find what objects which are

  • 0

Given a Oracle normal(not DBA) user I need to find what objects which are not owned by the user he has permissions on and how it was granted(through what role or direct grant).

Can you write a simple script for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:25:30+00:00Added an answer on May 22, 2026 at 11:25 am

    I think this should get you pretty much what you need. ALL_TAB_PRIVS is available to all users in the database and lists all objects that the user performing the SELECT has permissions on, what the permission is, and who granted it. I’ve joined it to another view, ROLE_TAB_PRIVS, to find the role that granted the privilege to the user, if any. If the user was granted permissions via a role and a direct grant, both are listed.

    SELECT atp.grantor, atp.privilege,
           CASE WHEN NVL(rtp.role,'NULL') <> atp.grantee THEN atp.grantee
                ELSE atp.grantee||' (ROLE)'
           END grantee, atp.table_name
      FROM all_tab_privs atp LEFT JOIN role_tab_privs rtp 
                             ON (atp.table_name = rtp.table_name AND 
                                 atp.table_schema = rtp.owner)
     WHERE grantor <> 'SYS'    /* Optional - filter out SYS owned objects */
    UNION ALL
    SELECT owner, 'SELECT' /* Assume SELECT */, NULL, view_name||' (VIEW)'
      FROM all_views
     WHERE owner <> 'SYS' /* Optional - filter out SYS owned views */
    ORDER BY 1,3;
    

    EDIT:

    ALL_TAB_PRIVS is a bit of a misnomer, as it includes PL/SQL executable objects as well.

    EDIT 2:

    It appears that this leaves out views. You could union the all_views results with the above query to give all the views you have some sort of access to, although I’m not sure at the moment how to give you the exact privileges you have been granted on the views.

    A word of warning: including all the SYS objects you have access gives you a rather voluminous list. You may wish to filter out objects belonging to SYS, as I’ve shown here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an oracle function which is given below. when I run this in
Given: Oracle 10.2g is the database I have a table called emp. emp has
Using Oracle SQL Developer I'm trying to access a given package that has been
To find a specific date after some given date in SQL oracle. Example: Date
In Oracle SQL, I wish to find all user names,whose Last name contains some
I have a table (in Oracle 9 and up) where I need to find
By using normal minus '-' function between two timestamps, the answer given from oracle
This is a question I could not answer in oracle lab exam. Given the
I log into Oracle using my own user account, which we can call my_account
Given an Oracle table created using the following: CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.