查詢表空間所有相關信息sql:select * from dba_data_files; dba_data_files視圖欄位說明 ...
1 SELECT UPPER(F.TABLESPACE_NAME) TABLESPACE_NAME, -- 表空間名, 2 D.TOT_GROOTTE_MB TOT_GROOTTE_MB, -- 表空間大小(G), 3 D.TOT_GROOTTE_MB - F.TOTAL_BYTES USEDMB, ---已使用空間(G), 4 TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100, 5 2), 6 '990.99') || '%' USAGERATIO, -- 使用比, 7 F.TOTAL_BYTES, -- 空閑空間(G), 8 D.MAXBYTES --表空間最大能擴到多大 9 FROM (SELECT TABLESPACE_NAME, 10 ROUND(SUM(BYTES) / (1024 * 1024 * 1024), 3) TOTAL_BYTES, 11 ROUND(MAX(BYTES) / (1024 * 1024 * 1024), 3) MAX_BYTES 12 FROM SYS.DBA_FREE_SPACE 13 GROUP BY TABLESPACE_NAME) F, 14 (SELECT DD.TABLESPACE_NAME, 15 ROUND(SUM(DD.BYTES) / (1024 * 1024 * 1024), 3) TOT_GROOTTE_MB, 16 ROUND(DD.MAXBYTES / (1024 * 1024 * 1024), 3) MAXBYTES 17 FROM SYS.DBA_DATA_FILES DD 18 GROUP BY DD.TABLESPACE_NAME, DD.MAXBYTES) D 19 WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME 20 ORDER BY 2 DESC
查詢表空間所有相關信息sql:select * from dba_data_files;
dba_data_files視圖欄位說明