SELECT a.file_id 文件号,
a.tablespace_name 表空间名称,
b.file_name 物理文件名,
b.autoextensible 自动扩展,
b.maxbytes/1024/1024/1024 最大空间G,
total/1024/1024 表空间MB,
free/1024/1024 剩余MB,
(total - free)/1024/1024 使用MB,
ROUND((total - free) / total, 4) * 100 "使用率 %" ,
'alter database datafile '''||file_name||''' resize 5120M;' 扩展表空间SQL语句
FROM (SELECT file_id,tablespace_name, SUM(bytes) free
FROM DBA_FREE_SPACE
GROUP BY file_id,tablespace_name) a,
(SELECT file_id,tablespace_name,autoextensible,file_name,maxbytes,SUM(bytes) total
FROM DBA_DATA_FILES
GROUP BY tablespace_name,file_id,autoextensible,file_name,maxbytes) b
WHERE a.tablespace_name = b.tablespace_name
AND a.file_id = b.file_id
ORDER BY 1;
a.tablespace_name 表空间名称,
b.file_name 物理文件名,
b.autoextensible 自动扩展,
b.maxbytes/1024/1024/1024 最大空间G,
total/1024/1024 表空间MB,
free/1024/1024 剩余MB,
(total - free)/1024/1024 使用MB,
ROUND((total - free) / total, 4) * 100 "使用率 %" ,
'alter database datafile '''||file_name||''' resize 5120M;' 扩展表空间SQL语句
FROM (SELECT file_id,tablespace_name, SUM(bytes) free
FROM DBA_FREE_SPACE
GROUP BY file_id,tablespace_name) a,
(SELECT file_id,tablespace_name,autoextensible,file_name,maxbytes,SUM(bytes) total
FROM DBA_DATA_FILES
GROUP BY tablespace_name,file_id,autoextensible,file_name,maxbytes) b
WHERE a.tablespace_name = b.tablespace_name
AND a.file_id = b.file_id
ORDER BY 1;