SELECT FS.tablespace_name AS TSNAME,
(DF.total_space - FS.free_space) AS MB_USED,
FS.free_space AS MB_FREE,
DF.total_space AS MB_TOTAL,
to_char(round(100 * (FS.free_space / DF.total_space))) '%' AS PCT_FREE
FROM
(SELECT tablespace_name,
round(sum(bytes) / 1048576) "TOTAL_SPACE" -- Puede cambiarse 1048576 x POWER(1024,2) --MB
FROM dba_data_files
GROUP BY tablespace_name) DF,
(SELECT tablespace_name,
round(sum(bytes) / 1048576) "FREE_SPACE"
FROM dba_free_space
GROUP BY tablespace_name) FS
WHERE DF.tablespace_name = FS.tablespace_name
ORDER BY round(100 * (FS.free_space / DF.total_space)) DESC;
ALTER TABLESPACE
/
También cometí mi primer error!
Fue no considerar en mi script que los datafiles tienen una "property" de autoextend y eso hace que a pesar de que el tablespace este al 99% ocupado, no se lo categoricoe como un hecho critico ya que todavia es posible que el datafile tenga mucho espacio para "auto-extenderse". En todo caso deberia revisar que todavia que de espacio para extenderse.
No hay comentarios:
Publicar un comentario