代码之家  ›  专栏  ›  技术社区  ›  user840930

Oracle:当没有dba权限时,如何检查表空间使用的空间

  •  7
  • user840930  · 技术社区  · 11 年前

    我需要检查表空间使用的空间,但我没有dba权限。有办法做到这一点吗?

    1 回复  |  直到 11 年前
        1
  •  15
  •   mmmmmpie    11 年前

    不幸的是,没有对 dba_free_space dba_segments 查看用户默认表空间:

    SELECT
      ts.tablespace_name,
      TO_CHAR(SUM(NVL(fs.bytes,0))/1024/1024, '99,999,990.99') AS MB_FREE
    FROM
      user_free_space fs,
      user_tablespaces ts,
      user_users us
    WHERE
      fs.tablespace_name(+)   = ts.tablespace_name
    AND ts.tablespace_name(+) = us.default_tablespace
    GROUP BY
      ts.tablespace_name;
    

    如果您需要检查某个表空间的大小,而用户没有将其作为默认表空间,则必须返回DBA。
    使用系统表空间作为默认值进行测试:
    enter image description here
    将应用程序表空间作为默认表空间进行测试:
    enter image description here
    此模式没有dba视图上的查询:

    select * from dba_free_space;
    ORA-00942: table or view does not exist
    00942. 00000 -  "table or view does not exist"
    *Cause:    
    *Action:
    Error at Line: 13 Column: 15