Friday, September 5, 2014

Tablespace usage


SET LINES 150
SET pages 300
col "Tablespace" FOR a30
col "Total MB" FOR a15
col "Free MB" FOR a15
col "Used MB" FOR a15
col "% Used" FOR a15      
SELECT
  tablespace_name "Tablespace",
  d.STATUS "Status",
  TO_CHAR((a.bytes / 1048576),'99,999,990.900') "Total MB",
  TO_CHAR(((DECODE(f.bytes, NULL, 0, f.bytes)) / 1048576),'99,999,990.900') "Free MB",
  TO_CHAR(((a.bytes - DECODE(f.bytes, NULL, 0, f.bytes)) / 1048576),'99,999,990.900') "Used MB",
  TO_CHAR((((a.bytes - DECODE(f.bytes, NULL, 0, f.bytes)) / 1048576)*100) / (a.bytes / 1048576),'999,999.9') "% Used"
FROM
  (sys.dba_tablespaces d JOIN sys.sm$ts_avail a USING (tablespace_name))
  LEFT OUTER JOIN sys.sm$ts_free f USING (tablespace_name)
where tablespace_name='PSAPIDOCD'
ORDER BY 6
/

select file_name,bytes/(1024*1024*1024) from dba_data_files where tablespace_name='PSAPTF90' order by 1;

No comments:

Post a Comment