zoukankan      html  css  js  c++  java
  • oracle 查询 磁盘使用率

     SELECT d.tablespace_name "Name",
            TO_CHAR(NVL(a.bytes / 1024 / 1024 / 1024, 0), '99,999,990') Size_GB,
            TO_CHAR(NVL(a.bytes - NVL(f.bytes, 0), 0) / 1024 / 1024 / 1024,
                    '999,999,999') Used_GB,
            TO_CHAR(NVL(f.bytes / 1024 / 1024 / 1024, 0), '99,999,990') Free_GB,
            TO_CHAR(NVL((a.bytes - NVL(f.bytes, 0)) / a.bytes * 100, 0),
                    '990.00') "% USED",
            TO_CHAR(NVL(f.bytes / a.bytes * 100, 0), '990.00') "% FREE"
       FROM sys.dba_tablespaces d,
            (select tablespace_name, sum(bytes) bytes
               from dba_data_files
              group by tablespace_name) a,
            (select tablespace_name, sum(bytes) bytes
               from dba_free_space
              group by tablespace_name) f
      WHERE d.tablespace_name = a.tablespace_name(+)
        AND d.tablespace_name = f.tablespace_name(+)
        AND NOT
             (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')
        and TO_CHAR(NVL((a.bytes - NVL(f.bytes, 0)) / a.bytes * 100, 0),
                    '990.00') > 80
      ORDER BY 5 DESC;

    ---或者

    SELECT A.TABLESPACE_NAME,
           round(A.BYTES / 1024 / 1024 / 1024, 3) TOTAL_GB,
           round(B.BYTES / 1024 / 1024 / 1024, 3) USED_GB,
           round(C.BYTES / 1024 / 1024 / 1024, 3) FREE_GB,
           round((B.BYTES * 100) / A.BYTES, 3) "% USED",
           round((C.BYTES * 100) / A.BYTES, 3) "% FREE"
      FROM SYS.SM$TS_AVAIL A, SYS.SM$TS_USED B, SYS.SM$TS_FREE C
     WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME
       AND A.TABLESPACE_NAME = C.TABLESPACE_NAME
       and (B.BYTES * 100) / A.BYTES > 80;

  • 相关阅读:
    SQL学习_WHERE 数据过滤
    SQL学习_SELECT
    读书笔记之_Win10 与Jmeter5.1.1界面兼容:
    appium+python搭建自动化测试框架_TestAPP框架(三)
    appium+python搭建自动化测试框架_Tools安装(一)
    总目录
    解决IntelliJ IDEA卡顿的方法
    SQL Server
    OBDC无法创建sql server连接
    常见问题
  • 原文地址:https://www.cnblogs.com/ss-33/p/8706960.html
Copyright © 2011-2022 走看看