檢視表空間使用情況sql語句

2021-06-27 08:34:55 字數 1794 閱讀 8286

select b.file_name 物理檔名,

b.tablespace_name 表空間,

b.bytes / 1024 / 1024 大小m,

(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用m,

substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率

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

order by b.tablespace_name;

select upper(f.tablespace_name) "表空間名",

d.tot_grootte_mb "表空間大小(g)",

d.tot_grootte_mb - f.total_bytes "已使用空間(g)",

to_char(round((d.tot_grootte_mb - f.total_bytes) / d.tot_grootte_mb * 100,

2),

'990.99') "使用比",

f.total_bytes "空閒空間(g)",

f.max_bytes "最大塊(g)"

from (select tablespace_name,

round(sum(bytes) / (1024 * 1024*1024), 2) total_bytes,

round(max(bytes) / (1024 * 1024*1024), 2) max_bytes

from sys.dba_free_space

group by tablespace_name) f,

(select dd.tablespace_name,

round(sum(dd.bytes) / (1024 * 1024*1024), 2) tot_grootte_mb

from sys.dba_data_files dd

group by dd.tablespace_name) d

where d.tablespace_name = f.tablespace_name

order by 4 desc;

--檢視當前使用者每個表占用空間的大小

select segment_name,sum(bytes)/1024/1024 from user_extents where bytes/1024/1024>10 group by segment_name;

select * from all_all_tables b where b.tablespace_name = 'system' and b.blocks > 1000;

select * from sys.idl_ub1$;

select *

from (select bytes, segment_name, segment_type, owner

from dba_segments

where tablespace_name = 'settledata'

order by bytes desc)

where rownum < 10;

select gname,dblink,masterdef,master from dba_repsites;

select gname,master,status from dba_repgroup;

檢視表空間使用情況

select upper a.tablespace name 表空間名 d.tot grootte mb 表空間大小 m d.tot grootte mb a.total bytes 已使用空間 m to char round d.tot grootte mb a.total bytes d.tot...

檢視表的空間使用情況

在 中,可以直接在表的屬性中看到表的大小和索引檔案大小,而後 中卻不能直接看到,需要用以下 來實現,其實o.name like 是用來篩選表的名字的 if not exists select from dbo.sysobjects where id object id n dbo tablespac...

Oracle檢視表空間使用情況

關鍵字 oracle檢視表空間使用情況 說明 下面是通用的sql語句 無需任何修改 如何使用 登陸乙個資料庫例項後,直接複製下面的sql語句並執行即可。登陸特定資料庫 sqlplus sys root as sysdba vwdb dba身份登陸 sqlplus sys root vwdb 普通使用...