oracle 查询表空间使用情况

SELECT a.tablespace_name "表空间名",
FILENUM 数据文件,
round(total / (1024 * 1024 * 1024),2) "表空间大小(G)",
round(free / (1024 * 1024 * 1024),2) "表空间剩余大小(G)",
round((total - free) / (1024 * 1024 * 1024),2) "表空间使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free FROM dba_free_space GROUP BY tablespace_name) a,
(SELECT tablespace_name,COUNT(FILE_ID) FILENUM,SUM(bytes) total FROM dba_data_files GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name;


select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';
select tablespace_name, bytes, user_bytes, user_bytes/bytes,file_name from dba_temp_files;

posted @ 2022-03-24 16:17  leihongnu  阅读(734)  评论(0编辑  收藏  举报