SQL to check the free space allocated for a user who doesn’t have DBA access in oracle 12c

半腔热情 提交于 2019-12-25 08:31:35

问题


SQL to check the free space allocated for a user who doesn’t have DBA access. preciously in oracle 11G it was possible to use the “user_free_space” View but from oracle 12 c this view access is restricted to DBA users. (source: Release changes)

   SELECT ufs.tablespace_name ,(SUM(bytes) /(1024*1024)) AS FREESPACE
    FROM user_free_space ufs
    WHERE EXISTS
      (SELECT DISTINCT tablespace_name
      FROM all_tables
      WHERE tablespace_name  IS NOT NULL
      AND ufs.tablespace_name = tablespace_name
      AND tablespace_name     =
        (SELECT DEFAULT_TABLESPACE FROM USER_USERS WHERE USERNAME ='USER1'
        )
      )
    GROUP BY tablespace_name;

Please advise?

来源:https://stackoverflow.com/questions/41437972/sql-to-check-the-free-space-allocated-for-a-user-who-doesn-t-have-dba-access-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!