作為DBA的我們,可能每個人都對自己管理的DB有一種自己認為方便的方法來檢查一些日常事務,下面列出一個我自己用于查看表空間是否快達到上限,然后根據數據的增長情況作出何時需增加datafile的決定,為了便于我們的管理,我通常在一個tablespace中設一個datafile為可擴展。這樣便于查看也便于管理,下面列出我自己日常使用的sql:
--查看可擴展的數據文件是否已達到擴展上限
--每個 tablespace 最好僅設一個可擴展的 Datafile
--我們只要看EXT_M這個column就可以知道是否快到上限了
select t.tablespace_name tbs_name,
t.maxbytes / (1024 * 1024) Max_M,
(t.maxbytes - t.bytes) / (1024 * 1024) + f.max_free_m Ext_M,
t.bytes / (1024 * 1024) Now_M,
f.free_m Free_M,
f.max_free_m,
t.file_name
from dba_data_files t,
(SELECT file_id,
trunc(sum(bytes) / (1024 * 1024)) as Free_M,
trunc(max(bytes) / (1024 * 1024)) as Max_Free_M
FROM dba_free_space
group by file_id) f
where t.file_id = f.file_id and t.autoextensible = 'YES'
order by ext_m
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29987/viewspace-51722/
,如需转载,请注明出处,否则将追究法律责任。