Oracle 檢視表空間使用率 SQL 指令碼

2021-08-26 22:24:08 字數 1776 閱讀 2136

sql 語句:

/* formatted on 2012/5/31 14:51:13 (qp5 v5.185.11230.41888) */ select d.tablespace_name, space || 'm' "sum_space(m)", blocks "sum_blocks", space - nvl (free_space, 0) || 'm' "used_space(m)", round ( (1 - nvl (free_space, 0) / space) * 100, 2) || '%' "used_rate(%)", free_space || 'm' "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 || 'm' "sum_space(m)", blocks sum_blocks, used_space || 'm' "used_space(m)", round (nvl (used_space, 0) / space * 100, 2) || '%' "used_rate(%)", nvl (free_space, 0) || 'm' "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(+) order by 1;

效果如下:

**需要在備註說明

oracle

表空間和資料檔案的關係,否則拒絕申請

----

dba1 群:62697716(滿); dba2 群:62697977(滿)dba3 群:62697850(滿)

dba 超級群:63306533(滿); dba4 群:83829929 dba5群: 142216823

dba6 群:158654907 dba7 群:172855474 dba總群:104207940

ORACLE檢視表空間使用率

之前寫程式需要實現乙個查詢資料庫表空間使用率的功能,雖然不知道做它的意義有多大,專案要求就得做。寫了乙個,只能查到永久表空間,temp表空間不知道怎麼查詢,今天上網找了找,把sql補充完整了,其實都是找來現有的資源用的,收藏一下。select from select a.tablespace nam...

oracle檢視表空間使用率及擴容

oracle表空間使用率檢視,首先登入,sysdba使用者,select tablespace name 表空間 to char round bytes 1024,2 99990.00 實有 to char round free 1024,2 99990.00 g 現有 to char round ...

檢視 Oracle 表空間使用率

1 用到了 sys.dba free space sys.dba data files 兩個檢視,需要被賦予在這兩個檢視物件上的查詢許可權。connect as sysdba grant select on sys.dba free space to forrest grant select on ...