阅读量:3
可以使用以下SQL语句来查看表空间的大小及使用情况:
- 查看表空间的总大小、已使用空间和剩余空间:
SELECT tablespace_name,
ROUND(SUM(bytes) / 1024 / 1024, 2) AS total_space_mb,
ROUND(SUM(bytes - decode(maxbytes, 0, bytes, maxbytes)) / 1024 / 1024, 2) AS used_space_mb,
ROUND(SUM(decode(maxbytes, 0, bytes, maxbytes) - bytes) / 1024 / 1024, 2) AS free_space_mb
FROM dba_data_files
GROUP BY tablespace_name;
- 查看每个数据文件的使用情况:
SELECT file_name,
tablespace_name,
ROUND(bytes / 1024 / 1024, 2) AS file_size_mb,
ROUND(bytes - decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024, 2) AS used_space_mb,
decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024 AS max_space_mb,
autoextensible,
status
FROM dba_data_files;
- 查看每个表空间的数据文件及其使用情况:
SELECT tablespace_name,
file_name,
ROUND(bytes / 1024 / 1024, 2) AS file_size_mb,
ROUND(maxbytes / 1024 / 1024, 2) AS max_size_mb,
ROUND(bytes - decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024, 2) AS used_space_mb,
decode(maxbytes, 0, bytes, maxbytes) / 1024 / 1024 AS max_space_mb,
autoextensible,
status
FROM dba_data_files;
以上就是关于“oracle如何查看表空间大小及使用情况”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm