테이블 스페이스 용량조회
개발관련/DB관련(Oracle) :
2011. 5. 4. 14:05
select nvl(tablespace_name,'<<TOTAL>>') tablespace_name,
sum(megs_alloc) megs_alloc,
sum(megs_free) megs_free,
sum(megs_used) megs_used,
sum(Pct_Free) Pct_Free,
sum(Pct_used) Pct_used,
sum(Max) Max_siz
from (
select a.tablespace_name tablespace_name ,
trunc(round(a.bytes_alloc / 1024 / 1024, 2)) megs_alloc,
trunc(round(nvl(b.bytes_free, 0) / 1024 / 1024, 2)) megs_free,
trunc(round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2)) megs_used,
trunc(round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2)) Pct_Free,
trunc(100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2)) Pct_used,
trunc(round(maxbytes/1048576,2)) Max
from ( select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES',f.maxbytes,'NO', f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
( select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name (+)
union
select tablespace_name,
trunc(round(sum(bytes_used + bytes_free) / 1048576, 2)),
trunc(round(sum(bytes_free) / 1048576,2)),
trunc(round(sum(bytes_used) / 1048576,2)),
trunc(round((sum(bytes_free) / sum(bytes_used + bytes_free)) * 100,2)) Pct_Free,
trunc(100 - round((sum(bytes_free) / sum(bytes_used + bytes_free)) * 100,2)) Pct_used,
trunc(round(max(bytes_used + bytes_free) / 1048576, 2))
from sys.v_$TEMP_SPACE_HEADER
group by tablespace_name
order by 1
)
group by rollup(tablespace_name)
order by 1
sum(megs_alloc) megs_alloc,
sum(megs_free) megs_free,
sum(megs_used) megs_used,
sum(Pct_Free) Pct_Free,
sum(Pct_used) Pct_used,
sum(Max) Max_siz
from (
select a.tablespace_name tablespace_name ,
trunc(round(a.bytes_alloc / 1024 / 1024, 2)) megs_alloc,
trunc(round(nvl(b.bytes_free, 0) / 1024 / 1024, 2)) megs_free,
trunc(round((a.bytes_alloc - nvl(b.bytes_free, 0)) / 1024 / 1024, 2)) megs_used,
trunc(round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2)) Pct_Free,
trunc(100 - round((nvl(b.bytes_free, 0) / a.bytes_alloc) * 100,2)) Pct_used,
trunc(round(maxbytes/1048576,2)) Max
from ( select f.tablespace_name,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES',f.maxbytes,'NO', f.bytes)) maxbytes
from dba_data_files f
group by tablespace_name) a,
( select f.tablespace_name,
sum(f.bytes) bytes_free
from dba_free_space f
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name (+)
union
select tablespace_name,
trunc(round(sum(bytes_used + bytes_free) / 1048576, 2)),
trunc(round(sum(bytes_free) / 1048576,2)),
trunc(round(sum(bytes_used) / 1048576,2)),
trunc(round((sum(bytes_free) / sum(bytes_used + bytes_free)) * 100,2)) Pct_Free,
trunc(100 - round((sum(bytes_free) / sum(bytes_used + bytes_free)) * 100,2)) Pct_used,
trunc(round(max(bytes_used + bytes_free) / 1048576, 2))
from sys.v_$TEMP_SPACE_HEADER
group by tablespace_name
order by 1
)
group by rollup(tablespace_name)
order by 1
반응형
'개발관련 > DB관련(Oracle)' 카테고리의 다른 글
오라클 테이블, 컬럼, pk, comment, data type 조회 (0) | 2023.01.14 |
---|---|
date 타입과 timestamp 타입 조회 (0) | 2022.09.23 |
튜닝 연습 (0) | 2021.10.30 |
Oracle/PLSQL: Dealing with apostrophes/single quotes in strings (0) | 2011.06.15 |
파티셔닝 이용 시기 (0) | 2011.04.28 |