[20210507]dump library_cache.txt
[20210507]dump library_cache.txt
--//放假看了一些共享池方面的文件,重新學習一下這方面的知識。
--//學習alter session set events 'immediate trace name library_cache level N';
--//N 表示如下:
. Level=1,轉儲庫快取統計資訊。
. Level=2,轉儲雜湊表概要。
. Level=4,轉儲庫快取物件,只包含基本資訊。
. Level=8,轉儲庫快取物件,包含詳細資訊(包括 child references、pin waiters等)。
. Level=16,增加堆大小資訊。
. Level=32,增加堆資訊。
--//我看了N多文件,多少情況下選擇10,我感覺選擇8就可以。先測試選擇1,2的情況。
--//你可以組合形成自己需要的輸出。
--//比如6=4+2 表示轉儲雜湊表概要 和 轉儲庫快取物件,只包含基本資訊。
1.環境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.測試:
SYS@book> @ tix
New tracefile_identifier = /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0001.trc
SYS@book> alter session set events 'immediate trace name library_cache level 1';
Session altered.
--//檢視轉儲:
Library Cache Dump
LIBRARY CACHE STATISTICS:
namespace gets hit ratio pins hit ratio reloads invalids
-------------- --------- --------- --------- --------- ---------- ----------
SQL AREA 50593 0.799 356372 0.928 6773 358
TABLE/PROCEDURE 54154 0.883 92671 0.734 10636 0
BODY 2937 0.818 6109 0.899 16 0
TRIGGER 609 0.801 609 0.800 0 0
INDEX 1773 0.851 1647 0.497 435 0
CLUSTER 1753 0.978 1797 0.979 0 0
KGL TESTING 0 0.000 0 0.000 0 0
PIPE 0 0.000 0 0.000 0 0
LOB 0 0.000 0 0.000 0 0
DIRECTORY 3 0.333 6 0.333 0 0
QUEUE 4 0.500 6 0.333 0 0
REPLICATION OBJECT GROUP 0 0.000 0 0.000 0 0
REPLICATION PROPAGATOR 0 0.000 0 0.000 0 0
JAVA SOURCE 0 0.000 0 0.000 0 0
JAVA RESOURCE 0 0.000 0 0.000 0 0
REPLICATED TABLE OBJECT 0 0.000 0 0.000 0 0
REPLICATION INTERNAL PACKAGE 0 0.000 0 0.000 0 0
CONTEXT POLICY 0 0.000 0 0.000 0 0
PUB SUB INTERNAL INFORMATION 454 0.874 583 0.854 27 0
SUMMARY 0 0.000 0 0.000 0 0
DIMENSION 0 0.000 0 0.000 0 0
APP CONTEXT 0 0.000 0 0.000 0 0
STORED OUTLINE 0 0.000 0 0.000 0 0
RULESET 1 0.000 3 0.667 0 0
RESOURCE MANAGER 275 0.796 294 0.776 0 0
XML SCHEMA 0 0.000 0 0.000 0 0
PENDING RESOURCE MANAGER PLAN 0 0.000 0 0.000 0 0
PENDING RESOURCE MANAGER CONSUMER GROUP 0 0.000 0 0.000 0 0
SUBSCRIPTION 0 0.000 0 0.000 0 0
LOCATION 0 0.000 0 0.000 0 0
REMOTE OBJECT INFORMATION 0 0.000 0 0.000 0 0
SNAPSHOT META DATA 0 0.000 0 0.000 0 0
JAVA DATA 0 0.000 0 0.000 0 0
SECURITY PROFILE 0 0.000 0 0.000 0 0
TRANSFORMATION 0 0.000 0 0.000 0 0
REPLICATION - LOG BASED CHILD 0 0.000 0 0.000 0 0
RULE 0 0.000 0 0.000 0 0
STREAM 0 0.000 0 0.000 0 0
RULE EVALUATION CONTEXT 1 0.000 0 0.000 0 0
STREAMS APPLY PROCESS 0 0.000 0 0.000 0 0
REPLICATION SOURCE 0 0.000 0 0.000 0 0
REPLICATION DESTINATION 0 0.000 0 0.000 0 0
IFS SCHEMA 0 0.000 0 0.000 0 0
XDB CONFIG 0 0.000 0 0.000 0 0
USER AGENT 0 0.000 0 0.000 0 0
MULTI-VERSION OBJECT FOR TABLE 672 0.812 666 0.817 0 0
SCHEDULER EVENT QUEUE INFORMATION 0 0.000 0 0.000 0 0
CHANGE SET 0 0.000 0 0.000 0 0
MULTI-VERSION OBJECT FOR INDEX 673 0.814 667 0.819 0 0
SQL TUNING BASE OBJECT 0 0.000 0 0.000 0 0
HINTSET OBJECT 0 0.000 0 0.000 0 0
SCHEDULER GLOBAL ATTRIBUTE 21897 0.996 21897 0.996 1 0
SCHEDULER EARLIEST START TIME 727 0.916 717 0.738 127 0
TEMPORARY TABLE 320 0.697 320 0.000 223 0
TEMPORARY CLUSTER 0 0.000 0 0.000 0 0
TEMPORARY INDEX 125 0.008 125 0.000 1 0
SCRATCH PAD 0 0.000 0 0.000 0 0
SCHEDULER JOB SLAVE 0 0.000 0 0.000 0 0
MINING MODELS 0 0.000 0 0.000 0 0
SYNC STREAMS CAPTURE 0 0.000 0 0.000 0 0
LIGHT WEIGHT SESSION 0 0.000 0 0.000 0 0
DATA SECURITY DOCUMENT 0 0.000 0 0.000 0 0
SECURITY CLASS 0 0.000 0 0.000 0 0
XDB ACL 0 0.000 0 0.000 0 0
EDITION 619 0.987 830 0.958 21 0
SCHEDULER LIGHTWEIGHT JOB 0 0.000 0 0.000 0 0
REMOTE OBJECT LOCAL SUMMARY REFERENCE 0 0.000 0 0.000 0 0
STREAMS PROPOGATION 0 0.000 0 0.000 0 0
FUSION XS PARAMETERS 0 0.000 0 0.000 0 0
DBLINK 94 0.723 0 0.000 0 0
XDB REPOSITORY 0 0.000 0 0.000 0 0
EV BASE TABLE 0 0.000 0 0.000 0 0
OBJECT ID 87 0.000 0 0.000 0 0
SCHEMA 9877 0.996 0 0.000 0 0
DBINSTANCE 1 0.000 0 0.000 0 0
SQL AREA STATS 9765 0.538 9765 0.538 1 0
CONTEXT MVDATA 0 0.000 0 0.000 0 0
CONTEXT MTABLE 0 0.000 0 0.000 0 0
CONTEXT FTABLE 0 0.000 0 0.000 0 0
ACCOUNT_STATUS 19 0.737 0 0.000 0 0
PCTABL 0 0.000 0 0.000 0 0
PCINDX 0 0.000 0 0.000 0 0
SQL AREA BUILD 10469 0.040 0 0.000 0 0
KGLNEDSYNC 0 0.000 0 0.000 0 0
KZP Exempt Access Policy list 0 0.000 0 0.000 0 0
SDO Index MetaData 0 0.000 0 0.000 0 0
SDO Geom MetaData 0 0.000 0 0.000 0 0
SDO SRID MetaData 0 0.000 0 0.000 0 0
SDO Product Usage 0 0.000 0 0.000 0 0
SDO SRID CRS DIM 0 0.000 0 0.000 0 0
SDO Row Cache 0 0.000 0 0.000 0 0
CUMULATIVE 167902 0.804 495084 0.884 18261 358
SGA:0x80a6fea8 Flags=ac3
DebugContext: DebugNameSpace=0 DebugType=0 DebugLevel=0x0
--//實際上這個基本與查詢檢視V$LIBRARYCACHE的輸出類似,只不過檢視V$LIBRARYCACHE的輸出資訊少一些。
SELECT inst_id
,kglstdsc
,kglstget
,kglstght
,DECODE (kglstget, 0, 1, kglstght / kglstget)
,kglstpin
,kglstpht
,DECODE (kglstpin, 0, 1, kglstpht / kglstpin)
,kglstrld
,kglstinv
,kglstlrq
,kglstprq
,kglstprq
,kglstmiv
,kglstmiv
FROM x$kglst
WHERE kglsttyp = 'NAMESPACE' AND kglstget != 0 AND LENGTH (kglstdsc) <= 15
--//只要去掉後面兩個條件kglstget != 0 AND LENGTH (kglstdsc) <= 15,輸出行數基本一致,還有轉儲多了一個彙總功能CUMULATIVE罷了。
3.繼續:
SYS@book> @ tix
New tracefile_identifier = /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0002.trc
SYS@book> alter session set events 'immediate trace name library_cache level 2';
Session altered.
Library Cache Dump
SGA:0x80a6fea8 Flags=ac3
DebugContext: DebugNameSpace=0 DebugType=0 DebugLevel=0x0
LIBRARY CACHE HASH TABLE: size=131072 count=3172
Buckets with more than 20 objects:
NONE
Hash Chain Size Number of Buckets
--------------- -----------------
0 127939
1 3094
2 39
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
>20 0
--//這個資訊透過那個檢視檢視,我不知道,或者根本沒有。
SYS@book> @ fcha 80a6fea8
Find in which heap (UGA, PGA or Shared Pool) the memory address 80a6fea8 resides...
WARNING!!! This script will query X$KSMSP, which will cause heavy shared pool latch contention
in systems under load and with large shared pool. This may even completely hang
your instance until the query has finished! You probably do not want to run this in production!
Press ENTER to continue, CTRL+C to cancel...
LOC KSMCHPTR KSMCHIDX KSMCHDUR KSMCHCOM KSMCHSIZ KSMCHCLS KSMCHTYP KSMCHPAR
--- ---------------- ---------- ---------- ---------------- ---------- -------- ---------- ----------------
SGA 0000000080834000 1 1 permanent memor 3974984 perm 0 00
3.使用level 6轉儲看看:
SYS@book> @ tix
New tracefile_identifier = /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0003.trc
SYS@book> alter session set events 'immediate trace name library_cache level 6';
Session altered.
$ grep "^Bucket:" /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0003.trc|wc -l
3707
--//檢查轉儲。
Library Cache Dump
SGA:0x80a6fea8 Flags=ac3
DebugContext: DebugNameSpace=0 DebugType=0 DebugLevel=0x0
LIBRARY CACHE HASH TABLE: size=131072 count=3764
Buckets with more than 20 objects:
NONE
Hash Chain Size Number of Buckets
--------------- -----------------
0 127365
1 3650
2 57
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
>20 0
--//我測試多次結果類似。Hash Chain Size >0 的Number of Buckets 相加 3650+57 = 3707,正好等於前面輸出的Bucket:的數量。
--//全部相加 等於127365+3650+57 = 131072,正好等於HASH TABLE: size = 131072.
--//是否可以這樣理解,我的猜測:
Hash Chain Size=0,Number of Buckets=127365,表示這些Bucket還沒有庫快取物件佔用.
Hash Chain Size=1,Number of Buckets=3650 ,表示這些Bucket僅僅有1個庫快取物件佔用.
Hash Chain Size=2,Number of Buckets=57 ,表示這些Bucket僅僅有2個庫快取物件佔用.
--//一個簡單的過濾就可以確定我的判斷是否正確:
$ grep "^Bucket:" /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0003.trc|wc -l
3707
$ grep -E "^Bucket:|^ LibraryHandle:" /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0003.trc|wc -l
7471
$ grep -E "|^ LibraryHandle:" /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_12044_0003.trc|wc -l
3764
--//7471-3764 = 3707,正好等於包含^Bucket:行的數量.
--//1*3650+2*57 = 3764,正好等於包含^ LibraryHandle:行的數量.也就是出現3764個LibraryHandle.相當於3764個庫快取物件.
--//^_^,這樣正好驗證我的判斷,注意我的測試環境基本我在使用,沒有任何人使用,整個測試是可控的,這樣上下不會存在偏差.
--//另外可以從如下輸出看出我的判斷基本正確:
Buckets with more than 20 objects:
NONE
---//還有如下:
LIBRARY CACHE HASH TABLE: size=131072 count=3764
--//count=3764,正好對應庫快取物件.
--//如何寫簡單指令碼實現1個Bucket下,有2行^ LibraryHandle:的輸出呢?那位知道,期待...先放一下.
--//找一個生產系統驗證看看,注意如果共享池很大,轉儲可能有點慢,特別是level更大的情況。
# grep "^Bucket:" /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_17434.trc|wc -l
80010
SGA:0x64f865b30 Flags=ae3
DebugContext: DebugNameSpace=0 DebugType=0 DebugLevel=0x0
LIBRARY CACHE HASH TABLE: size=131072 count=124771
Buckets with more than 20 objects:
NONE
Hash Chain Size Number of Buckets
--------------- -----------------
0 51083
1 47674
2 22636
3 7397
4 1855
5 362
6 55
7 10
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
>20 0
--//47674+22636+7397+1855+362+55+10 = 79989
--//51083+47674+22636+7397+1855+362+55+10 = 131072
--//我估計生產系統業務比較忙,這樣的查詢結果不確定,不過還是很接近grep過濾後的輸出80010。而測試環境我做了幾次都是對的。
--//0*51083+1*47674+2*22636+3*7397+4*1855+5*362+6*55+7*10 = 124767
--//與前面的輸出LIBRARY CACHE HASH TABLE: size=131072 count=124771,的count存在一點點差異.
--//我自己有點意外的是生產系統存在這麼高的hash衝突呢.也許這樣的情況是正常的.
4.驗證庫快取物件應該放入那個Bucket:
--//還可以驗證放入那個Bucket是根據庫快取物件的hash values與131072取模確定的。我貼幾個例子看看:
Bucket: #=24 Mutex=0x80a71318(0, 33, 0, 6)
LibraryHandle: Address=0x7d5cd780 Hash=d4f20018 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
ObjectName: Name=SYS.DBA_TYPES
FullHashValue=a9cc3db174ef4fdb7644abefd4f20018 Namespace=TABLE/PROCEDURE(01) Type=VIEW(04) Identifier=3693 OwnerIdn=0
Statistics: InvalidationCount=0 ExecutionCount=0 LoadCount=1 ActiveLocks=0 TotalLockCount=1 TotalPinCount=1
Counters: BrokenCount=1 RevocablePointer=1 KeepDependency=0 Version=0 BucketInUse=0 HandleInUse=0 HandleReferenceCount=0
Concurrency: DependencyMutex=0x7d5cd830(0, 1, 0, 0) Mutex=0x7d5cd8c0(58, 26, 0, 6)
Flags=PIN/TIM/[00002801]
WaitersLists:
Lock=0x7d5cd810[0x7d5cd810,0x7d5cd810]
Pin=0x7d5cd7f0[0x7d5cd7f0,0x7d5cd7f0]
LoadLock=0x7d5cd868[0x7d5cd868,0x7d5cd868]
Timestamp: Current=08-24-2013 11:38:31
HandleReference: Address=0x7d5cd938 Handle=0x7ea4a118 Flags=OWN[200]
LibraryObject: Address=0x7cbac490 HeapMask=0000-0101-0101-0000 Flags=EXS/LOC[0004] Flags2=[0000] PublicFlags=[0000]
--//Hash=d4f20018
--//d4f20018 = 3572629528
--//3572629528 % 131072 = 24
Bucket: #=131041 Mutex=0x8063e358(0, 197, 0, 6)
LibraryHandle: Address=0x7bc816d0 Hash=3abffe1 LockMode=0 PinMode=0 LoadLockMode=0 Status=0
ObjectName: Name=EXFSYS.RLM$ORDERCLSALS
FullHashValue=22e37cd8f2dabea34c6490bb03abffe1 Namespace=TABLE/PROCEDURE(01) Type=TABLE(02) Identifier=70471 OwnerIdn=42
Statistics: InvalidationCount=0 ExecutionCount=0 LoadCount=0 ActiveLocks=0 TotalLockCount=0 TotalPinCount=0
Counters: BrokenCount=1 RevocablePointer=1 KeepDependency=0 Version=0 BucketInUse=6 HandleInUse=6 HandleReferenceCount=0
Concurrency: DependencyMutex=0x7bc81780(0, 13, 0, 0) Mutex=0x7bc81810(58, 87, 0, 6)
Flags=PIN/TIM/[00000800]
WaitersLists:
Lock=0x7bc81760[0x7bc81760,0x7bc81760]
Pin=0x7bc81740[0x7bc81740,0x7bc81740]
LoadLock=0x7bc817b8[0x7bc817b8,0x7bc817b8]
Timestamp: Current=08-24-2013 11:49:33
HandleReference: Address=0x7bc81890 Handle=(nil) Flags=[00]
--//Hash=3abffe1
--//3abffe1 = 61603809
--//61603809 % 131072 = 131041
--//可以發現取模後的計算結果正好對上。
--//再找一個放2個庫快取物件的bucket:
Bucket: #=2722 Mutex=0x80a8b8a8(0, 72, 0, 6)
LibraryHandle: Address=0x7d6449f8 Hash=ae0e0aa2 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
LibraryHandle: Address=0x7c991c18 Hash=a8240aa2 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
--//注輸出太長,我僅僅擷取LibraryHandle的行輸出.
--//實際上從hash的後面4位一樣基本可以驗證.
--//131072 = 0x20000,相當於2進位制移位 4*5+1=21位.
--//ae0e0aa2 = 2920155810
--//2920155810 % 131072 = 2722
--//a8240aa2 = 2820934306
--//2820934306 % 131072 = 2722
--//找一個出現hash 衝突的情況,看看轉儲的情況.寫的有點長另外寫一篇blog.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2771267/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210507]dump library_cache 2.txt
- [20210507]如何實現.txt
- [20210507]分析library cache轉儲.txt
- [20210507]完善vim bccalc_win外掛.txt
- 7.81 DUMP
- 高通進dump和抓取解析dump log
- Linux core dump使用Linux
- JVM dump和分析JVM
- ASM Metadata Dump UtilityASM
- [轉載]fsdb dump技巧
- Memory Dump利用例項
- 使用Visual Studio分析dump
- Linux基礎命令---dumpLinux
- oracle之 如何 dump logfileOracle
- [20181108]12c user_dump_dest與background_dump_dest引數.txt
- pg_dump備份加密加密
- class dump使用方式和原理
- 使用Visual Studio分析.NET Dump
- PostgreSQL DBA(73) - dump函式SQL函式
- 使用Splunk監控SAP Dump
- java core dump分析實戰Java
- 除錯利器 Laravel Dump Server除錯LaravelServer
- 容器程式Core Dump處理
- docker下netcore記憶體dumpDockerNetCore記憶體
- How to Dump Redo Log File Information --metalinkORM
- [20210407]oradebug dump heapdump_addr.txt
- Visual Studio 快速分析 .NET Dump 檔案
- WinDbg分析32位應用程式dump
- [20191002]函式dump的bug.txt函式
- BMZCTF:2018 護網杯 easy_dump
- class-dump 下載安裝使用
- win10藍屏dump分析方法_win10藍屏dump檔案怎麼看異常Win10
- core dump如何解決排查的過程
- gdb除錯core dump檔案之二除錯
- CommMonitor Dump檢視有什麼功能特性?
- Linux dump命令有什麼作用?如何使用?Linux
- 使用mysqldump以SQL格式來dump資料MySql
- windbg分析dump-解決mscorwks不匹配