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

    sqlplus -s / as sysdba<<EOF
    set trimspool on
    set linesize 10000
    set pagesize 50000
    set heading on
    set term off
    set heading on
    set feedback off;
    set newp none;
    set echo off
    set markup html on
    spool on
    spool xj.xls
    --表空间使用率查询:

    select t.tablespace_name,t.total,f.free,(t.total - f.free) / t.total * 100 used_percent
    from
    (select a.tablespace_name,sum(a.bytes/1024/1024) total
    from dba_data_files a
    group by a.tablespace_name
    ) t,
    (select b.tablespace_name,sum(b.bytes/1024/1024) free
    from dba_free_space b
    group by b.tablespace_name
    ) f
    where t.tablespace_name = f.tablespace_name
    ;

    --临时表空间使用率查询(gv_$temp_space_header视图需要使用sys用户查看)

    select a.tablespace_name,b.total,a.used,a.used / b.total * 100 used_percent,
           a.free,a.free / b.total * 100 free_percent
    from
    (select tablespace_name,sum(bytes_used/1024/1024) used,sum(bytes_free/1024/1024) free
    from gv_$temp_space_header
    group by tablespace_name
    ) a,
    (select tablespace_name,sum(bytes/1024/1024) total
    from dba_temp_files
    group by tablespace_name
    ) b
    where a.tablespace_name = b.tablespace_name
    ;
    spool off
    EOF

  • 相关阅读:
    css水平垂直居中
    JavaScript提供了哪几种“异步模式”?
    sort()
    后端开发中,可以在Cache-Control设置的常用指令
    纯函数
    react和vue
    npm(classnames) 更灵活使用类名
    shell知多少?
    常见的HTTP状态码
    axios
  • 原文地址:https://www.cnblogs.com/sisier/p/4795113.html
Copyright © 2011-2022 走看看