OS 환경 : Oracle Linux 8.7 (64bit)
DB 환경 : Oracle Database 19.28.0.0
방법 : 오라클 19c Hugepages 설정 스크립트 최신버전 및 수동계산
Hugepage 설정 방법 참고 : 오라클 19c Hugepages 설정 방법 ( https://positivemh.tistory.com/603 )
이전 게시글에서 hugepage를 설정하기 위해 권장값을 찾는 스크립트를 업로드했었음
최근에 해당 스크립트 사용시 Kernel version 5.15 is not supported by this script 라는 메세지가 발생해 찾아봤더니 스크립트가 약간 업데이트 되었음
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
$ ./hugepages_settings.sh
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments on Oracle Linux. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating the overall size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database 11g Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed...
Kernel version 5.15 is not supported by this script (yet). Exiting.
|
최신 스크립트
|
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
77
78
79
80
81
82
83
84
85
86
|
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
# on Oracle Linux
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support
# http://support.oracle.com
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments on Oracle Linux. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating the overall size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed..."
read
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
if [ -z "$HPG_SZ" ];then
echo "The hugepages may not be supported in the system where the script is being executed."
exit 1
fi
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`
# An SGA less than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
echo "***********"
echo "** ERROR **"
echo "***********"
echo "Sorry! There are not enough total of shared memory segments allocated for
HugePages configuration. HugePages can only be used for shared memory segments
that you can list by command:
# ipcs -m
of a size that can match an Oracle Database SGA. Please make sure that:
* Oracle Database instance is up and running
* Oracle Database Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
echo "Recommended setting: vm.nr_hugepages = $NUM_PG";
# End
|
기존버전과 달라진 부분

기존에는 커널 버전별로 값이 출력되게끔 되어있고, 커널버전이 5.5버전 이상인 경우 Kernel version 커널버전 is not supported by this script 라고 표시되었음
하지만 리눅스 버전이 올라가면서 대부분 커널버전이 5.5버전 이상이 되어서 그런지 Finish with results 부분에서 커널버전에 상관없이 권장값만 알려주게끔 스크립트가 업데이트됨
참고용. hugepage(vm.nr_hugepages) 수동 계산 방법
서버에서 사용하는 모든 인스턴스의 sga 크기 합 계산
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
SQL> show parameter sga_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_target big integer 2384M
또는
SQL>
select round(sum(bytes/1024/1024)) mb from v$sgainfo
where name in('Fixed SGA Size','Redo Buffers','Buffer Cache Size',
'Shared Pool Size','Large Pool Size','Java Pool Size');
MB
----------
2384
|
(서버에 인스턴스가 여러개라면 모두 접속 후 MB 값 합산)
os에서 hugepage 크기 확인
|
1
2
|
$ grep Hugepagesize /proc/meminfo
Hugepagesize: 2048 kB
|
2mb임(2048kb)
hugepage 크기 계산
계산식 : HugePages 개수 = 전체 SGA 크기(mb) / HugePage 크기(mb)
SGA = 2384mb, HugePage 크기 = 2mb
2384mb / 2mb = 1192
현재 테스트 서버에서 hugepage 계산 스크립트를 수행해도 비슷한 값이 나옴
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
$ sh hugepages_settings.sh
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments on Oracle Linux. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating the overall size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed...
Recommended setting: vm.nr_hugepages = 1194
|
권장 값 계산 후 Hugepage 설정 방법 게시글을 확인하여 \설정하면 됨
참고 : 오라클 19c Hugepages 설정 방법 ( https://positivemh.tistory.com/603 )
결론 : 리눅스 8 버전 또는 커널버전 5.5 이상이라면 신규 스크립트를 사용하면 됨
만약 신규 스크립트가 내부망 서버에 없는 경우 달라진 부분만 일부 수정해서 수행하면됨
스크립트 반입이 어려운 경우 수동 계산을 이용할수도 있음
계산식 : HugePages 개수 = 전체 SGA 크기(mb) / HugePage 크기(mb)
참조 : 401749.1
'ORACLE > Sql' 카테고리의 다른 글
| 오라클 19c 리스너 로그 집계 스크립트 (0) | 2025.11.11 |
|---|---|
| 오라클 19c 유저 100개, 테이블 100개, 인덱스 100개, 데이터 1000건 생성 (0) | 2025.08.10 |
| 오라클 19c 테스트용 테이블스페이스 및 데이터파일 여러개 생성 쿼리 (0) | 2025.07.28 |
| 오라클 23ai cdb, pdb, 리스너 전체 기동 및 정지 스크립트 (0) | 2025.05.18 |
| 오라클 19c 유저, 백그라운드 프로세스 pga 사용량 확인 (0) | 2024.05.01 |
