Oracle调优与深入之灌水篇
之一 :EVENT: CONTROLF EVENT: CONTROLF - Obtaining ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is also sometimes useful to: "ALTER DATABASE BACKUP CONTROLFILE TO TRACE". (From Oracle 7.1.x) *DUMP OF CONTROL FILES,
之一 :EVENT: CONTROLF
EVENT: CONTROLF - Obtaining & Interpreting ControlFile
Dumps
------------------------------------------------------------------------------
ALTER SESSION SET EVENTS 'immediate trace name controlf level 10';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is also sometimes useful to: "ALTER DATABASE BACKUP CONTROLFILE TO TRACE".
(From
Oracle 7.1.x)
*DUMP OF CONTROL FILES, Seq # 202417 = 316b1
* FILE HEADER:
Software vsn=117502976=700f400, Compatibility Vsn=117477376=7009000
Db Id=4188500840=f9a77368, Db Name='ECI_
RPT'
Control Seq=202417=316b1, File size=1238=4d6
File Number=0, Blksiz=512, File Type=4
==> Control Seq Control file sequence number
==> File Number No concept of file no for control files
==> File Size This files Size (blocks)
==> Blksiz This files block size
==> File Type (See k
clearcase/" target="_blank" >cc.h)
K
CCTYPCF 1 * control file *
KCCTYPRL 2 * redo log file *
KCCTYPDF 3 * vanilla db data file *
KCCTYPBC 4 * backup control file *
* DATABASE ENTRY:
(offset = 0x200, size = 144, max = 1, hi = 1)
DF Version: creation=0x700f400 compatable=0x700b000, Date 05/27/95 03:34:38
DB Name "ECI_RPT"
Database flags = 0x00000147
==> ^^^^^^^^^^^^^^^^^^^(kcc.h)
KCCDIMRE 0x0001 * whether media recovery enabled *
KCCDICKD 0x0002 * if dictionary must be checked with control file *
KCCDIR
LR 0x0004 * DB OPEN RESETLOGS required *
KCCDIJNK 0x0008 * junk value from beta - do not reuse this flag *
KCCDIMRC 0x0010 * was/is last mounted READ_COMPATIBLE *
KCCDICNV 0x0020 * control file was just created by convert from v6 *
KCCDIIRA 0x0040 * Incomplete Recovery Allowed when resetting logs *
KCCDIDBM 0x0080 * K_MLS - on next open DataBase Mac mode *
KCCDICCF 0x0100 * Controlfile was created with CREATE CONTROFILE *
Incmplt recovery scn: 0.06d3ac0c Resetlogs scn: 0.02811906 count: 0xc99f490
==> ^^^ Last Incomplete recovery ^^^ Last Resetlogs
Redo Version: creation=0x700f400 compatable=0x700c000
#Data files = 204, #Online files = 1
==> ^^^ Can derive no of OFFLINE files from these figures.
Database checkpoint: Thread=0 scn: 0.00000000
Threads: #Enabled=1, #Open=0, Head=0, Tail=0
enabled threads: 01000000 00000000 00000000 00000000 00000000 00000000 ...
Max log members = 4, Max data members = 1
Log hist = 0, Arch list: Head=0, Tail=0, Force scn: 0.00000000
==> ^^^^^^^^^ Size of Log history if being stored
* REDO THREAD ENTRIES:
(offset = 0x290, size = 92, max = 6, hi = 1)
* THREAD #1 - status:0x6 thread links forward:0 back:0
==> ^^^^(kcc.h)
KCCRTOPN 0x01 * set if thread is OPeN *
KCCRTENB 0x02 * set if thread is ENaBled *
KCCRTPUB 0x04 * set if thread is enabled PUBlicly *
#logs:3 first:1 last:3 current:3 last used seq#:0x0
enabled at scn: 0.00000000 01/01/88 00:00:00
Checkpointed at scn: 0.00000000 01/01/88 00:00:00
thread:0 rba:(0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000 ...
LOG FILE ENTRIES:
(offset = 0x4b8, size = 72, max = 96, hi = 3)
* LOG FILE #1:
(# 3) /opt/
oracle/ECI_RPT/redo_log1.dbf
Thread 1 redo log links: forward=2 backward=0
siz=0x64000 seq=0x0 hws=0x0 bsz=512 nab=0x0 flg=0x1
==> seq=Log Seq no, hws=Hdr write Seq# nab=Next available block (kcc.h)
==> flg: KCCLESPL 0x0001 * set if log file spooled *
KCCLENAL 0x0002 * set if No more ALocation may be done in log *
KCCLEUSM 0X0004 * if set USe Me as the next log to make current *
KCCLECUR 0x0008 * set if this is the current log *
Archive links: fwrd=0 back=0 Prev scn: 0.00000000
==> ^^^Low SCN of PREVIOUS log
Low scn: 0.00000000 01/01/88 00:00:00
==> ^^^SCN when log was switched INTO
Next scn: 0.00000000 01/01/88 00:00:00
==> ^^^SCN After redo in this log (Ie: should == low of NEXT log)
...
* DATA FILE #1:
(#207) /usr/support/oracle/m4/pms505676/system_1_bpk.dbf
size=51200 bsize=2048 status=x213 head=207 tail=207 dup=1
==> ^^^^(kcc.h)
KCCFESTS 0x0001 * belongs to System TableSpace *
KCCFEONL 0x0002 * file is ONLine *
KCCFERDE 0x0004 * ReaDing is Enabled *
KCCFECGE 0x0008 * ChanGing is Enabled *
KCCFEMRR 0x0010 * Media Recovery Required *
KCCFEGEM 0x0020 * Generate End hot backup Marker at next open *
KCCFECKD 0x0040 * File entry generated by check dictionary *
KCCFESOR 0x0080 * Save Offline scn Range at next checkpoint *
KCCFERMF 0x0100 * Renamed Missing File *
KCCFEGOI 0x0200 * Generate Off-line Immediate marker *
Checkpoint cnt:61191 scn: 0.06d3ac0c stop scn: ffff.ffffffff 05/27/95 03:34:39
==> Last Checkpoint SCN ^^^^^^^^^^^^^^ ^^^ Stop=fff implies OPEN or WARM backup
Creation Checkpointed at scn: 0.00000003 12/04/93 06:37:16
thread:0 rba:(0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
Offline scn: 0.00000000
Online Checkpointed at scn: 0.00000000 01/01/88 00:00:00
thread:0 rba:(0.0.0)
...
之二 :EVENT: FILE_HDRS
EVENT: FILE_HDRS - Obtaining & Interpreting File Header
Dumps
------------------------------------------------------------------------------
ALTER SESSION SET EVENTS 'immediate trace name file_hdrs level 10';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(From Oracle 7.1.x)
*DUMP OF DATA FILES: 209 files in database
*DATA FILE #1: ------------ NB: Here down is the control file info ---------
(#207) /usr/support/oracle/m4/pms505676/system_1_bpk.dbf
size=51200 bsize=2048 status=x213 head=207 tail=207 dup=1
==> ^^^^(kcc.h)
KCCFESTS 0x0001 * belongs to System TableSpace *
KCCFEONL 0x0002 * file is ONLine *
KCCFERDE 0x0004 * ReaDing is Enabled *
KCCFECGE 0x0008 * ChanGing is Enabled *
KCCFEMRR 0x0010 * Media Recovery Required *
KCCFEGEM 0x0020 * Generate End hot backup Marker at next open *
KCCFECKD 0x0040 * File entry generated by check dictionary *
KCCFESOR 0x0080 * Save Offline scn Range at next checkpoint *
KCCFERMF 0x0100 * Renamed Missing File *
KCCFEGOI 0x0200 * Generate Off-line Immediate marker *
Checkpoint cnt:61191 scn: 0.06d3ac0c stop scn: ffff.ffffffff 05/27/95 03:34:39
==> ^^^Stop=ffff implies OPEN,ABORT or WARM
Creation Checkpointed at scn: 0.00000003 12/04/93 06:37:16
thread:0 rba:(0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000 ...
Offline scn: 0.00000000
Online Checkpointed at scn: 0.00000000 01/01/88 00:00:00
thread:0 rba:(0.0.0)
enabled threads: 00000000 00000000 00000000 00000000 00000000 00000000 ...
* FILE HEADER: ------------Here down is from the file header------------------
Software vsn=117502976=700f400, Compatibility Vsn=117485568=700b000
Db Id=4188500840=f9a77368, Db Name='ECI_PD' ^^^ Oldest Usable Oracle Vers
Control Seq=202416=316b0, File size=51200=c800
==> ^^^ Should be <= to Seq# in control file.
File Number=1, Blksiz=2048, File Type=3
==> ^^^^^^^^^^^(kcc.h)
KCCTYPCF 1 * control file *
KCCTYPRL 2 * redo log file *
KCCTYPDF 3 * vanilla db data file *
KCCTYPBC 4 * backup control file *
Creation at scn: 0.00000003 12/04/93 06:37:16
Backup taken at scn: 0.06d3978c 05/27/95 02:15:20 thread:1
==>^^^^^ Last ALTER TABLESPACE BEGIN BACKUP
reset logs count:0xc99f490 scn: 0.02811906 recovered at 06/21/95 12:14:05
==>^^^^^ Last ALTER DATABASE OPEN RESETLOGS
status:0x101 root dba:0x04000179 chkpt cnt: 61191 ctl cnt:61190
==>^^^^^ (kcv.h)
KCVFHHBP 0x01 * hotbackup-in-progress on file (fuzzy file) *
KCVFHHBM 0x02 * end hot backup marker encountered *
KCVFHOFZ 0x04 * Online FuZzy because it was online and db open *
KCVFHCRM 0x08 * crash recovery marker encountered *
KCVFHMFZ 0x10 * Media recovery FuZzy - file in media recovery *
KCVFHCMF 0x20 * Clear Media recovery Fuzzy at end of recovery *
KCVFHSTS 0x100 * system table space. This bit belongs to kcf *
KCVFHFMH 0x200 * Freshly Munged Header. resetlogs not finished *
Checkpointed at scn: 0.06d3ac0c 05/27/95 03:25:53
thread:1 rba:(864.2.0)
==>^^^^^ Last Datafile checkpoint & its REDO address.
enabled threads: 01110000 00000000 00000000 00000000 00000000 00000000 ...
==>^^^^^^ Threads of redo - thread 1,2 and 3 in use here
之三 :EVENT: REDOHDR
EVENT: REDOHDR - Obtaining & Interpreting Redo Header
Dumps
------------------------------------------------------------------------------
ALTER SESSION SET EVENTS 'immediate trace name redohdr level 10';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(From Oracle 7.1.x)
*DUMP OF LOG FILES: 4 logs in database
*LOG FILE #1:
(# 1) /dev/usupport/redo2
Thread 1 redo log links: forward=2 backward=0
siz=0x1800 seq=0x47 hws=0x2 bsz=512 nab=0xffffffff flg=0x8
==> hws=Hdr write seq, nab=Next available block,
==> flg: KCCLESPL 0x0001 * set if log file spooled *
KCCLENAL 0x0002 * set if No more ALocation may be done in log *
KCCLEUSM 0X0004 * if set USe Me as the next log to make current *
KCCLECUR 0x0008 * set if this is the current log *
Archive links: fwrd=0 back=0 Prev scn: 275.f1716c52
Low scn: 275.f1716c5e 06/21/95 10:30:12
Next scn: ffff.ffffffff 06/20/95 14:36:09
FILE HEADER:
Software vsn=118514176=7106200, Compatibility Vsn=117489664=700c000
Db Id=3615166773=d77b1135, Db Name='P716DB'
Control Seq=6539=198b, File size=6144=1800
File Number=1, Blksiz=512, File Type=2
==> ^^^^^^^^^^^(kcc.h)
KCCTYPCF 1 * control file *
KCCTYPRL 2 * redo log file *
KCCTYPDF 3 * vanilla db data file *
KCCTYPBC 4 * backup control file *
descrip:"Thread 0001, Seq# 0000000071, SCN 0x0275f1716c5e-0xffffffffffff"
thread:1 nab:0xffffffff seq:0x47 hws:0x2 eot:1 dis:0
==> hws=Hdr write seq, nab=Next available block,
==> ^^^(kcrfh.h)
KCRFHENOT 0 * NOT end of thread *
KCRFHEPUB 1 * End of thread for PUBLIC thread *
KCRFHEPVT 2 * End of thread for PRIVATE thread *
==> dis=TRUE if thread disabled at end of this log.
reset logs count:0xe28f6a6 scn: 275.efd7b37b
Low scn: 275.f1716c5e 06/21/95 10:30:12
Next scn: ffff.ffffffff 06/20/95 14:36:09
Enabled scn: 275.efd7b37b 05/22/95 14:26:45
Thread closed scn: 275.f1716c5e 06/21/95 10:30:12
之四 :EVENT: BLOCKDUMP
EVENT: - Interpreting
------------------------------------------------------------------------------
Oracle BLOCK DUMP (Oracle 7.2.x) See <Note:33242.1> for Physical Layout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is a block header for any blockdump. It determines the format of the
rest of the dump. At the head of any Oracle blockdump you should see a
block header thus:
buffer dba: 0x08000106 inc: 0x00001001 seq: 0x000087ce
ver: 1 type: 1=KTU UNDO HEADER
==> dba DBA of the block. See <Note:33311.1>
==> inc Incarnation number
==> seq Sequence No
==> ver Version number. Should be 1
==> type Block type as defined in k.h:
Id Type Example
~~ ~~~~ ~~~~~~~
1 = KTU UNDO HEADER <Note:33187.1>
2 = KTU UNDO BLOCK <Note:33186.1>
3 = SAVE UNDO HDR
4 = SAVE UNDO BLOCK
5 = DATA SEG HDR <Note:31258.1>
6 = KTB MANAGED (with ITL)
DATA Table data <Note:28983.1>
Migrated Row: <Note:33189.1>
Cluster <Note:52508.1>
INDEX Branch: <Note:41794.1>
Leaf: <Note:33190.1>
Bitmap Leaf: <Note:41793.1>
7 = TEMP DATA (no itl)
8 = SORT KEY
9 = SORT RUN
10 = SEG FREE LIST
11 = DATA FILE HDR
12 = DATA SEG HDR with Free List Groups
13 = Compatibility SEG
-- Here onwards are for UNLI
MITED EXTENTS --
14 = unlimited undo segment header
15 = unlimited save undo segment header
16 = unlimited data segment header
17 = unlimited data segment header with flg blks
18 = extent map block
19 = backup set piece header
20 = backup set directory block
21 = control file block
22 = segment free list block with #blks in freelists
-- Bitmap segments etc.. --
23 = bitmapped segment header
24 = bitmapped freelist block
25 = bitmap index block
26 = bitmap block
27 = LOB block
之五 :Data Segment Header
QREF: Blockdump - Data Segment Header
------------------------------------------------------------------------------
This is part of a set of related blockdumps. Where you see <<Note.X.X>>>
you can follow the link to see the related information.
SEGMENT HEADER BLOCK DUMP See <Note:28983.1> for the Data Block.
~~~~~~~~~~~~~~~~~~~~~~~~~ See <Note:33188.1> for other block types.
buffer dba: 0x24000922 inc: 0x00000635 seq: 0x00000007
ver: 1 type: 5=DATA SEGMENT HEADER
==> type Block type. See <Note:33188.1> for other types.
nfl = 1, nfb = 1
==> nfl No free list
==> nfb No freelist groups ?
EXT CTL:: nex: 1 cex: 0 ces: 4
cbk: 2
lock value: U
==> nex Number of Extents allocated in the Extent table (below)
==> cex Current extent )
==> cb Current block in current extent ) High Water Mark
==> ces Current extent size (blocks)
==> Extent Table:
EXT TBL:: nbk: 4 dba: 0x24000923
==> nbk Number of blocks available in the extent
NB: The first extent has the segment header allocated from it
This is really a 5 block extent (block 1 is seg hdr)
==> dba DBA of first block in the extent
==> Free list
SEG LST:: flg: USED lhd: 0x24000924 ltl: 0x24000924
==> lhd Head DBA of free list
==> ltl Tail DBA of free list
==> NB: Not all blocks in an extent are formatted if not yet used.
==> Only those on the free list. Blocks in the last extent and NOT
==> on the freelist may contain all zeroes
之六 :Blockdump - Data Block
> QREF: Blockdump - Data Block
------------------------------------------------------------------------------
DATA BLOCK DUMP (Oracle 7.2.x) See <Note:33190.1> for INDEX leaf block.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <Note:31258.1> for Segment Header.
<Note:33243.1> OS dump of this block.
<Note:33188.1> for other block types.
Block header dump: dba: 0x24000923
Object id on Block? Y
seg/obj: 0xc0b csc: 0x2f0.4045f9ea itc: 1 flg: - typ: 1 - DATA
fsl: 0 fnx: 0x0
==> Seg/obj Object ID in dictionary
==> csc SCN of last block cleanout
==> itc Number of ITL slots
==> flg O = On freelist
==> typ 1 = DATA 2 = INDEX
==> fsl ITL TX freelist slot
==> fnx DBA of NEXT block on freelist
==> Transaction table (below) controls concurrency:
==> Itl ITL Index no (No ITLS determined by INITRANS and MAXTRANS)
==> Xid Transaction ID (UndoSeg.Slot.Wrap)
==> Uba Undo Address (UndoDBA.SeqNo.RecordNo)
==> Flg C = Committed U = Commit Upper Bound T = Active at CSC
B = Rollback of this UBA gives before image of the ITL.
Flag combinations include:
CB-- Tx is committed, Rollback of this UBA gives prev ITL.
---- Active TX - look at RBS header to see if really active
--U- If lck=0 block is cleaned out with Upper Bound Commit.
If lck!=0 (7.3) Scn is FSC.Scnbase. This is delayed logging
block cleanout - see <Parameter:DELAYED_LOGGING_BLOCK_CLEANOUTS>
The FSC cannot be discarded.
==> Lck No Rows affected by this transaction
==> Scn/Fsc Scn=SCN of commited TX, Fsc=Free space credit (bytes)
Fsc overlaps the SCN Wrap when present.
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0004.00e.0000017f 0x08000592.00a0.0b ---- 2 fsc 0x001d.00000000
<<Note:33187.1>> <<Note:33186.1>> ^2 rows locked
data_block_dump
=============== ==> First 4 lines are derived
tsiz: 0x7b8 ==> Total Data Area size
hsiz: 0x1a ==> Data header size (16+#tabs*2 + #rows*2)
pbl: 0x00635884 ==> ptr to buffer holding the block
bdba: 0x24000923 ==> Block DBA
flag=--------- ==> N=pctfree hit (clusters),F=dont put on freelist
K=flushable cluster keys
ntab=1 ==> N tables (>1 for clusters)
nrow=4 ==> N rows
frre=-1 ==> First free row index entry, -1=you have to add one
fsbo=0x1a ==> Free space Begin Offset
fseo=0x320 ==> Free space END offset
avsp=0x330 ==> Available space in the block
tosp=0x34d ==> Total available space when all TXs commit
0xe:pti[0] nrow=4 offs=0 ==> N rows for 1st table
0x12:pri[0] offs=0x792 ==> ROW INDEX (offset:pri[ROWNUM])
0x14:pri[1] offs=0x766 ==> offs==Offset in block.
0x16:pri[2] offs=0x320 ==> sffl==Next free slot (Row index number)
0x18:pri[3] offs=0x71c ==> sffl form a chain of free slots, last=-1
block_row_dump:
tab 0, row 0, @0x792 ==> Table 0, row 0, offset
tl: 9 fb: --H----- lb: 0x1 cc: 0
nrid: 0x24000924.0 ==> NEXT rowid for this row. Migrated row.
<<Note:33189.1>>
==> tl Row size (header+data)
==> fb Flag Byte: - This is H: head piece of row ONLY
K = Cluster Key (Flags may change meaning
if this is set to show HASH cluster)
C = Cluster table member
H = Head piece of row
D = Deleted row
F = First data piece
L = Last data piece
P = First column continues from previous piece
N = Last column continues in next piece
==> lb Lock Byte - ITL entry that has this row locked
(follow XID to segment header to see if its committed)
==> cc Number columns in this row PIECE (not in the ROW)
==>
==> Depending on flags:
==> nrid NEXT ROWID for this row
==> hrid HEAD ROWID for this row
tab 0, row 1, @0x766
tl: 44 fb: --H-FL-- lb: 0x0 cc: 5 ==> Complete row (Head,First,Last)
col 0: [ 4] 52 4f 57 32 ==> VarChar2 data. Use 'unod' to view it.
See <<Note:33183.1>>.
col 1: [13] 54 52 41 49 4c 49 4e 47 20 4e 55 4c 4c
col 2: [ 7] 77 c4 01 01 01 01 01 ==> DATE data. Use 'oranum' to decode.
col 3: [ 2] c4 02 ==> Number data. Use 'oranum' to decode.
For 'oranum' see <<Note:33184.1>>
col 4: [10] 31 2c 30 30 30 2c 30 30 30 20
==> ^^^^ Note: size here is the column length for this PIECE not the COLUMN
==> Note there are only 5 columns - trailing columns are assumed NULL
tab 0, row 2, @0x320
tl: 1020 fb: --H-FL-- lb: 0x1 cc: 6 ==> 1020 bytes long, locked, 6 cols
col 0: [ 4] 52 4f 57 33
col 1: [11] 42 49 47 20 50 41 44 44 49 4e 47
col 2: [ 7] 77 c4 0c 1f 01 01 01
col 3: [ 2] c1 02
col 4: [10] 31 20 20 20 20 20 20 20 20 20 ==> CHAR data. Note trailing blanks
col 5: [975]
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
.... Repeated many times
tab 0, row 3, @0x71c
tl: 32 fb: --H-FL-- lb: 0x0 cc: 4 ==> 32 bytes long, Full row piece, 4 cols.
col 0: [ 4] 52 4f 57 34
col 1: [13] 43 48 41 52 20 49 53 20 45 4d 50 54 59
col 2: [ 7] 77 c4 0c 1f 01 01 01
col 3: [ 1] 80 ==> '80' is a NULL
end_of_block_dump
原文转自:http://www.ltesting.net
|