表領域のサイズと自動拡張上限サイズ,割り当て済み空き領域,使用率をパーセントで取得するSQL文  

実行SQL文

サイズの単位は(KB)

SELECT dd.tablespace_name "表領域",
ROUND(total_bytes /1024/1024,1) "表領域のサイズ",
ROUND(maxbytes /1024/1024,1) "自動拡張上限サイズ",
ROUND((total_bytes - free) /1024/1024,1) "使用済みサイズ",
ROUND(free /1024/1024,1) "割当て済み空き領域",
ROUND((total_bytes-free) / total_bytes*100,1) "使用率(%)",
auto.AUTOEXTENSIBLE "自動拡張"
FROM (SELECT tablespace_name,
SUM(bytes) total_bytes,
SUM(maxbytes) maxbytes
 FROM DBA_data_files
 GROUP BY tablespace_name) dd,
(SELECT tablespace_name,
SUM(NVL(bytes,0)) free
 FROM DBA_free_space
 GROUP BY tablespace_name) df,
(select tablespace_name, AUTOEXTENSIBLE from dba_data_files) auto
WHERE dd.tablespace_name=df.tablespace_name(+)
and dd.tablespace_name=auto.tablespace_name(+);

実行結果

表領域  表領域のサイズ  自動拡張上限サイズ  使用済みサイズ  割当て済み空き領域 使用率(%) 自動拡張
- - - - -  - - - - - - - - -   - - - - - - - - - - - -  - - - - - - - - - -   - - - - - - - - - - -  - - - - -   - - - - - -
SYSAUX  516.9       32768           496.9        19.9        96.1   YES
UNDOTBS1  520      32768           23.1          496.9       4.4    YES
USERS  1067.7       32768           91.6        976.1         8.6    YES

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License