zoukankan      html  css  js  c++  java
  • oracle表空间使用率查询sql

    SELECT UPPER(D.TABLESPACE_NAME) "Tablespace_name",
    D.TOT_GROOTTE_MB - nvl(F.TOTAL_BYTES,0) "Used(M)",
    D.TOT_GROOTTE_MB "Tablespace_size(M)",
    TO_CHAR(ROUND((D.TOT_GROOTTE_MB - nvl(F.TOTAL_BYTES,0)) / D.TOT_GROOTTE_MB * 100,
    2),
    '990.99') || '%' "Used%",
    nvl(F.TOTAL_BYTES,0) "Available_size(M)",
    decode(D.TOT_MAXBYTES_MB, 0, D.TOT_GROOTTE_MB, D.TOT_MAXBYTES_MB) "Max_Tablespace_size(M)",
    decode(D.TOT_MAXBYTES_MB,
    0,
    TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) /
    D.TOT_GROOTTE_MB * 100,
    2),
    '990.99') || '%',
    TO_CHAR(ROUND(((D.TOT_GROOTTE_MB - F.TOTAL_BYTES)) /
    D.TOT_MAXBYTES_MB * 100,
    2),
    '990.99') || '%') "Max_Used%",
    decode(D.TOT_MAXBYTES_MB, 0, D.TOT_GROOTTE_MB, D.TOT_MAXBYTES_MB) -
    (D.TOT_GROOTTE_MB - nvl(F.TOTAL_BYTES,0)) "Max_Available_size(M)"
    FROM (SELECT TABLESPACE_NAME,
    ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES
    FROM SYS.DBA_FREE_SPACE
    GROUP BY TABLESPACE_NAME) F,
    (SELECT DD.TABLESPACE_NAME,
    ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB,
    ROUND(SUM( decode(DD.MAXBYTES,0,DD.BYTES,DD.MAXBYTES)) / (1024 * 1024), 2) TOT_MAXBYTES_MB
    FROM SYS.DBA_DATA_FILES DD
    GROUP BY DD.TABLESPACE_NAME) D
    WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME(+)
    ORDER BY decode(D.TOT_MAXBYTES_MB,
    0,
    TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) /
    D.TOT_GROOTTE_MB * 100,
    2),
    '990.99') || '%',
    TO_CHAR(ROUND(((D.TOT_GROOTTE_MB - F.TOTAL_BYTES)) /
    D.TOT_MAXBYTES_MB * 100,
    2),
    '990.99') || '%') desc;

  • 相关阅读:
    CSS 整形与优化工具
    下面是小图,点一下上面就会出现大图
    javascript技巧大全
    div实现flash的遮照效果
    表格动态添加删除行
    云计算新模式将终结传统外包模式[转]
    源码过瑞星
    批处理创建、访问、重命名、删除畸形文件/文件夹
    //过360云查杀的代码
    NC反弹提权教程
  • 原文地址:https://www.cnblogs.com/Wardenking/p/10935281.html
Copyright © 2011-2022 走看看