Oracle memory troubleshooting, Part 1: Heapdump Analyzer
Oracle memory troubleshooting, Part 1: Heapdump Analyzer by Tanel Poder Posted on January 2, 2009 When troubleshooting Oracle process memory issues like ORA-4030’s or just excessive memory usage, you may want to get a detailed breakdown o
Oracle memory troubleshooting, Part 1: Heapdump Analyzer
by Tanel Poder Posted on January 2, 2009
When troubleshooting Oracle process memory issues like ORA-4030’s or just excessive memory usage, you may want to get a detailed breakdown of PGA, UGA and Call heaps to see which component in there is the largest one.
The same goes for shared pool memory issues and ORA-4031’s – sometimes you need to dump the shared pool heap metadata for understanding what kind of allocations take most of space in there.
The heap dumping can be done using a HEAPDUMP event, see http://www.juliandyke.com/Diagnostics/Dumps/Dumps.html for syntax.
NB! Note that when dumping SGA heaps (like shared, large, java and streams pools), your process holds shared pool latches for the entire dump duration so this should be used only as a last resort in busy production instances. Dumping a big shared pool could hang your instance for quite some time. Dumping private process heaps is safer as that way only the target process is affected.
The heapdump output file structure is actually very simple, all you need to look at is the HEAP DUMP header to see in which heap the following chunks of memory belong (as there may be multiple heaps dumped into a single tracefile).
HEAP DUMP heap name="<strong>sga heap(1,1)</strong>" desc=04EA22D0 extent sz=0xfc4 alt=108 het=32767 rec=9 flg=-125 opc=0 parent=00000000 owner=00000000 nex=00000000 xsz=0x400000 EXTENT 0 addr=20800000 <strong>Chunk 20800038 sz= 374904 free " "</strong> Chunk 2085b8b0 sz= 540 recreate "KGL handles " latch=00000000 Chunk 2085bacc sz= 540 recreate "KGL handles " latch=00000000 Chunk 2085bce8 sz= 1036 freeable "parameter table" Chunk 2085c0f4 sz= 1036 freeable "parameter table" Chunk 2085c500 sz= 1036 freeable "parameter table" Chunk 2085c90c sz= 1036 freeable "parameter table" Chunk 2085cd18 sz= 1036 freeable "parameter table" Chunk 2085d124 sz= 228 recreate "KGL handles " latch=00000000 Chunk 2085d208 sz= 228 recreate "KGL handles " latch=00000000 Chunk 2085d2ec sz= 228 recreate "KGL handles " latch=00000000 Chunk 2085d3d0 sz= 228 recreate "KGL handles " latch=00000000 Chunk 2085d4b4 sz= 228 recreate "KGL handles " latch=00000000 Chunk 2085d598 sz= 540 recreate "KQR PO " latch=2734AA00 Chunk 2085d7b4 sz= 540 recreate "KQR PO " latch=2734AA00 Chunk 2085d9d0 sz= 228 recreate "KGL handles " latch=00000000 ...
The first list of chunks after HEAP DUMP (the list above) is the list of all chunks in the heap. There are more lists such as freelists and LRU lists in a regular heap, but lets ignore those for now, I’ll write more about heaps in an upcoming post.
After identifying heap name from HEAP DUMP line, you can see all individual chunks from the “Chunk” lines. The second column after Chunk shows the start address of a chunk, sz= means chunk size, the next column shows the type of a chunk (free, freeable, recreate, perm, R-free, R-freeable).
The next column is important one for troublehsooting, it shows the reason why a chunk was allocated (such KGL handles for library cache handles, KGR PO for dictionary cache parent objects etc). Every chunk in a heap has a fixed 16 byte area in the chunk header which stores the allocation reason (comment) of a chunk. Whenever a client layer (calling a kghal* chunk allocation function) allocates heap memory, it needs to pass in a comment up to 16 bytes and it’s stored in the newly allocated chunk header.
This is a trivial technique for troubleshooting memory leaks and other memory allocation problems. When having memory issues you can just dump all the heap’s chunks sizes and aggregate these by allocation reason/comment. That would show you the biggest heap occupier and give further hints where to look next.
As there can be lots of chunks in large heaps, aggregating the data manually would be time consuming (and boring). Here’s a little shell script which can summarize Oracle heapdump output tracefile contents for you:
http://blog.tanelpoder.com/files/scripts/tools/unix/heapdump_analyzer
After taking a heapdump, you just run to get a heap summary, total allocation sizes grouped by parent heap, chunk comment and chunk size.
heapdump_analyzer <em>tracefile.trc</em>
Here’s an example of a shared pool dump analysis (heapdump at level 2):
SQL> alter session set events 'immediate trace name heapdump level 2'; Session altered. SQL> exit ... $ <strong>heapdump_analyzer</strong> lin10g_ora_7145.trc -- Heapdump Analyzer v1.00 by Tanel Poder ( http://www.tanelpoder.com ) Total_size #Chunks Chunk_size, From_heap, Chunk_type, Alloc_reason ---------- ------- ------------ ----------------- ----------------- ----------------- <strong>11943936 3 3981312 , sga heap(1,3), free, </strong> 3981244 1 3981244 , sga heap(1,0), perm, perm 3980656 1 3980656 , sga heap(1,0), perm, perm 3980116 1 3980116 , sga heap(1,0), perm, perm 3978136 1 3978136 , sga heap(1,0), perm, perm 3977156 1 3977156 , sga heap(1,1), recreate, KSFD SGA I/O b 3800712 1 3800712 , sga heap(1,0), perm, perm 3680560 1 3680560 , sga heap(1,0), perm, perm 3518780 1 3518780 , sga heap(1,0), perm, perm 3409016 1 3409016 , sga heap(1,0), perm, perm 3394124 1 3394124 , sga heap(1,0), perm, perm 2475420 1 2475420 , sga heap(1,1), free, 2319892 1 2319892 , sga heap(1,3), free, 2084864 509 4096 , sga heap(1,3), freeable, sql area ...
It shows that the biggest component in shared pool is 11943936 bytes, it consists of 3 free chunks, which reside in shared pool subpool 1 and sub-sub-pool 3 (see the sga heap(1,3) div).
Note that my script is very trivial as of now, it reports different sized chunks on different lines so you still may need to do some manual aggregation if there’s no obvious troublemaker seen in the top of the list.
Here’s an example of a summarized heapdump level 29 ( PGA + UGA + call heaps ):
$ heapdump_analyzer lin10g_ora_7145_0002.trc -- Heapdump Analyzer v1.00 by Tanel Poder ( http://www.tanelpoder.com ) Total_size #Chunks Chunk_size, From_heap, Chunk_type, Alloc_reason ---------- ------- ------------ ----------------- ----------------- ----------------- 7595216 116 65476 , top uga heap, freeable, session heap 6779640 105 64568 , session heap, freeable, kxs-heap-w 2035808 8 254476 , callheap, freeable, kllcqas:kllsltb 1017984 4 254496 , top call heap, freeable, callheap 987712 8 123464 , top uga heap, freeable, session heap 987552 8 123444 , session heap, freeable, kxs-heap-w 196260 3 65420 , session heap, freeable, kxs-heap-w 159000 5 31800 , session heap, freeable, kxs-heap-w 112320 52 2160 , callheap, free, 93240 105 888 , session heap, free, 82200 5 16440 , session heap, freeable, kxs-heap-w 65476 1 65476 , top uga heap, recreate, session heap 65244 1 65244 , top call heap, free, 56680 26 2180 , top call heap, freeable, callheap 55936 1 55936 , session heap, freeable, kxs-heap-w ...
You can also use -t option to show total heap sizes in the output (this total is not computed by my script, I just take the “Total” lines from the heapdump tracefile):
$ <strong>heapdump_analyzer -t</strong> lin10g_ora_7145_0002.trc | grep Total Total_size #Chunks Chunk_size, From_heap, Chunk_type, Alloc_reason 8714788 1 8714788 , top uga heap, TOTAL, Total heap size 8653464 1 8653464 , session heap, TOTAL, Total heap size 2169328 2 1084664 , callheap, TOTAL, Total heap size 1179576 1 1179576 , top call heap, TOTAL, Total heap size 191892 1 191892 , pga heap, TOTAL, Total heap size
References:
- Metalink note 396940.1 – Troubleshooting and Diagnosing ORA-4031 Error
- Heapdump syntax – http://www.juliandyke.com/Diagnostics/Dumps/Dumps.html
- Heapdump analyzer – http://blog.tanelpoder.com/files/scripts/tools/unix/heapdump_analyzer
Related Posts
- Oracle Memory Troubleshooting, Part 4: Drilling down into PGA memory usage with…
- Oracle In-Memory Column Store Internals – Part 1 – Which SIMD extensions are getting…
- Advanced Oracle Troubleshooting Guide – Part 10: Index unique scan doing multiblock reads?!
- Advanced Oracle Troubleshooting Guide – Part 11: Complex Wait Chain Signature Analysis with…
- Our take on the Oracle Database 12c In-Memory Option

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Oracle 테이블 스페이스 크기를 쿼리하려면 다음 단계를 따르십시오. 쿼리를 실행하여 테이블 스페이스 이름을 결정하십시오. 쿼리를 실행하여 테이블 스페이스 크기를 쿼리하십시오. sum (bytes)을 total_size, sum (bytes_free)으로 sum (bytes_free), sum (bytes) - sum (bytes_free)으로 dba_data_fices where tablespace_.

Oracle 테이블 작성에는 다음 단계가 필요합니다. 테이블 작성 구문을 사용하여 테이블 이름, 열 이름, 데이터 유형, 제약 조건 및 기본값을 지정하십시오. 테이블 이름은 간결하고 설명 적이어야하며 30자를 초과해서는 안됩니다. 열 이름은 설명 적이어야하며 데이터 유형은 열에 저장된 데이터 유형을 지정합니다. NOT NULL 제약 조건은 열에서 NULL 값이 허용되지 않도록하고 기본 조항은 열의 기본값을 지정합니다. 테이블의 고유 한 레코드를 식별하기위한 주요 주요 제약. 외국 키 제약 조건은 테이블의 열이 다른 테이블의 기본 키를 지칭하도록 지정합니다. 기본 키, 고유 한 제약 조건 및 기본값이 포함 된 샘플 테이블 학생의 생성을 참조하십시오.

데이터 가져 오기 방법 : 1. SQLLOADER 유틸리티 사용 : 데이터 파일 준비, 제어 파일 작성 및 SQLLOADER 실행; 2. IMP/EXP 도구를 사용하십시오 : 데이터 내보내기, 데이터 가져 오기. 팁 : 1. 빅 데이터 세트에 권장되는 SQL*로더; 2. 대상 테이블이 존재해야하고 열 정의가 일치해야합니다. 3. 가져 오기 후에는 데이터 무결성을 확인해야합니다.

Oracle에서 인스턴스 이름을 보는 세 가지 방법이 있습니다. 명령 줄에 명령. "show instance_name"을 사용하십시오. sql*plus의 명령. 운영 체제의 작업 관리자, Oracle Enterprise Manager 또는 운영 체제를 통해 환경 변수 (Linux의 Oracle_Sid)를 확인하십시오.

Oracle View 암호화를 사용하면보기에서 데이터를 암호화 할 수 있으므로 민감한 정보의 보안을 향상시킬 수 있습니다. 단계에는 다음이 포함됩니다. 1) 마스터 암호화 키 생성 (MEK); 2) 암호화 된 뷰 생성, 암호화 할보기 및 MEK를 지정하는 것; 3) 사용자가 암호화 된보기에 액세스하도록 승인합니다. 암호화 된 뷰 작동 방식 : 사용자가 암호화 된보기를 쿼리 할 때 Oracle은 MEK를 사용하여 데이터를 해독하여 공인 사용자 만 읽기 쉬운 데이터에 액세스 할 수 있도록합니다.

