【问题标题】:Retrieve all tables selectable by a user (in Oracle)检索用户可选择的所有表(在 Oracle 中)
【发布时间】:2011-12-12 19:48:35
【问题描述】:

如何检索用户具有 SELECT 权限(直接授予或通过分配的角色授予)的所有表的列表?

【问题讨论】:

    标签: oracle database-permissions


    【解决方案1】:
    select owner||'.'||table_name from user_tab_privs where privilege='SELECT'
    union 
    select rtp.owner||'.'||rtp.table_name from user_role_privs urp, role_tab_privs rtp
      where urp.granted_role = rtp.role and rtp.privilege='SELECT'
    union
    select user||'.'||table_name from user_tables;
    

    【讨论】:

      【解决方案2】:
      select table_name from TABLE_PRIVILEGES where grantee='USER' and select_priv='Y'
      union
      select table_name from  user_tables
      

      【讨论】:

      • 正是我需要的!谢谢。我不知道 TABLE_PRIVILEGES 存在。
      猜你喜欢
      • 2016-09-25
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 2021-10-22
      • 2013-04-12
      • 2019-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多