Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does the database view the utilization of tablespaces

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Enter the oracle database and enter the following code

Select total.tablespace_name

Round (total.MB, 2) as Total_MB

Round (total.MB-free.MB, 2) as Used_MB

Round ((1-free.MB / total.MB) 100,2) | |'%'as Used_Pct

From (select tablespace_name, sum (bytes) / 1024 / 1024 as MB

From dba_free_space

Group by tablespace_name) free

(select tablespace_name, sum (bytes) / 1024 / 1024 as MB

From dba_data_files

Group by tablespace_name) total

Where free.tablespace_name = total.tablespace_name

SELECT a.tablespace_name, a.BYTES total, a.bytes-nvl (b.bytes, 0) free FROM (SELECT tablespace_name, SUM (bytes) bytes FROM dba_temp_files GROUP BY tablespace_name) a, (SELECT tablespace_name, SUM (bytes_cached) bytes FROM v$temp_extent_pool GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name (+)

SELECT temp_used.tablespace_name,total-used as "Free", total as "Total", round (nvl (total-used, 0) 100 / total, 3) "Free percent" FROM (SELECT tablespace_name, SUM (bytesused) / 1024 / 1024 used FROM GV$TEMP_SPACE_HEADER GROUP BY tablespace_name) temp_used, (SELECT tablespace_name, SUM (bytes) / 1024 / 1024 total FROM dba_temp_files GROUP BY tablespace_name) temp_total WHERE temp_used.tablespace_name = temp_total.tablespace_name

Those statements are waiting for temporary tablespaces

SELECT se.username,sid,serial#,sql_address,machine,program,tablespace,segtype,contents FROM v$session se, v$sort_usage su WHERE se.saddr = su.session_addr

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 257

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report