OS환경 : Oracle Linux 7.6 (64bit)
DB 환경 : Oracle Database 19.10.0.0
방법 : 오라클 19c asm usable_file_mb -(음수) 됬을때 조치방법
asm 환경의 오라클을 운영중 asm diskgroup의 남은 용량을 제대로 확인하지 못한채
datafile 을 추가하거나 resize 증가시키는 경우 v$asm_diskgroup의 usable_file_mb 값이 -(음수)가 될수 있음
이 경우 추후 asm disk 문제가 발생했을때 복구에 어려움이 발생할 수 있기 때문에 가능한 빠르게 disk를 추가하거나
+(양수) 값으로 만들어 줘야함
오라클 메뉴얼에서는 usable_file_mb 값이 음수가 되는 경우를 아래와 같이 설명하고 있음
FREE_MB의 값에 따라 새 datafile을 만들지 못할 수도 있습니다.
다음 실패로 인해 중복성이 감소된 파일이 생성될 수 있습니다.
음수가 되면 USABLE_FILE_MB가능한 한 빨리 디스크 그룹에 더 많은 공간을 추가하는 것이 좋습니다.
원문
Negative Values of USABLE_FILE_MB
Due to the relationship between FREE_MB, REQUIRED_MIRROR_FREE_MB, and USABLE_FILE_MB, USABLE_FILE_MB can become negative. Although this is not necessarily a critical situation, it does mean that:
Depending on the value of FREE_MB, you may not be able to create new files.
The next failure might result in files with reduced redundancy.
If USABLE_FILE_MB becomes negative, it is strongly recommended that you add more space to the disk group as soon as possible.
시나리오
asm diskgroup 남은 용량 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
|
SQL>
set lines 200 pages 1000
select name, round(usable_file_mb/1024/1024,1) usable_file_gb, round(total_mb/1024/1024,1) total_gb, round(free_mb/1024/1024,1) free_gb,
100-round(free_mb/total_mb*100) "usage(%)",
round(((free_mb - required_mirror_free_mb))/1024/1024,1) usable_calc_gb,
state, type, group_number
from v$asm_diskgroup;
NAME USABLE_FILE_GB TOTAL_GB FREE_GB usage(%) USABLE_CALC_GB STATE TYPE GROUP_NUMBER
---- ------ -------- -------- ---- -------- ------------- ------- ----
DATA1 -4.4 366.6 28.5 92 13.2 CONNECTED HIGH 1
RECO1 63.7 152.7 128.6 16 127.4 CONNECTED NORMAL 2
DATA2 41.1 806.5 145.6 82 123.2 CONNECTED HIGH 3
|
현재 DATA1의 usable_file_gb 값이 - 상태로 되어있음
DATA2 는 공간이 여유로운 상태
기존 datafile 중 resize(용량 감소) 가능한 datafile 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
SQL>
select a.file_name,
a.file_id,
a.tablespace_name,
'PERMANENT' "TYPE",
round((nvl(a.bytes, 0) - nvl(fs.free, 0)) / 1024 / 1024 * 100 / (nvl(a.bytes, 1) / 1024 / 1024), 2) "DBF_USAGE",
round(nvl(a.bytes, 0)/1024/1024) "TOTAL_MB",
round(nvl(fs.free, 0)/1024/1024) "FREE_MB",
a.status,
c.extent_management,
a.autoextensible,
a.blocks
from sys.dba_data_files a,
(select name,
file_id,
sum(sum_block) as free
from (select ts.name,
lfp.file_id,
sum(lfp.blocks*ts.blocksize) as sum_block
from sys.dba_lmt_free_space lfp,
sys.ts$ ts
where lfp.tablespace_id = ts.ts#
group by ts.name,
file_id
union all
select ts.name,
dfp.file_id,
sum(dfp.blocks*ts.blocksize) as sum_block
from sys.dba_dmt_free_space dfp,
sys.ts$ ts
where dfp.tablespace_id = ts.ts#
group by ts.name,
file_id
union all
select ts.name,
re.file# as file_id,
sum(space*ts.blocksize) as sum_block
from sys.recyclebin$ re,
sys.ts$ ts
where re.ts# = ts.ts#
group by ts.name,
file# )
group by name,
file_id ) fs,
sys.dba_tablespaces c
where a.relative_fno = fs.file_id(+)
and a.tablespace_name = fs.name(+)
and a.tablespace_name = c.tablespace_name(+)
union all
select t.file_name,
t.file_id,
t.tablespace_name,
'TEMPORARY',
round(nvl(e.bytes, 0) / 1024 / 1024 * 100 / (nvl(t.bytes, 1) / 1024 / 1024), 2),
round(nvl(t.bytes, 0)/1024/1024) "TOTAL_MB",
round((nvl(t.bytes, 0)-nvl(e.bytes, 0))/1024/1024) "FREE_MB",
t.status,
f.extent_management,
t.autoextensible,
t.blocks
from (select tablespace_name,
file_name,
file_id,
bytes ,
autoextensible,
blocks,
status
from sys.dba_temp_files) t,
(select file_id,
sum(bytes_used) bytes
from sys.gv_$temp_extent_pool
group by file_id) e,
sys.dba_tablespaces f
where t.file_id = e.file_id(+)
and t.tablespace_name = f.tablespace_name(+)
order by file_name ;
|
DATA1 diskgroup에 속한 테이블스페이스 데이터파일에 대해 resize(감소) 시킬 용량만큼
DATA2 diskgroup 경로에 해당 테이블스페이스 datafile 추가
(예시 : DATA1 diskgroup 에 속한 USERS 테이블스페이스 용량을 32gb 감소시켜야 할 경우
DATA2 diskgroup 경로에 32gb를 미리 추가한 뒤 DATA1 diskgroup 을 사용중인 datafile들의 용량을 감소시킬 수 있음)
1
|
SQL> alter tablespace USERS add datafile '+DATA2' size 32500M;
|
DATA1 diskgroup을 사용하는 datafile 용량 resize(감소)
resize(감소) 시킬수 있는만큼 최대한으로 감소
1
|
SQL> alter database datafile {datafile no} resize 100m;
|
또는 12c 이상 버전의 oracle 을 사용중인 경우
asm 영역 다른영역으로 datafile move(12c부터 온라인가능)
아래 게시글 참조
https://positivemh.tistory.com/856
Active Data Guard를 사용중인 경우 Primary에서 DATA2로 datafile을 추가하였지만
Standby db에 asm datafile이 자동으로(db_create_file_dest 파라미터에 의해서)
용량이 모자란 DATA1 으로 datafile이 추가되어 Standby db에서만 DATA1의 usable_file_mb 값이 -(음수) 값으로 변할수 있음
이 경우 해당 파라미터를 null 값으로 변경해줘야함
이렇게 변경할 경우 Primary 에서 DATA2 diskgroup에 datafile 추가시 Standby 에서도 동일하게 DATA2 diskgroup에 datafile이 추가됨
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
변경전
SQL> show spparameter db_create_file_dest
SID NAME TYPE VALUE
-------- ----------------------------- ----------- ----------------------------
TESTDB1 db_create_file_dest string +DATA1 <<<-------
TESTDB2 db_create_file_dest string +DATA1 <<<-------
* db_create_file_dest string
파라미터 변경
SQL> ALTER SYSTEM SET db_create_file_dest='' SCOPE=BOTH sid='TESTDB1';
SQL> ALTER SYSTEM SET db_create_file_dest='' SCOPE=BOTH sid='TESTDB2';
변경후
SQL> show parameter db_create_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string
SQL>show spparameter db_create_file_dest
SID NAME TYPE VALUE
-------- ----------------------------- ----------- ----------------------------
* db_create_file_dest string
TESTDB1 db_create_file_dest string <------- 변경됨
TESTDB2 db_create_file_dest string <------- 변경됨
|
이후 datafile 추가시 정상적으로 Primary DB에서 추가한 경우에 datafile이 추가됨
참조 :
'ORACLE > Admin' 카테고리의 다른 글
오라클 19c insert 쿼리 logical read 확인 (0) | 2023.06.02 |
---|---|
오라클 19c 일반 dml 시 발생하는 lock 확인 (0) | 2023.06.02 |
오라클 19c 파티션 Exchange 방법 (0) | 2023.05.03 |
오라클 19c 파티션 테이블 append insert 시 lock 확인 (0) | 2023.05.01 |
오라클 19c ORA-04036 에러를 발생시키는 방법 (0) | 2023.04.30 |