Oracle查看錶空間使用方式

來源:互聯網
上載者:User

標籤:



查看錶空間使用方式


select upper(f.tablespace_name) "資料表空間名",
       d.tot_grootte_mb "資料表空間大小(m)",
       d.tot_grootte_mb - f.total_bytes "已使用空間(m)",
       to_char(round((d.tot_grootte_mb - f.total_bytes) / d.tot_grootte_mb * 100,
                     2),
               ‘990.99‘) "使用比",
       f.total_bytes "空暇空間(m)",
       f.max_bytes "最大塊(m)"
  from (select tablespace_name,
               round(sum(bytes) / (1024 * 1024), 2) total_bytes,
               round(max(bytes) / (1024 * 1024), 2) max_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
          from sys.dba_data_files dd
         group by dd.tablespace_name) d
 where d.tablespace_name = f.tablespace_name
 order by 4 desc;


查看錶空間中每一個表的大小

select segment_name, isize || ‘M‘
  from (select segment_name, sum(bytes) / 1024 / 1024 isize
          from dba_segments
         where tablespace_name = ‘SNBST_HIST‘
           AND segment_type = ‘TABLE‘
         GROUP BY segment_name)
 order by isize desc;


查看錶空間檔案使用大小

SELECT B.TABLESPACE_NAME 資料表空間,
       B.FILE_NAME 物理檔案名稱,
       B.BYTES / 1024 / 1024 大小M,
       (B.BYTES - SUM(NVL(A.BYTES, 0))) / 1024 / 1024 已使用M,
       SUBSTR((B.BYTES - SUM(NVL(A.BYTES, 0))) / (B.BYTES) * 100, 1, 5) 利用率
  FROM DBA_FREE_SPACE A, DBA_DATA_FILES B
 WHERE A.FILE_ID = B.FILE_ID
 GROUP BY B.TABLESPACE_NAME, B.FILE_NAME, B.BYTES
 ORDER BY B.TABLESPACE_NAME;

Oracle查看錶空間使用方式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.