要查询Oracle数据库中表空间的信息,可以使用以下查询:
SELECT tablespace_name, file_name, bytes/1024/1024 AS "Size (MB)",
bytes/1024/1024 - (sum(nvl(bytes,0))/1024/1024) as "Used (MB)",
(sum(nvl(bytes,0))/1024/1024) as "Free (MB)",
round(sum(nvl(bytes,0))*100/sum(sum(nvl(bytes,0))) over(),2) as "Used %"
FROM dba_data_files
GROUP BY tablespace_name, file_name, bytes
ORDER BY tablespace_name;
这条查询语句将显示每个表空间的名称,文件名,大小(以MB为单位),已使用空间(以MB为单位),剩余空间(以MB为单位)和已使用的百分比。