Sunday, December 6, 2020

Tablespace Check

 

Check tablespace

SELECT a.tablespace_name "表空間名",

   a.bytes / 1024 / 1024 "表空間大小(M)",

   (a.bytes - b.bytes) / 1024 / 1024 "已使用空間(M)",

   b.bytes / 1024 / 1024 "空閒空間(M)",

   round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "使用比"

   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

   

 

Query if tablespace auto-extend

select tablespace_name, file_name, autoextensible from dba_data_files

--where autoextensible <> 'YES';

No comments:

Post a Comment