Professional Documents
Culture Documents
Bug Report
채니아빠 이웃추가
2020. 9. 11. 17:16
Oracle 19c ExadataX8oracle linux 7.7 / oracle 19.6.0* 오라클 backgroup Process중 mmon_slave Process에 대한 메모리 과다 사용
에 대한 현상 Huge Page 영역과 Non-Huge Page영역의 모든 Instance에서 rss 증가됨.특히 Non-Huge Page영역의 DB는 1주일만
에 m00~m006 합계 15G 이상 증가됨.=> Non-Huge 23:00~01:30 사이 ora_m00의 특정 프로세스에 대한 rss 값이 500M 이상 랜
덤하게 급증
USER PID PPID RSS SIZE VSZ %MEM %CPU TIME CMD
oracle 78869 1 7896616 2056100 11504328 2.0 0.1 01:46:05 ora_m000_TEXADB2 --------->
os 명령어
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 1/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
pga 사용량
WHERE S.INST_ID=P.INST_ID
AND S.PADDR=P.ADDR
분석을 위한 Dump 수행
Let's take pid : 18822 (ora_m001_boa2 ) as example to see their RSS usage:
1. it is clear that RSS increased from 1516828 to 2047340, total increased = 2047340 - 1516828 = 530512
F S RUSER PID PPID C PSR PRI NI ADDR RSS SZ WIDE-WCHAN-COLUMN STIME TT TIME CMD
ps_eo_20200903_0100.log:0
1 0 각자도생-시즌2
S oracle 18822 1 0 2 19 0 - 2047340 2306108 do_semtimedop Aug31 ? 00:04:30 ora_m001_boa2
https://m.blog.naver.com/k65fac/222086804310 2/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
2. By further checking, most of the RSS increased is caused by "shmid=0x170001e " (a shared memory segment),
18822: ora_m001_boa2
18822: ora_m001_boa2
So the 각자도생-시즌2
1 shared0 memory is the reason that caused most increasing RSS
https://m.blog.naver.com/k65fac/222086804310 3/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
===================
RSS resident set size, the non-swapped physical memory that a task has used (in kiloBytes). (alias rssize, rsz).
Here, the shared memory segment for shmid 24117278 is 8438939648 bytes ~ 7.85G
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 4/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
RSS 이 값에는 커널 VM 추적 구조, 페이지 테이블의 물리적 페이지에 대한 유효한 매핑이있는 프로세스 주소 공간의 모든 가상 메
모리 페이지가 포함됩니다. 즉, RAM에도있는 프로세스 주소 공간에 매핑 된 모든 페이지입니다. / OS에서 반환을 요청하지 않아서
이미 할당된 영역도 포함됨
- 아래 참조
실제 오라클 Process의 Private한 영역(일반적으로 오라클 Process가 사용하는 메모리 usage) 영역은 가장 pmax -x 결과의 anon 영
역으로 판단됨.
=> v$sysstat.pga 영역, v$process.pga_ 컬럼을 참고
결론 : RSS 증가에 대한 SR 진행은 Memory Leak 관련 Bug 확인되었고, 패치 진행후 더 이상 DB 내 PGA 메모리 증가 현상은 없어
졌으나.
1 각자도생-시즌2
OS상 0RSS 값에 대한 증가 자체가 문제가 될수 없다는 설명이 부족해서 아쉽다.
https://m.blog.naver.com/k65fac/222086804310 5/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
--------- 참고 ------------------------------------------------------------
Process size가 비정상적으로 보이는 이유
록 한다.a) Non-private memory size를 total size에 포함시킨다한 Oracle process의 memory는 다음과 같은 여러 요소들로 구성된
다:
process가 생성되더라도 SGA와 TEXT 영역은 새롭게 할당되는 것이 아니다! 그러나 'ps' 또
까지 private memory 계산에 포함되는 경우가 있어, 한 server process가 차지하는 memory
http://tech.e2sn.com/oracle/performance/unix-performance-tools/process-memory-matrix
Using Process Memory Matrix script for understanding Oracle process memory usage - tech.E2SN
E2SN Tech Corner
tech.e2sn.com
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 6/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
Using Process Memory Matrix script for understanding Oracle process memory usage
This tool currently works only on Solaris. I will write support for (newer) Linux versions soon and possibly also for HP-UX.
When working on a problem I wrote a script which helps to present the output of Solaris pmap in a better way. If you don't know what pmap is, it's
which displays you the breakdown of each processes address space - virtual memory mappings. This is way better than just relying on ps or top com
My script gives a better overview of how much memory an Oracle process is really using. Historically this has been problematic due various differenc
large amount of data returned from pmap command.
My script procmm.sh (Process Memory Matrix) will simply run pmap on the processes specified and aggregate the output into a matrix.
oracle@solaris02:~/research/memory$ ./procmm.sh 12755
On the Horizontal axis you see the various memory sizes pmap reports (like VIRTUAL size and SWAP_RSVD - swap space reservation) and on vertica
dress these memory figures are shown (for example, Oracle binary, heap memory (think malloc()), libraries and process private memory allocations w
I don't do any of my own computation magic here, I just show output from couple pmap commands in a better aggregated and understandable ma
ust run man pmap.
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 7/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
ism prefix shows that we are dealing with Solaris-specific Intimate Shared Memory (I
SM). dism stands for dynamic intimate shared memory (DISM).
anon - anonymous memory deserves its own page, but shortly said this is process p
rivate memory. For example since version 9i, Oracle can allocate PGA/UGA/CGA me
mory by mapping /dev/zero into its process address space using mmap() system call
instead of calling malloc()/brk() which just extends the process data segment (heap).
The reason this memory segment type is called anonymous is that this memory doe
sn't correspond to any real (named) file on disk. When you load an executable, librar
y or some datafile into memory, then their in-memory pages correspond to their on
-filesystem files, thus are not anonymous. Process private allocations don't correspon
d to any files, thus are called anonymous pages.
stack - this is the relativaly small memory area (few kilobytes or few tens of kB) pres
ent in each thread where some function-local scope variables are kept (as determine
d by compiler) and also the return path to parent functions is remembered there. Th
is information is used for resuming the parent function once the child functions it ca
lls finish their work and return. Stack tracing is extremely useful for troulbleshooting
and will have its own page soon.
heap - this is the memory "application scratch area", called data segment, which is u
sed when you allocate memory with conventional malloc() calls. However Oracle doe
s not use the heap for PGA/UGA's anymore thanks to the realfree heap allocation w
hich was introduced in 9i (and enabled by default in 10g).
VIRTUAL This shows the total virtual address space (reservation) size in kB. Reserving virtual
address space does not actually allocate corresponding physical memory from anyw
here (OS'es are lazy in that sense, they only will allocate physical pages of RAM for y
ou if you actually start touching these virtual pages. This is when the page fault mec
hanism will find a physical page of RAM and map it together with given process'es v
1 0 irtual memory page.
각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 8/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
Note that some OS'es (Solaris, HP-UX) do automatically reserve swap space for such
virtual memory segments which may need paging out in the future (writable segme
nts). AIX and Linux (by default) will not try to reserve the swap space during virtual
memory segment set-up, but that raises a risk that when running out of memory th
en some victim process will get an error signal or exception in random location in th
e code and will not be able to gracefully handle this situation.
It is important to remember that VIRTUAL memory does not equal to physical mem
ory. Physical pages are allocated and mapped to the virtual segment only when the
process actually tries to use (touch) these memory pages.
RSS This shows process Resident Set Size in kB. This value includes all virtual memory p
ages in the process address space which have a valid mapping to a physical page in
kernel VM tracking stuctures, pagetables. In other words, all pages mapped to the p
rocess address space which also happen to be in RAM.
This is why with Oracle processes you can sometimes see that when a process starts
up and attaches to SGA, it's virtual size is let say 10G (assuming ~10GB SGA), but th
e RSS is only a few hundred megabytes. This is because that process has not yet tou
ched all the SGA pages (which are in physical RAM), thus all the virtual-physical pag
e mappings for that process haven't been done and won't show up in RSS.
This is specific to your instance configuration btw (large vs small pages, ISM or not
etc).
ANON This is the key metric in procmm output. It shows in kB how much actual memory
has been allocated for that process (not just reserved, but actually used, allocated).
Note that this figure counts two things:
Now you might ask, why do we see cases in above output where RSS is much larger
than ANON? For example the "oracle" file mapping. The answer is that RSS shows b
oth the resident named-file (corresponding to the file "oracle") contents and also th
e private anonymous memory pages which don't correspond to any named file (thus
are "anonymoys"), but just to the process.
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 9/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
So, ANON is the figure which allows to answer the question of "How much memory
are the Oracle processes really using?".
Note that there are many subtleties involved here and neither pmap nor my procm
m.sh script are perfect, but on Solaris reading ANON is a quick and decent way for
understanding Oracle memory usage.
LOCKED This shows (in kB) how much memory in the process address space is also locked t
o physical RAM. Intimate Shared Memory pages are always automatically locked to
memory, thus can't ever be paged out (non-pageability makes implementation of sh
ared pagetables easier). Other types of pages (Dynamic ISM for example) can be loc
ked to memory using mlock() system calls - if the program has root access. This is w
hy the oradism process exists in $ORACLE_HOME/bin
SWAP_RSVD On Solaris this shows how much memory (in kB) has been reserved in swapfs (whic
h is the on-disk swap area + virtual swap cache in RAM). Reserving swap does not
mean it's actually used and filled with some data, it merely means that Solaris adjust
s its "free swap space left" counters so that it would be quaranteed that this memor
y could be swapped out in case there's need for that.
In the above example I examined only a single process. Below I pass all processes of an instance as a parameter and procmm walks through them. T
The -t option below means "Total", the script doesn't show individual PID memory breakdown but sum of all PIDs passed to it.
0
1 0 각자도생-시즌2
lib 389844 388796 13180 0 17816
https://m.blog.naver.com/k65fac/222086804310 10/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
-- Note that in Total (-t) calculation mode it makes sense to look into ANON and SWAP_RSVD
-- totals only as other numbers may be heavily "doublecounted" due overlaps of shared mappings
The ANON figure reports roughly 50404 kB as the Oracle instance processes actual memory usage (I should be more precise and say memory alloca
However the total 50404 kB also includes 13180 kB of ANON memory allocated by various libraries (in addition to Oracle libraries also multiple OS l
ritable) ANON memory has been allocated "in" oracle binary. This is because the BSS section in the binary which holds various static global variables
er object modules go to BSS section).
Every new Oracle process reuses the shared Oracle binary pages (only one copy of Oracle binary is in memory), but when the process tries to write
cal page and maps the new page to process address space as a writable page. That's called copy on write.
To Be Continued...
첨부파일
MEM_LOG 쉘.TXT
1 0 각자도생-시즌2
https://m.blog.naver.com/k65fac/222086804310 11/14
8/12/22, 11:09 AM 19c - Oracle process memory leak : 네이버 블로그
1 0
채니아빠
IT·컴퓨터
따뜻한 말 잘하자
이웃추가
이 블로그 Bug Report 카테고리 글
19.13 GI RU / Cluster Nodes will not Start Automatically After a Node Eviction (Doc ID 2821641.1)
2021. 11. 28.
이 블로그의 #oracle 다른 글
19c - 33123985: DBW PROCESS GENERATE HUGE TRACES WITH DUMPING DBWR PROCESS STATE AFTER DBRU 19.11
2022. 3. 31.
0
set_column_stats
2022. 3. 13.
0
맨 위로
PC버전으로 보기
1 0
https://m.blog.naver.com/k65fac/222086804310 14/14