表空間使用情況統計

2021-08-20 14:34:02 字數 849 閱讀 9277

--表空間剩餘空間查詢,以system使用者身份登入或具有dba許可權的使用者執行:

select tbs as 表空間名稱,

sum(totalm) as 空間合計m,

sum(usedm) as 已使用空間,

sum(remainedm) as 剩餘空間m,

sum(usedm) / sum(totalm) * 100 as 已使用空間百分比,

sum(remainedm) / sum(totalm) * 100 as 剩餘空間百分比

from (select b.file_id id,

b.tablespace_name as tbs,

b.file_name as name,

b.bytes / 1024 / 1024 as totalm,

(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 as usedm,

sum(nvl(a.bytes, 0)) / 1024 / 1024 as remainedm,

sum(nvl(a.bytes, 0)) / (b.bytes) * 100 as 剩餘百分比,

(100 - (sum(nvl(a.bytes, 0)) / (b.bytes) * 100)) as 已使用百分比

from dba_free_space a, dba_data_files b

where a.file_id = b.file_id

group by b.tablespace_name, b.file_name, b.file_id, b.bytes

order by b.tablespace_name)

group by tbs;

查詢表空間使用情況

select owner,tablespace name,segment name,segment type,sum bytes 1024 1024 sums from dba extents where owner nbcheck and segment type table group by o...

檢視oracle表空間使用情況

dba free space 描述資料空間的剩餘大小 dba data file 描述資料表空間的總大小 select a.tablespace name,a.bytes bytes used,b.largest,round a.bytes b.bytes a.bytes 100,2 percent...

查詢oracle表空間使用情況

1.查詢表空間所在物理路徑及使用情況.select b.file id 檔案id,b.tablespace name 表空間,b.file name 物理檔名,b.bytes 總位元組數,b.bytes sum nvl a.bytes,0 已使用,sum nvl a.bytes,0 剩餘,sum n...