Upload
miguelangelmirandarios1109
View
214
Download
0
Embed Size (px)
Citation preview
8/10/2019 t 99 Tuning Stats Pack
1/177
8/10/2019 t 99 Tuning Stats Pack
2/177
8/10/2019 t 99 Tuning Stats Pack
3/177
8/10/2019 t 99 Tuning Stats Pack
4/177
8/10/2019 t 99 Tuning Stats Pack
5/177
8/10/2019 t 99 Tuning Stats Pack
6/177
8/10/2019 t 99 Tuning Stats Pack
7/177
8/10/2019 t 99 Tuning Stats Pack
8/177
8/10/2019 t 99 Tuning Stats Pack
9/177
8/10/2019 t 99 Tuning Stats Pack
10/177
8/10/2019 t 99 Tuning Stats Pack
11/177
8/10/2019 t 99 Tuning Stats Pack
12/177
8/10/2019 t 99 Tuning Stats Pack
13/177
8/10/2019 t 99 Tuning Stats Pack
14/177
8/10/2019 t 99 Tuning Stats Pack
15/177
8/10/2019 t 99 Tuning Stats Pack
16/177
8/10/2019 t 99 Tuning Stats Pack
17/177
8/10/2019 t 99 Tuning Stats Pack
18/177
8/10/2019 t 99 Tuning Stats Pack
19/177
8/10/2019 t 99 Tuning Stats Pack
20/177
8/10/2019 t 99 Tuning Stats Pack
21/177
8/10/2019 t 99 Tuning Stats Pack
22/177
8/10/2019 t 99 Tuning Stats Pack
23/177
8/10/2019 t 99 Tuning Stats Pack
24/177
8/10/2019 t 99 Tuning Stats Pack
25/177
8/10/2019 t 99 Tuning Stats Pack
26/177
8/10/2019 t 99 Tuning Stats Pack
27/177
8/10/2019 t 99 Tuning Stats Pack
28/177
8/10/2019 t 99 Tuning Stats Pack
29/177
8/10/2019 t 99 Tuning Stats Pack
30/177
8/10/2019 t 99 Tuning Stats Pack
31/177
8/10/2019 t 99 Tuning Stats Pack
32/177
8/10/2019 t 99 Tuning Stats Pack
33/177
8/10/2019 t 99 Tuning Stats Pack
34/177
8/10/2019 t 99 Tuning Stats Pack
35/177
8/10/2019 t 99 Tuning Stats Pack
36/177
8/10/2019 t 99 Tuning Stats Pack
37/177
8/10/2019 t 99 Tuning Stats Pack
38/177
8/10/2019 t 99 Tuning Stats Pack
39/177
8/10/2019 t 99 Tuning Stats Pack
40/177
8/10/2019 t 99 Tuning Stats Pack
41/177
8/10/2019 t 99 Tuning Stats Pack
42/177
8/10/2019 t 99 Tuning Stats Pack
43/177
8/10/2019 t 99 Tuning Stats Pack
44/177
8/10/2019 t 99 Tuning Stats Pack
45/177
8/10/2019 t 99 Tuning Stats Pack
46/177
8/10/2019 t 99 Tuning Stats Pack
47/177
8/10/2019 t 99 Tuning Stats Pack
48/177
8/10/2019 t 99 Tuning Stats Pack
49/177
8/10/2019 t 99 Tuning Stats Pack
50/177
8/10/2019 t 99 Tuning Stats Pack
51/177
8/10/2019 t 99 Tuning Stats Pack
52/177
8/10/2019 t 99 Tuning Stats Pack
53/177
8/10/2019 t 99 Tuning Stats Pack
54/177
8/10/2019 t 99 Tuning Stats Pack
55/177
8/10/2019 t 99 Tuning Stats Pack
56/177
8/10/2019 t 99 Tuning Stats Pack
57/177
8/10/2019 t 99 Tuning Stats Pack
58/177
8/10/2019 t 99 Tuning Stats Pack
59/177
8/10/2019 t 99 Tuning Stats Pack
60/177
8/10/2019 t 99 Tuning Stats Pack
61/177
8/10/2019 t 99 Tuning Stats Pack
62/177
8/10/2019 t 99 Tuning Stats Pack
63/177
8/10/2019 t 99 Tuning Stats Pack
64/177
8/10/2019 t 99 Tuning Stats Pack
65/177
8/10/2019 t 99 Tuning Stats Pack
66/177
8/10/2019 t 99 Tuning Stats Pack
67/177
8/10/2019 t 99 Tuning Stats Pack
68/177
8/10/2019 t 99 Tuning Stats Pack
69/177
8/10/2019 t 99 Tuning Stats Pack
70/177
8/10/2019 t 99 Tuning Stats Pack
71/177
8/10/2019 t 99 Tuning Stats Pack
72/177
8/10/2019 t 99 Tuning Stats Pack
73/177
8/10/2019 t 99 Tuning Stats Pack
74/177
8/10/2019 t 99 Tuning Stats Pack
75/177
8/10/2019 t 99 Tuning Stats Pack
76/177
8/10/2019 t 99 Tuning Stats Pack
77/177
8/10/2019 t 99 Tuning Stats Pack
78/177
8/10/2019 t 99 Tuning Stats Pack
79/177
8/10/2019 t 99 Tuning Stats Pack
80/177
8/10/2019 t 99 Tuning Stats Pack
81/177
8/10/2019 t 99 Tuning Stats Pack
82/177
8/10/2019 t 99 Tuning Stats Pack
83/177
8/10/2019 t 99 Tuning Stats Pack
84/177
8/10/2019 t 99 Tuning Stats Pack
85/177
8/10/2019 t 99 Tuning Stats Pack
86/177
8/10/2019 t 99 Tuning Stats Pack
87/177
8/10/2019 t 99 Tuning Stats Pack
88/177
8/10/2019 t 99 Tuning Stats Pack
89/177
8/10/2019 t 99 Tuning Stats Pack
90/177
8/10/2019 t 99 Tuning Stats Pack
91/177
8/10/2019 t 99 Tuning Stats Pack
92/177
8/10/2019 t 99 Tuning Stats Pack
93/177
Investigate Reaction To Changes
8/10/2019 t 99 Tuning Stats Pack
94/177
Dale Roberts94
Identify Solutions
8/10/2019 t 99 Tuning Stats Pack
95/177
Dale Roberts95
Verify Solution
8/10/2019 t 99 Tuning Stats Pack
96/177
Dale Roberts96
Verify Improvements
8/10/2019 t 99 Tuning Stats Pack
97/177
Dale Roberts97
Rank Findings
8/10/2019 t 99 Tuning Stats Pack
98/177
Dale Roberts98
Provide Expert Advice
8/10/2019 t 99 Tuning Stats Pack
99/177
Dale Roberts99
Block Dumps
8/10/2019 t 99 Tuning Stats Pack
100/177
Dale Roberts100
Block Dumps
Last Resort - Block Dumps
8/10/2019 t 99 Tuning Stats Pack
101/177
Dale Roberts101
select f i le_id , b loc k_id, b loc ksf rom dba_extentsw here segm ent_nam e = 'EMP'
and ow ner = 'SCOTT';
FILE_ID BLOCK_ID BLOCKS
----------- --------------- ------------1 50465 3
Last Resort - Block Dumps
8/10/2019 t 99 Tuning Stats Pack
102/177
Dale Roberts102
ALTER SYSTEM DUMP DATAFILE 5 BLOCK50465
/
ALTER SYSTEM DUMP DATAFILE 5 BLOCK50466 /
ALTER SYSTEM DUMP DATAFILE 5 BLOCK
50467 /Or
8/10/2019 t 99 Tuning Stats Pack
103/177
Last Resort - Block Dumps
8/10/2019 t 99 Tuning Stats Pack
104/177
Dale Roberts104
select *f rom em pw here ename = 'MILL ER';
EMPNO ENAME JOB MGR HIREDATE SAL COMMDEPTNO
---------- -------------- ------------ --------- ------------------- -------- -------- --- --------------
7934 MILL ER CL ERK 7782 23-JA N-82 130010
Block Dumps output from udump
8/10/2019 t 99 Tuning Stats Pack
105/177
Dale Roberts105
tab 0, row 13, @0x1b0btl: 39 fb: --H-FL-- lb: 0x0 cc: 8col 0: [ 3] c2 50 23col 1: [ 6] 4d 49 4c 4c 45 52col 2: [ 5] 43 4c 45 52 4bcol 3: [ 3] c2 4e 53col 4: [ 7] 77 b6 01 17 01 01 01col 5: [ 2] c2 0ecol 6: *NULL*col 7: [ 2] c1 0b
Block Dumps Data Section
8/10/2019 t 99 Tuning Stats Pack
106/177
Dale Roberts106
DUMP OUTPUT - EMPNO:col 0: [ 3] c2 50 23
Hex to Decimal: Col0 = EMPNO = 793450 (Hex) = 80 (Decimal) 1 = 7923 (Hex) = 35 (Decimal) 1 = 34c2: Number in the thousands (c2 is exponent)
Block Dumps Data Section
8/10/2019 t 99 Tuning Stats Pack
107/177
Dale Roberts107
DUMP OUTPUT - ENAME:
col 1: [ 6] 4d 49 4c 4c 45 52
Hex to Character: Col1 = ENAME = MILLER4d (Hex) = M (Character)49 (Hex) = I (Character)
4c (Hex) = L (Character)4c (Hex) = L (Character)45 (Hex) = E (Character)52 (Hex) = R (Character)
8/10/2019 t 99 Tuning Stats Pack
108/177
Dale Roberts108
Transactions Moving throughOracle: ITL & Undo Blocks
Working with Hash BucketsAnd Buffer Headers (not buffers)
8/10/2019 t 99 Tuning Stats Pack
109/177
Dale Roberts
( C h a
i n L a
t c h )
n
1
2
3
Buffer Headers
BufferHeader
HashBuckets
And Buffer Headers (not buffers)
Users asks for a specific datablock address. This is hashed with a
hashing algorithm and placedin the hash bucket that ithashes to. It walks the hash chain using
the cache buffers chain latchto find the block that it needs(curr or cr). There can be many versions
of each block
and hashing data blockaddresses
8/10/2019 t 99 Tuning Stats Pack
110/177
Dale Roberts110
addresses
Example: _DB_BLOCK_HASH_BUCKETS(shouldnt have to change this in Oracle9i or 10g)
Buffer hash table (x$bh) has all buffer headers for alldb_block buffers.Buffer header ties to memory base address of the buffer.Buckets usually set to Prime(2*db_block_buffers)A prime number is often used to avoid hashing anomaliesObjects dba (class) is hashed to a hash bucket on the hashchainGet enough hash buckets (_db_block_hash_buckets)Blocks assigned to a hash bucket and onto the hash chainCould have multiple blocks hashed to same chain (if bothhot-issues)Can have multi le versions of a block on same chain
8/10/2019 t 99 Tuning Stats Pack
111/177
EMP1 is Block#: 56650(all rows are in this block)
8/10/2019 t 99 Tuning Stats Pack
112/177
Dale Roberts112
(all rows are in this block)
select rowid,empno,dbms_rowid.rowid_relative_fno(rowid) fileno,dbms_rowid.rowid_block_number(rowid) blockno,dbms_rowid.rowid_row_number(rowid) rowno, rownum,rpad(to_char(dbms_rowid.rowid_block_number(rowid), 'FM0xxxxxxx') || '.' ||
to_char(dbms_rowid.rowid_row_number (rowid), 'FM0xxx' ) || '.' ||to_char(dbms_rowid.rowid_relative_fno(rowid), 'FM0xxx' ), 18) myridfrom emp1;ROWID EMPNO FILENO BLOCKNO ROWNO ROWNUM------------------ ---------- ---------- ---------- ---------- ----------MYRID------------------AAAM4cAABAAAN1KAAA 7369 1 56650 0 10000dd4a.0000.0001
AAAM4cAABAAAN1KAAB 7499 1 56650 1 20000dd4a.0001.0001 AAAM4cAABAAAN1KAAN 7934 1 56650 13 140000dd4a.000d.0001
14 rows selected.
(So far its clean and only 1copy)
8/10/2019 t 99 Tuning Stats Pack
113/177
Dale Roberts113
copy)
select lrba_seq, state, db arfil , db ablk, tch , f lag, hs cn _bas,cr_scn _bas,dec od e(bi tand (flag,1), 0, 'N', 'Y') di rty , /* Dirty bi t */dec od e(bi tand (flag,16), 0, 'N', 'Y') tem p, /* tem po rary bi t */dec od e(bi tand (flag,1536), 0, 'N', 'Y') pi ng , /* pi ng (to sh ared o r nu ll) bit */
dec ode(b itan d (flag,16384), 0, 'N', 'Y') s tale, /* s tale bi t */dec od e(bi tand (flag,65536), 0, 'N', 'Y') di rect , /* di rect acc ess bit */dec od e(bi tand (flag,1048576), 0, 'N', 'Y') new /* new bi t */
f rom x$bhw here db ablk = 56650
order by dbablk;
LRBA_SEQ STATE DBARFIL DBABLK TCH FLAG HSCN_BAS---------- ---------- ---------- ---------- ---------- ---------- ----------CR_SCN_BAS D T P S D N---------- - - - - - -
0 1 1 56650 0 35659776 4294967295
0 N N N N N N
8/10/2019 t 99 Tuning Stats Pack
114/177
Dale Roberts
L o g
B u
f f e r s
( C h a
i n L a
t c h )
n
1
2
3
S h a r e
d P o o l
SGA
Cache BuffersBuffer Cache
BufferHeader
HashBuckets
Only ONE blockon the HashChain!
header(Delete a row)
8/10/2019 t 99 Tuning Stats Pack
115/177
Dale Roberts115
(Delete a row)
delete f ro m em p1w here co m m = 0;
on e row d eleted.
header(Make some changes 2 copies)
8/10/2019 t 99 Tuning Stats Pack
116/177
Dale Roberts116
(Make some changes 2 copies)
select lrba_seq, state, db arfil , db ablk, tch , f lag, hs cn _bas,cr_scn _bas,dec od e(bit and (flag,1), 0, 'N', 'Y') dir ty , /* Dirt y bit */dec od e(bi tand (flag,16), 0, 'N', 'Y') tem p, /* tem po rary bi t */dec od e(bi tand (flag,1536), 0, 'N', 'Y') pin g, /* ping (to sh ared o r nu ll) bit */dec ode(b itan d (flag,16384), 0, 'N', 'Y') st ale, /* s tale b it */
dec od e(bi tand (flag,65536), 0, 'N', 'Y') dir ect, /* di rect acc ess bi t */dec od e(bi tand (flag,1048576), 0, 'N', 'Y') new /* new bit */f rom x$bhw here db ablk = 56650order by db ablk;
LRBA_SEQ STATE DBARFIL DBABLK TCH FLAG HSCN_BAS---------- ---------- ---------- ---------- ---------- ---------- ----------CR_SCN_BAS D T P S D N---------- - - - - - -
0 1 1 56650 1 8200 42949672950 N N N N N N
0 3 1 56650 2 524288 04347881 N N N N N N
8/10/2019 t 99 Tuning Stats Pack
117/177
Dale Roberts
L o g
B u
f f e r s
( C h a
i n L a
t c h )
n
1
2
3
S h a r e
d P o o l
SGA
Cache BuffersBuffer Cache
BufferHeader
HashBuckets
Hash Chain isnow TWO! Oneis a CR and theother is Current.
(created when transactions haveundo)
8/10/2019 t 99 Tuning Stats Pack
118/177
Dale Roberts118
undo)
SELECT t.addr, t .xidu sn USN, t .xidslo t SLOT, t .xids qn SQL, t .status ,t .used_ublk UBL K, t .used_urec UREC, t . log_io LOG,t.phy _io PHY, t.cr_get, t.cr_c hang e CR_CHA
FROM v$transaction t , v$session sWHERE t.addr = s. tadd r;
ADDR USN SLOT SQL STATUS UBLK-------- ---------- ---------- ---------- ---------------- ----------
UREC LOG PHY CR_GET CR_CHA---------- ---------- ---------- ---------- ----------69E50E5C 5 42 652 ACTIVE 1
1 3 0 3 0
USN is the Undo Segment Number (rollback segment ID)SLOT is the slot number in the rollback segments transaction table.SQN (Wrap) is the sequence number for the transaction.
USN+SLOT+SQN are the three values that uniquely identifies a
Dump the block
8/10/2019 t 99 Tuning Stats Pack
119/177
Dale Roberts119
Dump the b lockIt l Xid Uba Flag Lc k
Scn/Fsc
0x01 0x0005.02a.0000028c 0x008000af.02b6.01 ---- 1 fs c
0x0029.000000000x02 0x0004.016.00000fae 0x008000cc .08af.34 C--- 0 s cn
0x0000.003deb5bITL 2 InterestedTransaction Lists
Transaction IDUndo 5 = 5 (decimal)Slot 2a = 42 (decimal)
SEQ 28C = 652
UBA:File.block.sequence.recordUndo block address wherelast change is recorded.
The row Ideleted is stilllocked; fsc is
0x29 = 41 bytes
CommittedTransaction
x$bh up to the max of 6 versionsof block
8/10/2019 t 99 Tuning Stats Pack
120/177
Dale Roberts120
of block
LRBA_SEQ STATE DBARFIL DBABLK TCH FLAG HSCN_BAS---------- ---------- ---------- ---------- ---------- ---------- ----------CR_SCN_BAS D T P S D N---------- - - - - - -
0 3 1 56650 1 524416 04350120 N N N N N N
0 3 1 56650 1 524416 04350105 N N N N N N
365 1 1 56650 7 33562633 43501210 Y N N N N N
0 3 1 56650 1 524416 04350103 N N N N N N
0 3 1 56650 1 524416 04350089 N N N N N N
0 3 1 56650 1 524288 04350087 N N N N N N
8/10/2019 t 99 Tuning Stats Pack
121/177
Dale Roberts
L o g
B u
f f e r s
( C h a
i n L a
t c h )
n
1
2
3
S h a r e
d P o o l
SGA
Cache BuffersBuffer Cache
BufferHeader
HashBuckets
Hash Chain isnow SIX long!Five CR and theone Current.
Why only 6 versions of aBlock?
8/10/2019 t 99 Tuning Stats Pack
122/177
Dale Roberts122
Block?
select a .ksp pinm , b.kspp stvl , b .kspp stdf , a .ksp pd escfrom x$ksppi a , x$ksppc v bw here a .indx = b.indxand su bs tr(ksp pin m ,1,1) = '_'
and kspp inm l ike '%&1%'order by kspp inm ;
KSPPINM-------------------------------------------------------------------------------KSPPSTVL-------------------------------------------------------------------------------KSPPSTDF---------KSPPDESC-------------------------------------------------------------------------------
_db_block_max_cr_dba6TRUE
Maximum Allowed Number of CR buffers per dba
everything back x$bh Still anLRBA:
8/10/2019 t 99 Tuning Stats Pack
123/177
Dale Roberts123
LRBA_SEQ STATE DBARFIL DBABLK TCH FLAG HSCN_BAS---------- ---------- ---------- ---------- ---------- ---------- ----------CR_SCN_BAS D T P S D N---------- - - - - - -
0 3 1 56650 1 524416 04350120 N N N N N N
0 3 1 56650 1 524416 04350105 N N N N N N
365 1 1 56650 11 35659777 43507020 Y N N N N N
0 3 1 56650 1 524416 04350103 N N N N N N
0 3 1 56650 1 524416 04350089 N N N N N N
0 3 1 56650 1 524288 04350087 N N N N N N
6 rows selected.
match it up to ITL (no need todump)
8/10/2019 t 99 Tuning Stats Pack
124/177
Dale Roberts124
p)
select x idu sn , x id s lot , x ids qn , ub af i l , ub ablk,ub asq n, ub arec
f rom v$transac t ion t , v$sess ion sw here t .ses_add r = s .sadd r;
XIDUSN XIDSLOT XIDSQN UBAFIL UBABLK UBASQN UBAREC
---------- ---------- ---------- ---------- ---------- ---------- ----------4 42 4863 2 851 2718 85 14 667 2 1458 713 25
4.42.4863 = 4.2a.12ff 2.851.2718.8 = 800353.a9e.85.14.667 = 5.e.29b 2.1458.713.25 = 8005b2.2c9.19
Itl Xid Uba F lag Lck Scn/Fsc0x02 0x0004.02a.000012ff 0x00800353.0a9e.08 ---- 2 fs c 0x0003.00000000
0x03 0x 0005.00e.0000029b 0x008005b 2.02c9.19 ---- 14 fs c 0x0000.00000000
Row Level Locks
Cache Layer
Transaction Identifiers
8/10/2019 t 99 Tuning Stats Pack
125/177
Dale Roberts125
( C h a
i n L a
t c h )
n
1
3
Cache Buffers
BufferHeader
HashBuckets
LRU Lists LRU Write List
DBWrite
1
2
3
L o g
B u
f f e r sUserRequest
S h a r e
d P
o o
l
SGA
Buffer Cache
2
Cache Layer
2
Transaction Layer
XID 01XID 02
2 Row 3
1 Row 11 Row 2
Lock Byte
ITL 1ITL 2XID 01 ITL 1Itl Xid Uba Flag Lck
0x01 0x0005.02a.0000028c 0x008000af.026b.01 ---- 1
usn#
0x02a 0x028c
RBU Header 5wrap#
Data Block
slot#
XID0X005.02a.0000028c
8/10/2019 t 99 Tuning Stats Pack
126/177
Dale Roberts126
Helpful V$/X$ Queries
(FYI Only)
V$ Views over the years
8/10/2019 t 99 Tuning Stats Pack
127/177
Dale Roberts127
Version V$ Views X$Tables
6 23 ? (35)7 72 1268.0 132 200
8.1 185 2719.0 227 3529.2 259 394
Listing of V$ Views
8/10/2019 t 99 Tuning Stats Pack
128/177
Dale Roberts128
select namefrom v$fixed_tablew here nam e l ike 'GV%'
order by name;NAME---------------------------------
GV$ACCESSGV$ACTIVE_INSTANCESGV$ACTIVE_SESS_POOL_MTHGV$AQ1GV$ARCHIVE
Need GV$ - Instance ID
8/10/2019 t 99 Tuning Stats Pack
129/177
Dale Roberts129
select ins t_id, (1 - (su m (deco de(nam e, 'ph ys icalread s ',valu e,0)) /
(su m (deco de(nam e, 'db blo ck gets ' ,value,0))+
su m (deco de(nam e, 'con sis tentgets',value,0))))) * 100 Hit Ratio"
f rom v$syss ta t ;
INST_ID Hit Ratio
-------------- ------------------
Need GV$ - Instance ID
8/10/2019 t 99 Tuning Stats Pack
130/177
Dale Roberts130
select ins t_id, (1 - (su m (deco de(nam e, 'ph ys icalread s ',valu e,0)) /
(su m (deco de(nam e, 'db blo ck gets ' ,value,0))
+su m (deco de(nam e, 'con sis tent
gets',value,0))))) * 100 Hit Ratio" f rom gv$syss ta t
g roup by ins t_id ;
INST_ID Hit Ratio
-------------- ------------------
X$ used to create V$
8/10/2019 t 99 Tuning Stats Pack
131/177
Dale Roberts131
select *from v$fixed_view_defini t ionw here view _nam e =
'GV$INDEXED_FIXED_COLUMN;
VIEW_NAME VIEW_DEFINITIONgv$indexed_fixed_column select
c. inst_id, kqftanam,kqfco idx , kqfco nam ,kqfco ipo
from X$kq fco c ,X$kqftat
=
Listing of X$ Tables
8/10/2019 t 99 Tuning Stats Pack
132/177
Dale Roberts132
select namefrom v$fixed_tablew here nam e l ike 'X%'
order by name;NAME---------------------------------
X$ACTIVECKPTX$BHX$BUFQMX$CKPTBUF
X$CLASS _STAT
Listing of X$ Indexes(419 in 10g; 326 in 9i)
8/10/2019 t 99 Tuning Stats Pack
133/177
Dale Roberts133
( g )
select table_nam e, ind ex_num ber,co lumn_name
from gv$indexed_f ixed_columnord er by table_nam e, ind ex_nu m ber,
co lumn_name, co lumn_pos i t ion;
TABLE_NAME INDEX_NUMBER
COLUMN_NAME------------------------------ ------------------------------ ---------
---------------------X$CLA SS_STA T 1 A DDR
X$CLA SS STA T 2 INDX
V$ - System Information
8/10/2019 t 99 Tuning Stats Pack
134/177
Dale Roberts134
SQL> select * f rom v$vers ion ;
BANNER---------------------------------------------------------------
Oracle Databas e 10g Enterp ris e Editio n Releas e10.1.0.2.0 Prod
PL /SQL Releas e 10.1.0.2.0 Produc t ionCORE 10.1.0.2.0 Pro d uc tio n
TNS fo r 32-b it W in d o w s: Vers io n 10.1.0.2.0
P roduc t ion
V$ - System Information
8/10/2019 t 99 Tuning Stats Pack
135/177
Dale Roberts135
select *f rom v$opt ion ;
PARAMETER VALUE
----------------------------------- -------------Part i t ioning TRUEObjects TRUEReal Ap pl icat ion Clusters FALSE
Ad vanced Repl icat ion TRUEB it-Mapp ed Ind exes TRUE
Great V$ - V$SESSION_WAIT(waiting right now)
8/10/2019 t 99 Tuning Stats Pack
136/177
Dale Roberts136
( g g )
select event, sum(decode(wait_time,0,1,0)) WaitingNow",
sum(decode(wait_time,0,0,1)) Previous Waits",
count(*) Total f rom v$sess ion _w ai tg roup by even t
ord er by co un t(*);
WAIT_TIME = 0 means that its waiting WA IT_TIME > 0 m eans that i t previo u sly w aited th is
m an m s
rea - _
8/10/2019 t 99 Tuning Stats Pack
137/177
Dale Roberts137
EVENT Wait ing Now Previo us WaitsTotal
--------------------------- ------------------- ------------------
--- ------------db f i le sequ ential read 0 1
1
db f i le sc at tered read 2 02
latch free 0 1 1
enq u eue 2 0 2
*
V$SESSION_WAITFinding Current Specific waits
8/10/2019 t 99 Tuning Stats Pack
138/177
Dale Roberts138
Finding Current Specific waits
Buffer Busy Waits or Write Complete Waits Events:SELECT /*+ ordered */ sid, event, owner,
segment_name,segment_type,p1,p2,p3
FROM v$session_wait sw, dba_extents deWHERE de.file_id = sw.p1AND sw.p2 between de.block_id
and de.block_id+de.blocks 1AND (event = 'buffer busy waits'OR event = 'write complete waits')
AND p1 IS NOT null
ORDER BY event sid
_Finding P1, P2, P3
8/10/2019 t 99 Tuning Stats Pack
139/177
Dale Roberts139
col name for a20col p1 for a10col p2 for a10
col p3 for a10select event#,name,parameter1 p1,parameter2p2,parameter3 p3
from v$event_name
where name in ('buffer busy waits', 'write completewaits')
EVENT# NAME P1 P2 P3------------- -------------------- ---------- ---------- ----------
- _ _(Last 10 waits for session)
8/10/2019 t 99 Tuning Stats Pack
140/177
Dale Roberts140
Buffer Busy Waits or Write Complete Waits Events:SELECT /*+ ordered */ sid, event, owner,
segment_name,
segment_type,p1,p2,p3FROM v$session_wait_history sw, dba_extentsde
WHERE de.file_id = sw.p1
AND sw.p2 between de.block_idand de.block_id+de.blocks 1AND (e vent = 'buffer busy waits'
OR event = 'write complete waits')
AND p1 IS NOT null
rea - _(waiting since the session started)
8/10/2019 t 99 Tuning Stats Pack
141/177
Dale Roberts141
select sid, event, total_waits,time_waited, event_id
from v$session_eventwhere time_waited > 0order by time_waited;
SID EVENT TOTAL_WAITS
TIME_WAITED---------- ------------------------------ ----------- -----------
159 process startup 2 1167 latch: redo allocation 4 1
- _ _(session waits by WAIT CLASS)
8/10/2019 t 99 Tuning Stats Pack
142/177
Dale Roberts142
select wait_class, total_waits from v system_wait_class;
SID WAIT_CLASS TOTAL_WAITS------- -------------------------------------------- --------------------147 Idle 6582150 Idle 138153 Application 10153 Administrative 1153 Idle 47153 Network 48153 User I/O 4153 System I/O 33
rea - _(waits since the instance started)
8/10/2019 t 99 Tuning Stats Pack
143/177
Dale Roberts143
EVENT TOTAL_WAITS TIME_WAITED------------------------------ ----------- -----------
latch: session allocation 5644 1latch: redo allocation 4 1latch: cache buffers chains 4 3enq: TX - index contention 1 3direct path write temp 57 6
row cache lock 1 7
select sid, event, total_waits, time_waited,event_id
from v$system_eventwhere time_waited > 0order by time_waited;
- _ _(system waits by WAIT CLASS)
8/10/2019 t 99 Tuning Stats Pack
144/177
Dale Roberts144
select wait_class, total_waits from v system_wait_class;
WAIT_CLASS TOTAL_WAITS-------------------------------------------- --------------------Other 545472Application 105Configuration 92Administrative 1Concurrency 30Commit 793Idle 186169Network 385User I/O 16017
System I/O 25478
rea - _(Added sql_id in 10g)
8/10/2019 t 99 Tuning Stats Pack
145/177
Dale Roberts145
select s id , co un t(*) select s id , sq l_id,count(*)
f rom v$open_curso r f rom v$open_cursorgroup by s id g roup by s id , sq l_idhavin g co un t(*) > 300 or der by co un t(*);ord er by co un t(*) desc ;
SID COUNT(*) SID COUNT(*) SQL_ID
----------- ---------------- ----------- ---------------- ---- ------------------
11 450 11 2
V$ - Top 10 as % of All
8/10/2019 t 99 Tuning Stats Pack
146/177
Dale Roberts146
select su m (pc t_bu fgets) percentfro m (selec t rank() ov er ( ord er by b uffer_gets d esc )
as rank_bufg ets ,
to _char(100 * rat io_to _repo rt(bu ffer_gets ) ov er(), '999.99') pc t_b u fg ets
fro m v$sq larea )w here rank_bufg ets < 11;
PERCENT------------
97.07
Great V$ - V$SQLAREA or V$SQL
8/10/2019 t 99 Tuning Stats Pack
147/177
Dale Roberts147
User1:SQL> con n sys tem /m anagerSQL> create table em p as se lect * f rom sc ot t .em p;
SQL> loc k table emp in exc lus ive m od e;User 2:SQL> con n sys tem /m anager
SQL> loc k table emp in exc lus ive m od e;User 3:SQL> con nect sc ot t /t iger
SQL>lock tableem pin
Great V$ - V$SQLAREA or V$SQL
8/10/2019 t 99 Tuning Stats Pack
148/177
Dale Roberts148
select sq l_text , us ers_execu ting , execut ion s,users_opening
from v$sq larea
where sql_text like 'lock table emp%;
SQL_TEXT USERS_EXEC EXECUSERS_OPEN
------------------------------------------ ----------------- ---------- - ----------------
lock tab le em p in exc lus ive m ode 12 3
Great V$ - V$SQLAREA or V$SQL
8/10/2019 t 99 Tuning Stats Pack
149/177
Dale Roberts149
select sq l_text , us ers_execu ting , execut ion s,users_opening
f rom v$sq l
where sql_text like 'lock table emp%;
SQL_TEXT USERS_EXEC EXECUSERS_OPEN
------------------------------------------ ----------------- ---------------------------
lock tab le em p in exc lus ive m ode 11 2
V$ - What Users are doing
8/10/2019 t 99 Tuning Stats Pack
150/177
Dale Roberts150
select a.s id , a.u sern am e, s .s q l_tex tf rom v$sess ion a, v$sql text sw here a .sq l_addr ess = s .add ressand a.sq l_hash _value = s .hash _valu e
or der by a.us ernam e, a .s id, s .piece;
SID USERNA ME SQL _TEXT------ ------------------- ------------------------------------
11 PLSQL_USER up date s_em plo yee set salary= 10000
9 SYS s elec t a.s id, a.u s ernam e,s .sql_text
9 SYS from v$sess io n a v$sq l text
Great V$ -V$SEGMENT_STATISTICS
8/10/2019 t 99 Tuning Stats Pack
151/177
Dale Roberts151
select o bject_nam e, s tat is t ic _nam e, valuef rom v$segm ent_s tat i s t icsw h ere valu e > 100000
ord er by v alue;
OB J ECT_NAME STA TISTIC_NAME VAL UE---------------------------- ------------------------------------- ---
------------ORDERS sp ace alloc ated
96551ORDERS sp ace alloc ated
AWR Segments byBuffer Busy Waits
8/10/2019 t 99 Tuning Stats Pack
152/177
Dale Roberts152
AWR Segments by LogicalReads
8/10/2019 t 99 Tuning Stats Pack
153/177
Dale Roberts153
X$ - % of Current RedoFilled
8/10/2019 t 99 Tuning Stats Pack
154/177
Dale Roberts154
SELECT ROUND((cpodr_bno/lesiz),2)*100||'%'PctCurLogFull
FROM X$kcccp a, X$kccle bWHERE a.cpodr_seq = b.leseq;
PCTCURLOGFULL
-----------------------------------------97%
X$ - % of Current RedoFilled
8/10/2019 t 99 Tuning Stats Pack
155/177
Dale Roberts155
alter system switch logfile;System altered.
SELECT ROUND((cpodr_bno/lesiz),2)*100||'%'PctCurLogFull
FROM X$kcccp a, X$kccle bWHERE a.cpodr_seq = b.leseq;
PCTCURLOGFULL-----------------------------------------0%
V$ - V$FILE_HISTOGRAM
8/10/2019 t 99 Tuning Stats Pack
156/177
Dale Roberts156
select * f rom v$fi le_his to gram ;FILE# SINGLEBLKRDTIM_MILLI SINGLEBLKRDS
---------- -------------------- ------------1 1 9001 2 1201 4 1311 8 3591 16 10721 32 1752
2 1 32 2 12 4 2
2 8 17
Grid Control 10gR2;Run the AWR Report
8/10/2019 t 99 Tuning Stats Pack
157/177
Dale Roberts157
If Time Permits the Future!
8/10/2019 t 99 Tuning Stats Pack
158/177
Dale Roberts158
64-Bit advancement ofDirectly addressable memory
8/10/2019 t 99 Tuning Stats Pack
159/177
Dale Roberts159
Address DirectIndirect/Extended4 Bit: 16 (640)8 Bit: 256 (65,536)16 Bit: 65,536 (1,048,576)32 Bit: 4,294,967,29664 Bit: 18,446,744,073,709,551,616
When the hardware physically implements thetheoretical possibilities of 64-Bit, things willdramatically change . moving from 32 bit to 64bit ill be like mo in from 4 bit to 32 bit or like
64bit allows Directly Addressing16 Exabytes of Memory
8/10/2019 t 99 Tuning Stats Pack
160/177
Dale Roberts
You could stack documents from theEarth so high they would pass Pluto!
Stack singlesheets (2K worth
of text on each)about 4.8B mileshigh to get 16E!!
Human Brain vs. Computer
8/10/2019 t 99 Tuning Stats Pack
161/177
Dale Roberts
Brain ComputerIndividual maintainsa ~250M capacity
Stores/processes~ 2G in a lifetime
With over 6.5 Billionpeople in the world,
total memory ofworld is 1.5P, totalprocessed is13 Exabytes
Laptops ~256M inmemory capacity
Stores/processes40G in its lifetime,then buy new one
1.5+ Petabytescan be accessedand managed byone computer withtodays technology(internet is 8P)
Human Brain vs. Computer
8/10/2019 t 99 Tuning Stats Pack
162/177
Dale Roberts
Brain Computer10T-1P ofoperations persecond based on
retina/neuronsynapse speed(Moravec).
Based on Brainpower in Wattsconsumption, thebrain performs 100T
100P operationsper second.
Fastest computeris IBM at70.2 Teraflops
(Blue / Gene L)
Computer is aboutequal on the lowend of the brainand could be 1000times slower onthe high end ofbrain estimates.
Human Brain vs. Computer
8/10/2019 t 99 Tuning Stats Pack
163/177
Dale Roberts
BrainComputer
Problem: Weforget a lot ofwhat we see andlearn.
Solution: Drugsthat improve
memory ortechnology thatplugs into thebrain.
Problem: DataDensity limits orSuperparamagnet
ic effect (SPE).Solution: ElectronMicroscopewriting onstainless steel ina vacuum.
Problem: More
What we covered:
8/10/2019 t 99 Tuning Stats Pack
164/177
Dale Roberts164
Statspack, Tools & Scripts that you can stilluse
Top Waits
Load ProfileLatch WaitsTop SQLInstance Activity
File I/OThe Future OEM & ADDMHelpful V$/X$Summary
For More Information
8/10/2019 t 99 Tuning Stats Pack
165/177
Dale Roberts165
www.tusc.comOracle9iPerform ance Tuning
Tips & Techn iques ;Rich ard J . Niem iec;Oracle Press (May2003)
Oracle 10g Tun ing(Early 2007)
If you are going through hell, keep going - Churchill
8/10/2019 t 99 Tuning Stats Pack
166/177
Dale Roberts
The strength of the team is each individualmemberthe strength of each member is the
team.
--Phil Jackson
The Oracle User Groups are part of your team
References
8/10/2019 t 99 Tuning Stats Pack
167/177
Dale Roberts167
Oracle9i Perform ance Tun ing Tips & Tech niq ues , Rich NiemiecThe Self-m anaging Database: A uto m aticPerform ance Diagn os is ; Karl Dias & MarkRamacher, Oracle CorporationEM Grid Co ntro l 10g; otn.oracle.com, OracleCorporation
Oracle Enterp rise Manag er 10g: Makin g the Grid aReality ; Jay Rossiter, Oracle CorporationThe Self-M anagin g Database: Guided Ap pl icat ionand SQL Tuning ; Benoit Dageville, Oracle
C ti
References
8/10/2019 t 99 Tuning Stats Pack
168/177
Dale Roberts168
Oracle Database 10g Perfo rm ance Ov erview ;Herv Lejeune, Oracle CorporationOracle 10g; Penn y A vri l , , Oracle Corporation
Forr ester Rep o rts , In c. , Tech Strategy Res earc h ,April 2002, Organic ITInternals o f Real A pp l icat ion Cluster , MadhuTumma, Credit Suisse First Boston Oracle9i RAC; Real Ap plic at ion Clus tersConfigu rat ion and Internals , Mike Ault & MadhuTumma
O l T i P t t i O l C ti
References
8/10/2019 t 99 Tuning Stats Pack
169/177
Dale Roberts169
www.tusc.com, www.oracle.com,www.ixora.com, www.laoug.org, www.ioug.org,technet.oracle.comOracle PL/SQL Tips and Techn iqu es, Jo sep h P.
Trezzo; Oracle PressOracle9i Web Developm ent, B radley D. B ro w n;Oracle PressSpecia l thank s to Steve Adam s, Mike A ul t , B radB row n, Don B urleson , K evin Gilpin , HerveLejeune, Rand y Sw anso n and Jo e Trezzo.Landauer 1986. T.K. Landauer; How much dopeop le remem ber? Som e es t im ates of thequant i ty of inform at ion in lon g- term memory,C i ti S i 10 4 477 493
ReferencesOracle Database 10 g A utomated Features , Mike
8/10/2019 t 99 Tuning Stats Pack
170/177
Dale Roberts170
Ault, TUSCOracle Database 10 g New Features, Mike Ault,Daniel Liu, Madhu Tumma, Rampant TechnicalPress, 2003, www.rampant.cc
Oracle Database 10 g - The World's First Self-Managing, Grid-Ready Database Arrives, KelliWiseth, Oracle Technology Network, 2003,otn.oracle.com
References
8/10/2019 t 99 Tuning Stats Pack
171/177
Dale Roberts171
Oracle 10g; Penny Avril, Principal DatabaseProduct Manager, Server Technologies, OracleCorporation
To Infinity and Beyond, Brad Brown, TUSCForrester Reports, Inc., TechStrategyResearch, April 2002, Organic ITInternals o f Real A pp l icat ion Cluster , MadhuTumma, Credit Suisse First Boston Oracle9i RAC; Real Ap plic at ion Clus tersConfigu rat ion and Internals , Mike Ault &Madhu Tumma
ReferencesOracle 10g documentation
8/10/2019 t 99 Tuning Stats Pack
172/177
Dale Roberts172
Oracle 9i RAC class & instructors comments Oracle 9i Concepts manualhttp://geocities.com/pulliamrick/
Tips for Tunin g Oracle9i RAC on L inux , Kurt
Engeleiter, Van Okamura, OracleLeveragin g Oracle9i RAC o n Int el-basedservers to build an Adaptive Architecture ,Stephen White, Cap Gemini Ernst & Young, Dr
Don Mowbray, Oracle, Werner Schueler, Intel
ReferencesRunning YOUR App l ica t ion s on Real Ap pl icat ionCl (RAC) RACD l B
8/10/2019 t 99 Tuning Stats Pack
173/177
Dale Roberts173
Clusters (RAC); RAC Deploym ent B est
Pract ices, Kirk McGowan, Oracle CorporationThe Present , The Futu re bu t no t Science Fict io n;Real Ap pl icat ion Clus ters Develop m ent , AngeloPruscino, OracleB uilding the Adapt ive Enterpr ise ; Adapt iveA rch i tectu re and Oracle , Malcolm Carnegie, CapGemini Ernst & YoungInternals of Real App l icat ion Cluster , MadhuTumma, Credit Suisse First BostonCreat ing Bu siness Prosp er ity in a Chal lengingEnviro nm ent , Jeff Henley
ReferencesReal A pp licat ion Clu sters , Real Cus to m ers RealR l t E ik P t T h i l M
8/10/2019 t 99 Tuning Stats Pack
174/177
Dale Roberts174
Resul ts , Erik Peterson, Technical Manager,
RAC, Oracle Corp.Dep loy ing a High ly Manageable Oracle9i RealA pp l icat ions Database , Bill Kehoe, OracleGet t ing the mo st ou t of y our da tabase, Andy
Mendelsohn, SVP Server Technologies, OracleCorporationOracle9iAS Clusters : Solut ion s for Scalabi l i tyand A vailabi l i ty , Chet Fryjoff , Pro du ct Manag er,Oracle Corp orat ion Oracle RAC and Lin ux in th e real enterpr ise , Mark Clark, Director, Merrill Lynch Europe PLC,Global Database Technologies
TUSC Services
8/10/2019 t 99 Tuning Stats Pack
175/177
Dale Roberts175
Oracle Technical SolutionsFull-Life Cycle Development ProjectsEnterprise ArchitectureDatabase Services
Oracle Application SolutionsOracle Applications Implementations/UpgradesOracle Applications Tuning
Managed Services
24x7x365 Remote Monitoring & ManagementFunctional & Technical Support
Training & MentoringOracle Authorized Reseller
Copyright Information
8/10/2019 t 99 Tuning Stats Pack
176/177
Dale Roberts176
Neither TUSC nor the author guarantee thisdocument to be error-free. Please providecomments/questions to [email protected].
TUSC 2007. This document cannot bereproduced without expressed written consentfrom an officer of TUSC, but the DOUG mayreproduce or copy this for conference use.
Contact InformationRich Niemiec: [email protected]
Acknowledgementswww.tusc.com
8/10/2019 t 99 Tuning Stats Pack
177/177