May 17, 2026, 11:40 PM
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
METHOD:1
|
||||
|
||||
select distinct
|
||||
a.tablespace_name,
|
||||
SUM(a.bytes)/1024/1024 "Used Size MB",
|
||||
SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)) "Max Size Mb",
|
||||
(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024)) "Total Used MB",
|
||||
(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)) - (SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))) "Total Free MB",
|
||||
round(100*(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))/(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)))) "Used Percentage"
|
||||
from
|
||||
dba_data_files a,
|
||||
sys.filext$ b,
|
||||
(SELECT d.tablespace_name , sum(nvl(c.bytes,0)) "Free" FROM dba_tablespaces d,DBA_FREE_SPACE c where d.tablespace_name = c.tablespace_name(+) group by d.tablespace_name) c
|
||||
where a.file_id = b.file#(+)
|
||||
and a.tablespace_name = c.tablespace_name
|
||||
GROUP by a.tablespace_name, c."Free"/1024
|
||||
order by round(100*(SUM(a.bytes)/1024/1024 - round(c."Free"/1024/1024))/(SUM(decode(b.maxextend, null, A.BYTES/1024/1024, b.maxextend*8192/1024/1024)))) desc/
|
||||
|
||||
METHOD:2
|
||||
|
||||
|
||||
select substr(A.tablespace_name,1,16) "Tablespace",
|
||||
MAX(A.contents) "Type",
|
||||
MAX(A.status) "Status",
|
||||
MAX(A.initial_extent)/1024 "Initial extent(Kb)",
|
||||
MAX(A.next_extent)/1024 "Next extent(Kb)",
|
||||
MAX(A.max_extents) "Max extents",
|
||||
MAX(A.pct_increase) "Pct_increase",
|
||||
(SUM(B.BYTES)*COUNT(DISTINCT B.FILE_ID)/COUNT(B.FILE_ID)/1024/1024)-(ROUND(SUM(C.BYTES)/1024/1024/COUNT(DISTINCT B.FILE_ID))) "USED SIZE(Mb)",
|
||||
(SUM(B.BLOCKS)*COUNT(DISTINCT B.FILE_ID)/COUNT(B.FILE_ID))-(SUM(C.BLOCKS)/COUNT(DISTINCT B.FILE_ID)) "USED BLOCKS",
|
||||
TO_CHAR(100-(SUM(C.BLOCKS)*100*COUNT(B.FILE_ID)/(SUM(B.BLOCKS)*COUNT(DISTINCT B.FILE_ID)))/COUNT(DISTINCT B.FILE_ID),'999.99')||'%' "USED USAGE",
|
||||
ROUND(SUM(C.BYTES)/1024/1024/COUNT(DISTINCT B.FILE_ID)) "FREE SIZE(MB)",
|
||||
SUM(C.BLOCKS)/COUNT(DISTINCT B.FILE_ID) "FREE BLOCKS",
|
||||
TO_CHAR((SUM(C.BLOCKS)*100*COUNT(B.FILE_ID)/(SUM(B.BLOCKS)*COUNT(DISTINCT B.FILE_ID)))/COUNT(DISTINCT B.FILE_ID),'999.99')||'%' "FREE USAGE",
|
||||
SUM(B.BYTES)*COUNT(DISTINCT B.FILE_ID)/COUNT(B.FILE_ID)/1024/1024 "TOTAL SIZE(Mb)",
|
||||
SUM(B.BLOCKS)*COUNT(DISTINCT B.FILE_ID)/COUNT(B.FILE_ID) "TOTAL BLOCKS"
|
||||
from dba_tablespaces A,
|
||||
DBA_DATA_FILES B,
|
||||
DBA_FREE_SPACE C
|
||||
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME
|
||||
AND A.TABLESPACE_NAME=C.TABLESPACE_NAME
|
||||
GROUP BY A.TABLESPACE_NAME
|
||||
order by 1
|
||||
Reference in New Issue
Block a user