天天看點

ORACLE 檢視表空間使用率

SELECT a.tablespace_name tablespace_name,

       a.File_Name file_Name,

       a.status status,

       a.AutoExtensible AutoExtensible,

       TO_CHAR(NVL(a.bytes / 1024 / 1024, 0), '99G999G990D900') datafile_size,

       TO_CHAR(NVL(a.bytes - NVL(f.bytes, 0), 0) / 1024 / 1024, '99G999G990D900') used_size,

       TO_CHAR(NVL((a.bytes - NVL(f.bytes, 0)) / a.bytes * 100, 0), '990D00') used_percent

  FROM dba_data_files a,

       (select file_id, sum(bytes) bytes

          from dba_free_space

         group by File_id) f

 WHERE a.file_id = f.file_id(+)

 order by a.tablespace_name, a.File_id;

dba_data_files 替換為 dba_temp_files 則檢視臨時表空間