zoukankan      html  css  js  c++  java
  • DBA常用SQL之表空间与数据文件

    select t.tablespace_name, round(sum(bytes / (1024 * 1024)), 0) ts_size
      from dba_tablespaces t, dba_data_files d
     where t.tablespace_name = d.tablespace_name
     group by t.tablespace_name;
    1.查看表空间的名称及大小
    select a.tablespace_name,
           a.bytes / 1024 / 1024 "Sum MB",
           (a.bytes - b.bytes) / 1024 / 1024 "used MB",
           b.bytes / 1024 / 1024 "free MB",
           round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "percent_used"
      from (select tablespace_name, sum(bytes) bytes
              from dba_data_files
             group by tablespace_name) a,
           (select tablespace_name, sum(bytes) bytes, max(bytes) largest
              from dba_free_space
             group by tablespace_name) b
     where a.tablespace_name = b.tablespace_name
     order by ((a.bytes - b.bytes) / a.bytes) desc;
    2.查看表空间使用率
    select tablespace_name,
           file_id,
           file_name,
           STATUS,
           ONLINE_STATUS,
           round(bytes / (1024 * 1024), 0) total_space
      from dba_data_files
     order by tablespace_name;
    3.查看表空间物理文件的名称及大小
    select segment_name,
           tablespace_name,
           r.status,
           (initial_extent / 1024) InitialExtent,
           (next_extent / 1024) NextExtent,
           max_extents,
           v.curext CurExtent
      From dba_rollback_segs r, v$rollstat v
     Where r.segment_id = v.usn(+)
     order by segment_name;
    4.查看回滚段名称及大小
    select file_name,tablespace_name,autoextensible from dba_data_files
    5.查询表空间或数据文件自动扩展
    select df.tablespace_name name,
           df.file_name       "file",
           f.phyrds           pyr,
           f.phyblkrd         pbr,
           f.phywrts          pyw,
           f.phyblkwrt        pbw
      from v$filestat f, dba_data_files df
     where f.file# = df.file_id
     order by df.tablespace_name;
    6.监控表空间的 I/O 比例
  • 相关阅读:
    html基础
    jenkins+ant+git+android搭建笔记
    appiumforandroid从零安装笔记(forWindows)
    使用enterTextInWebElement处理qq授权页报“网络异常,请稍后再试”的解决方法
    自动化日志测试计划
    robotium4.2简化通过id操作view啦
    在windows平台捕获iOS设备控制台日志
    android抓包笔记
    [Leetcode] Move Zeros
    [8.3] Magic Index
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/5007888.html
Copyright © 2011-2022 走看看