一线运维 DBA 五年经验常用 SQL 大全(一)
1.查看表空间使用率。
set line 220
select total.tablespace_name,round(total.MB, 2) as Total_MB,round(total.MB - free.MB, 2) as Used_MB,round((1 - free.MB / total.MB) * 100, 2) || ‘%’ as Used_Pct
from (select tablespace_name,sum(bytes) / 1024 / 1024 as MB from dba_free_space group by tablespace_name) free,
(select tablespace_name,sum(bytes) / 1024 / 1024 as MB from dba_data_files group by tablespace_name) total
where free.tablespace_name = total.tablespace_name order by used_pct desc;
1.1查询单个表空间使用率。
select total.tablespace_name,
round(total.MB, 2) as Total_MB,
round(total.MB - free.MB, 2) as Used_MB,
round((1 - free.MB / total.MB) * 100, 2) || ‘%’ as Used_Pct from
(select tablespace_
一线运维 DBA 五年经验常用 SQL 大全
于 2022-12-16 13:53:51 首次发布