반응형

-- user 테이블별 사이즈
select segment_type, segment_name, tablespace_name,
SUM(TRUNC(BYTES/(1024*1024), 2)) as "size in MB"
from dba_segments
where segment_type in ('TABLE', 'TABLE PARTITION', 'TABLE SUBPARTITION')
and owner in ('조회하고하는 유저 입력')
group by segment_type,
segment_name, tablespace_name;

 

 

--테이블별 사이즈
select owner, segment_type, segment_name, tablespace_name,
SUM(TRUNC(BYTES/(1024*1024), 2)) as "size in MB"
from dba_segments
where segment_type in ('TABLE', 'TABLE PARTITION', 'TABLE SUBPARTITION')
and segment_name in ('테이블명')
group by owner,segment_type,
segment_name, tablespace_name;

 

-- 파티션 테이블 용량 산출
select owner, segment_type, segment_name, tablespace_name,PARTITION_NAME,
SUM(TRUNC(BYTES/(1024*1024), 2)) as "size in MB"
from dba_segments
where segment_type in ('TABLE', 'TABLE PARTITION', 'TABLE SUBPARTITION')
and segment_name = '테이블명'
AND PARTITION_NAME BETWEEN 'P202111' AND  'P202204'
group by owner,segment_type,
segment_name, tablespace_name,PARTITION_NAME;

+ Recent posts