1.按使用者查表空間使用情況
select a.tablespace_name 表空間名稱,total_space/(1024*1024) 總量,free_space/(1024*1024) 剩餘量,
trunc((free_space/total_space)*100)||'%' 剩餘比例
from
(select tablespace_name,sum(bytes) free_space from dba_free_space
group by tablespace_name) a,
(select tablespace_name,sum(bytes) total_space from dba_data_files
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name order by (free_space/total_space )
2.查詢某個使用者的表占用空間大小
select segment_name,segment_type,tablespace_name,bytes,initial_extent,
next_extent from dba_segments where owner='cal' order by bytes desc;
3.監控資料庫表空間使用情況
select d.tablespace_name,space "sum_space(m)",blocks sum_blocks,space-nvl(free_space,0) "used_space(m)",
round((1-nvl(free_space,0)/space)*100,2) "used_rate(%)",free_space "free_space(m)"
from (select tablespace_name,round(sum(bytes)/(1024*1024),2) space,sum(blocks) blocks from dba_data_files group by tablespace_name) d,
(select tablespace_name,round(sum(bytes)/(1024*1024),2) free_space from dba_free_space group by tablespace_name) f
where d.tablespace_name = f.tablespace_name(+)
union all
select d.tablespace_name,space "sum_space(m)",blocks sum_blocks,used_space "used_space(m)",
round(nvl(used_space,0)/space*100,2) "used_rate(%)",nvl(free_space,0) "free_space(m)"
from (select tablespace_name,round(sum(bytes)/(1024*1024),2) space,sum(blocks) blocks from dba_temp_files group by tablespace_name) d,
(select tablespace_name,round(sum(bytes_used)/(1024*1024),2) used_space,round(sum(bytes_free)/(1024*1024),2) free_space
from v$temp_space_header group by tablespace_name) f
where d.tablespace_name=f.tablespace_name(+);
顯示資料庫表空間使用情況
select sysdate 統計時間 d.tablespace name 表空間名稱 d.status 狀態 d.contents 型別 d.extent management 區管理 nvl total.bytes,1 總容量 mb nvl total.bytes free.bytes 1 已使...
sybase 資料庫空間使用情況
1 檢視資料庫空間情況 sp spaceused sp spaceused syslogs 日誌空間 2 檢視資料庫裝置各段空間情況 sp helpsegment sp helpsegment index segment 索引剩餘空間 sp helpsegment system 系統剩餘空間 sp ...
表空間使用情況統計
表空間剩餘空間查詢,以system使用者身份登入或具有dba許可權的使用者執行 select tbs as 表空間名稱,sum totalm as 空間合計m,sum usedm as 已使用空間,sum remainedm as 剩餘空間m,sum usedm sum totalm 100 as ...