[20210507]如何實現.txt
[20210507]如何實現.txt
--//前面的測試,連結:http://blog.itpub.net/267265/viewspace-2771267/ =>[20210507]dump library_cache.txt
--//如何寫簡單指令碼實現1個Bucket下,有2行^ LibraryHandle:的輸出呢? 把轉儲檔案複製出來,在家裡做一個嘗試.
C:\other> grep -E "^Bucket:|^ LibraryHandle:|^$" book_ora_12044_0003.trc >aa.txt
--//真心話,寫了一個多小時,程式碼如下:
C:\other>cat a1.awk
BEGIN {
line = 0
bucket = ""
library = ""
}
/^Bucket:/,/^$/ {
if ($0 ~ /^Bucket:/) {
line=0
bucket=$0
}
if ($0 ~ /^ LibraryHandle:/ && line == 0 ) {
line=NR
library=$0
}
if ($0 ~ /^ LibraryHandle:/ && line != 0 ) {
if ( line+1 == NR ) {
printf "%s\n" ,bucket
printf "%s\n" ,library
printf "%s\n\n" ,$0
line = 0
bucket = ""
library = ""
}
}
}
C:\other>awk -f a1.awk aa.txt | head -20
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
Bucket: #=3845 Mutex=0x80a96820(0, 71, 0, 6)
LibraryHandle: Address=0x7e252928 Hash=27660f05 LockMode=0 PinMode=0 LoadLockMode=0 Status=0
LibraryHandle: Address=0x7e04d730 Hash=a2e00f05 LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
Bucket: #=4143 Mutex=0x80a996b0(0, 59, 0, 6)
LibraryHandle: Address=0x7c9bc308 Hash=f0f0102f LockMode=0 PinMode=0 LoadLockMode=0 Status=0
LibraryHandle: Address=0x7bd3ca68 Hash=5b5e102f LockMode=0 PinMode=0 LoadLockMode=0 Status=0
Bucket: #=7663 Mutex=0x80abbcb0(0, 59, 0, 6)
LibraryHandle: Address=0x7d6aea60 Hash=61ae1def LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
LibraryHandle: Address=0x7c516960 Hash=eb7e1def LockMode=0 PinMode=0 LoadLockMode=0 Status=0
Bucket: #=8108 Mutex=0x80ac0238(0, 70, 0, 6)
LibraryHandle: Address=0x7bf0d468 Hash=c21a1fac LockMode=0 PinMode=0 LoadLockMode=0 Status=0
LibraryHandle: Address=0x7c11b0c8 Hash=aadc1fac LockMode=0 PinMode=0 LoadLockMode=0 Status=VALD
awk: a1.awk:22: (FILENAME=aa.txt FNR=5998) fatal: printf to "standard output" failed (Invalid argument)
C:\other>awk -f a1.awk aa.txt | grep "Bucket" |wc
57 342 2691
--//與轉儲的下劃線看到的庫快取物件數量一致.
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
--//如果要寫指令碼實現1個Bucket下,有3行^ LibraryHandle:的輸出,程式碼還給重新寫.放棄,不擅長awk的指令碼語言.
--//那位知道更好的寫法..
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2771270/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210507]分析library cache轉儲.txt
- [20210507]完善vim bccalc_win外掛.txt
- [20210828]如何實現2.txt
- [20210904]如何實現3.txt
- [20190531]如何實現與執行.txt
- [20220927]如何實現sqlcl的repeat功能.txtSQL
- js實現txt/excel檔案下載JSExcel
- PHP實現日誌寫入log.txtPHP
- AOP如何實現及實現原理
- python如何匹配txtPython
- 如何實現實時機器學習? - huyenchip機器學習
- [20230428]bash實現xor計算.txt
- [20170425]實現磁碟檔案與U盤同步.txt
- CDN加速如何實現
- 如何實現倒影效果
- 如何實現Web聊天Web
- 如何實現查詢介面的所有實現類
- Java實現將txt中的內容寫入到excel中JavaExcel
- 如何實現一個簡易版的 Spring - 如何實現 AOP(中)Spring
- 如何實現一個簡易版的 Spring - 如何實現 AOP(上)Spring
- 如何實現一個簡易版的 Spring - 如何實現 Setter 注入Spring
- 如何實現程式碼高亮
- nginx 如何實現 if 巢狀Nginx巢狀
- 如何實現css模組化CSS
- 如何更好實現業務治理?
- 如何實現定時推送?
- AOP如何實現及其原理
- 專案如何實現限流?
- Go 如何實現多型Go多型
- CSS 如何實現羽化效果?CSS
- 如何實現專案管理專案管理
- 如何使用 redis 實現限流Redis
- 如何簡單實現ELT?
- 如何實現水平垂直居中?
- Javascript如何實現繼承JavaScript繼承
- Tomcat如何實現WebSocketTomcatWeb
- 如何實現一個 LazyMan?
- 如何實現HTTPS加密HTTP加密