oracle查看表實際物理空間使用大小


http://www.2cto.com/database/201107/95313.html

一種是分配給一個表的物理空間數量,而不管空間是否被使用。可以這樣查詢獲得字節數:
select segment_name, bytes 
from user_segments 
where segment_type = 'TABLE';

 或

Select Segment_Name,Sum(bytes)/1024/1024 from User_Extents Group By Segment_Name;

另一種實際使用的空間

analyze table emp compute statistics; 
select num_rows * avg_row_len/1024/1024 "實際大小(M)"
from user_tables 
where table_name = 'EMP';--EMP為表名(表名大寫查詢) 

 

附:
查看每個表空間的大小
Select Tablespace_Name,Sum(bytes)/1024/1024 from Dba_Segments Group By Tablespace_Name 
1.查看剩余表空間大小
 
SELECT tablespace_name 表空間,sum(blocks*8192/1000000) 剩余空間M from dba_free_space GROUP BY tablespace_name;
 
2.檢查系統中所有表空間總體空間
select b.name,sum(a.bytes/1000000)總空間 from v$datafile a,v$tablespace b where a.ts#=b.ts# group by b.name;
 
3.查詢整個數據庫剩余和使用的表空間大小使用情況:
select df.tablespace_name "表空間名",totalspace "總空間M",freespace "剩余空間M",round((1-freespace/totalspace)*100,2) "使用率%" 
from 
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace 
from dba_data_files 
group by tablespace_name) df, 
(select tablespace_name,round(sum(bytes)/1024/1024) freespace 
from dba_free_space 
group by tablespace_name) fs 
where df.tablespace_name=fs.tablespace_name;
效果如下:
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM