顯示資料庫表空間使用情況

2021-08-31 06:05:41 字數 2134 閱讀 3073

select sysdate "統計時間",d.tablespace_name "表空間名稱",

d.status "狀態",

d.contents "型別",

d.extent_management "區管理",

nvl(total.bytes, -1) "總容量(mb)",

nvl((total.bytes - free.bytes), -1) "已使用(mb)",

nvl(round((1 - free.bytes / total.bytes) * 100, 2), -1) "使用佔比",

total.autoextensible "自動增長",

total.increment_by "增長量",

total.file_name "檔案位址"

from sys.dba_tablespaces d,

(select tablespace_name,

round(nvl(sum(bytes) / 1024 / 1024, 0), 2) bytes,

file_name,

autoextensible,

increment_by

from dba_data_files

group by tablespace_name, file_name, autoextensible, increment_by) total,

(select tablespace_name,

round(nvl(sum(bytes) / 1024 / 1024, 0), 2) bytes

from dba_free_space

group by tablespace_name) free

where d.tablespace_name = total.tablespace_name(+)

and d.tablespace_name = free.tablespace_name(+)

and not

(d.extent_management like 'local' and d.contents like 'temporary')

union all

select sysdate,d.tablespace_name "表空間名稱",

d.status "狀態",

d.contents "型別",

d.extent_management "區管理",

nvl(total.bytes, -1) "總容量(mb)",

nvl((total.bytes - free.bytes), -1) "已使用(mb)",

nvl(round((1 - free.bytes / total.bytes) * 100, 2), -1) "使用佔比",

total.autoextensible "自動增長",

total.increment_by "增長量",

total.file_name "檔案位址"

from sys.dba_tablespaces d,

(select tablespace_name,

round(nvl(sum(bytes) / 1024 / 1024, 0), 2) bytes,

file_name,

autoextensible,

increment_by

from dba_temp_files

group by tablespace_name, file_name, autoextensible, increment_by) total,

(select tablespace_name,

round(nvl(sum(bytes_cached) / 1024 / 1024, 0), 2) bytes

from v$temp_extent_pool

group by tablespace_name) free

where d.tablespace_name = total.tablespace_name(+)

and d.tablespace_name = free.tablespace_name(+)

and d.extent_management like 'local'

and d.contents like 'temporary'

order by "表空間名稱";

監控資料庫表空間使用情況

1.按使用者查表空間使用情況 select a.tablespace name 表空間名稱,total space 1024 1024 總量,free space 1024 1024 剩餘量,trunc free space total space 100 剩餘比例 from select tabl...

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 ...