HWM 확인 및 Resize 예상치 확인
* move & rebuild 작업 이후 HWM 줄어든 것을 확인 하기 위함
사용률 계산 식은 아래와 같음. 마지막 줄에 계산하는 쿼리 넣었음
filed_id 명 확인
select ','''||file_id||'''',
tablespace_name,
autoextensible,
bytes/1024/1024 MB,
MAX(bytes/1024/1024) "maxextendM"
FROM DBA_DATA_FILES
where tablespace_name = 'TBS_PARI_PART'
group by file_id, tablespace_name, autoextensible, byteS
order by 3,4 desc
filed_id 명으로 마지막 block_id, blocks 확인
#
select FILE_ID, block_id, blocks from dba_extents where file_id IN ('236')
order by block_id DESC ;
#
select a.file_id, a.block_id, a.blocks
from dba_extents a ,
(select file_id, max(block_id) as bi from dba_extents
where file_id IN (
'55'
,'7'
,'23'
,'65'
,'37'
,'72'
,'81'
)
group by file_id
order by file_id DESC) b
where a.file_id = b.file_id
and a.block_id = b.bi
(마지막 block_id * block_size) + (마지막 block * block_size)
= ((9984 * 8192) + (8 * 8192)) /1024/1024
= (81788928 + 65536) / 1024/1024
= 81854464 /1024/1024
= 78.06
alter database datafile '/u01/app/oracle/oradata/orcl/tbs_d_01.dbf' resize 78M
=> error
alter database datafile '/u01/app/oracle/oradata/orcl/tbs_d_01.dbf' resize 79M
성공
1. 조금 자세히 나옴
SELECT A.TABLESPACE_NAME,
B.MAX_BLOCK_ID,
B.ID,
A.BLOCKS,
ROUND(((B.MAX_BLOCK_ID+A.BLOCKS)/1024/1024)*8192, 2) HWM_MB
FROM DBA_EXTENTS A,
(SELECT MAX(BLOCK_ID) MAX_BLOCK_ID,
FILE_ID ID
FROM DBA_EXTENTS
WHERE TABLESPACE_NAME in ('Input Tablespace Name')
GROUP BY FILE_ID) B
WHERE A.BLOCK_ID=B.MAX_BLOCK_ID
AND A.FILE_ID=B.ID;
2. 1번 쿼리가 느리면 이 쿼리로 수행
SELECT ROUND((MAX(BLOCK_ID)/1024/1024)*8192,2) MAX_BLOCK_ID,
FILE_ID ID
FROM DBA_EXTENTS
WHERE TABLESPACE_NAME in ('Input Tablespace Name')
GROUP BY FILE_ID;
'Oracle > tablespace' 카테고리의 다른 글
tablespace (0) | 2022.01.25 |
---|