oracle数据库表空间使用率查询

   2024-10-06 9830
核心提示:To check the tablespace usage in an Oracle database, you can query the DBA_TABLESPACES view. Here is an example SQL quer

To check the tablespace usage in an Oracle database, you can query the DBA_TABLESPACES view. Here is an example SQL query that will show the usage of each tablespace in the database:

SELECT tablespace_name,       ROUND((1 - (free_space / total_space)) * 100, 2) AS used_percentFROM  (SELECT tablespace_name,          SUM(bytes) / 1024 / 1024 AS total_space,          SUM(maxbytes) / 1024 / 1024 AS max_space,          SUM(bytes - decode(autoextensible, 'YES', maxbytes, bytes)) / 1024 / 1024 AS free_space   FROM dba_data_files   GROUP BY tablespace_name);

This query will return the name of each tablespace in the database along with the percentage of space that is currently being used. The used_percent column will show how much of each tablespace is currently in use.

 
举报打赏
 
更多>同类物流大全
推荐图文
推荐物流大全
点击排行

网站首页  |  关于我们  |  联系方式 | 网站留言    |  赣ICP备2021007278号