Oracle 설치 실패에 대한 방법 제거 : Oracle Service를 닫고 Oracle Program 파일 및 레지스트리 키 삭제, Oracle 환경 변수를 제거하고 컴퓨터를 다시 시작하십시오. 제거되지 않으면 Oracle 범용 제거 도구를 사용하여 수동으로 제거 할 수 있습니다.

Oracle에는 시간을 얻는 방법이 있습니다. current_timestamp : 현재 시스템 시간을 반환합니다. Systimestamp : current_timestamp보다 나노 초보다 더 정확합니다. sysdate : 시간 부분을 제외하고 현재 시스템 날짜를 반환합니다. to_char (sysdate, 'yyy-mm-dd hh24 : mi : ss') : 현재 시스템 날짜와 시간을 특정 형식으로 변환합니다. 추출 : 1 년, 월 또는 시간과 같은 시간 값에서 특정 부분을 추출합니다.

Oracle에서 사용자를 만들려면 다음 단계를 따르십시오. 사용자 명령문을 사용하여 새 사용자를 만듭니다. 보조금 명세서를 사용하여 필요한 권한을 부여하십시오. 선택 사항 : 리소스 문을 사용하여 할당량을 설정하십시오. 기본 역할 및 임시 테이블 스페이스와 같은 다른 옵션을 구성하십시오.
