Query to check tablespace usage
Hello Guys,
I am using the query bellow to check the usage of tablespaces in my oracle DBs:
select t.tablespace_name, t.size_mb, f.free_mb, round((f.free_mb*100)/t.size_mb,2) percent_free
from (select tablespace_name, round(sum(bytes)/1024/1024,2) size_mb
from dba_data_files
group by tablespace_name) t,
(select tablespace_name, round(sum(bytes)/1024/1024,2) free_mb
from dba_free_space
group by tablespace_name) f
where t.tablespace_name=f.tablespace_name
order by percent_free desc;
We are using zabbix external scripts to check it ad-hoc and It failing because the time this query takes is more than 30 seconds, which is the limit for Zabbix.