Buffers dump at level 5. Run the script (bh.pl) on the trace file A better description and improved version is at http://www.ixora.com.au/scripts/dumps.htm#buffers http://www.ixora.com.au/scripts/bin/buffers.pl (If the site is down, go to http://64.233.187.104/search?q=cache:LJEwQ2J965gJ:www.ixora.com.au/scripts/bin/buffers.pl+%22yong+huang%22+site:ixora.com.au&hl=en and View Source) and a better easier way at http://64.233.187.104/search?q=cache:d-f-0HXWhiUJ:www.ixora.com.au/q%2Ba/cache.htm+%22cache+buffers+lru+chain+latch%22+site:ixora.com.au&hl=en#7_03_2000 #!/usr/local/bin/perl -w #bh.pl: Rewrite buffer DBAs in a buffer dump trace in file#/block# format open BHDMP, "$ARGV[0]" or die "Can't open the buffer header dump file."; print "Translate buffer address to file/block number on $ARGV[0]\n\n"; while () { if (/^cold: (\w+) /) { print "hot/cold division is at $1.\n\n"; last; } } while () { if (/^\s\s\s\sBH #\d+ \(0x(\w+)\) file#: \d+ rdba: 0x\w{8} \((\d+\/\d+)\)/) { $bh{$1} = $2; #print "\$1: $1; \$2: $2.\n"; } } close BHDMP; $prtcnt = 0; print "The buffers are linked in this sequence (file#/block#):\n\n"; open BHDMP, "$ARGV[0]" or die "Can't open the buffer header dump file."; while () { if (/=>/) { @addr = split /=>/; foreach $addr (@addr) { foreach (keys %bh) { #print "\$addr: $addr.\n"; #print "\$_: $_.\n"; if ($addr eq $_) { print "$bh{$_} =>"; if ($prtcnt == 7) { print "\n"; $prtcnt = 0; } else { $prtcnt++; } } } } } } close BHDMP; __END__ The screen shot is like this: $ ls -l test_ora_7122.trc -rw-rw---- 1 oracle8 oinstall 5812707 Sep 13 17:57 test_ora_7122.trc $ bh.pl test_ora_7122.trc Translate buffer address to file/block number on test_ora_7122.trc hot/cold division is at 241be190. The buffers are linked in this sequence (file#/block#): 1/4612 =>1/183 =>1/1361 =>1/274 =>1/182 =>1/1872 =>1/2692 =>1/1734 => 1/1648 =>1/8842 =>1/6692 =>1/8961 =>1/8803 =>1/4685 =>1/4683 =>1/4682 => 1/4681 =>1/1553 =>1/1552 =>1/1551 =>1/1550 =>1/47 =>1/45 =>3/122 => 1/44 =>1/1868 =>1/1033 =>1/1426 =>1/1541 =>1/1345 =>1/1731 =>1/1610 => 1/1647 =>1/1030 =>1/1198 =>1/2560 =>1/4361 =>1/4655 =>1/4010 =>1/2453 => 1/971 =>1/5080 =>1/1025 =>1/4786 =>1/1235 =>1/1195 =>1/970 =>1/969 => 1/968 =>1/966 =>1/965 =>1/964 =>1/963 =>1/962 =>1/961 =>1/960 => 1/958 =>1/957 =>1/956 =>1/955 =>1/954 =>1/953 =>1/952 =>1/950 => 1/949 =>1/948 =>1/947 =>1/946 =>1/945 =>1/214 =>1/2559 =>1/306 => ^C Some notes. I assume that there're exactly 4 spaces in front of the word BH, that the buffer header hex address could be less than 8 digits long (see the example below 0x99f5a64) but in other places such as the relative data block address they're exactly 8 digits. Let me know if there's anything wrong. Do I need to find the file#/block# for the cold/hot division? I can't find the exact address in the second half of the trace file. Maybe it's between two addresses? Yong H. From: Steve Adams To: "yong huang" , Subject: RE: 8i Buffer Headers Dump & touch count Date: Tue, 17 Oct 2000 20:59:48 +1000 Hi Yong and George, I finally took some time to play with this Yong's bit of Perl code today. I have been using it to watch the effect of some of the hidden parameters. Here is the code as I've got at the moment. It turns out that it is not necessary to find the cold pointer, because one of the heading line says how many buffers are hot. ------------ cut here ------------ #!/usr/bin/perl if (@ARGV) { $trc = $ARGV[0]; } else { print "Trace file name: "; chomp($trc = <>); } open TRC, "$trc" or die "Can't open the buffer header dump file."; while () { if (/^\s\s\s\sBH #\d+ \(0x(\w+)\) file#: \d+ rdba: 0x\w{8} \((\d+\/\d+)\)/) { $bh{$1} = $2; } } close TRC; open TRC, "$trc" or die "Can't open the buffer header dump file."; while () { print $_ if (/^ .WS. /); if (/^cold:/) { s/^cold: (\w)+/ (WS)/; print $_; } if (/NEXT_DIRECTION/ && ! /NULL/) { s/ Queue.*//; print $_; $p = 1; next; } if ($p && /=>/) { chomp; foreach (split /=>/) { s/^0//; s/\r//; print "$bh{$_}\t"; } print "\n"; } else { $p = 0; } } close TRC; ------------ cut here ------------ > Hi guys, > > This is a fairly simple script really. All that it has to do is read the > second half of the dump file and remember the file and block number for each > buffer in an associative array/hash. For example, this line > > BH #1623 (0x99f5a64) file#: 1 rdba: 0x00401337 (1/4919) class 1 ba: > 0xa59b800 > > is for block 4919 of file 1 in a buffer at address 0x99f5a64. The same buffer > address will appear in one of the linked lists in the top half of the trace. > It is the third one here ... > > 099f5b74=>099f5aec=>099f5a64=>099f5954=>099f58cc=>099f5844=>099f57bc=>099f5734 > > (Prior to 8i, an 8 byte offset was needed to make the addresses match). > All we want is to reprint these linked lists showing the file and block > numbers instead of the buffer addresses, and show where the hot/cold division is. > That address comes after the "cold:" in this part of the header ... > > (WS_REPL_LIST) main_prev: 99e0d54 main_next: 99cee74 aux_prev: 99cedec > aux_next: 99bfc34curnum: 2511 auxnum: 456 > cold: 99cee74 hbmax: 1255 hbufs: 0 > > If you need any more info. Please feel free to contact me. > > Steve Adams