作为DBA的日常工作之一,很有必要随时了解数据库的各个表空间的使用状况。
可以用下面的查询:

SELECT /* + RULE */
 dtfs.tablespace_name "Tablespace",
 dtfs.bytes / (1024 * 1024) "Size (MB)",
 SUM(frspc.bytes) / (1024 * 1024) "Free (MB)",
 Nvl(Round(SUM(frspc.bytes) * 100 / dtfs.bytes),1) "% Free",
 Round((dtfs.bytes - SUM(frspc.bytes)) * 100 / dtfs.bytes) "% Used"
FROM dba_free_space frspc,
 (SELECT tablespace_name,SUM(bytes) bytes
  FROM dba_data_files
  GROUP BY tablespace_name) dtfs
WHERE frspc.tablespace_name (+) = dtfs.tablespace_name
GROUP BY dtfs.tablespace_name,dtfs.bytes
Order by 4;

 得到的结果的例子:

Tablespace                      Size (MB)  Free (MB)     % Free     % Used
------------------------------ ---------- ---------- ---------- ----------
SYSTEM                                920     5.1875          1         99
SYSAUX                                990    54.9375          6         94
USERS                                   5     2.3125         46         54
UNDOTBS1                              295   259.6875         88         12

SQL>



相关文章:

  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2021-08-26
  • 2022-12-23
  • 2022-03-01
  • 2021-07-15
猜你喜欢
  • 2022-01-13
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2021-11-26
  • 2021-12-15
  • 2021-06-01
相关资源
相似解决方案