db2top

4
DB2TOP(1) User Manuals DB2TOP(1) NAME db2top - DB2 performance monitor SYNOPSIS db2top [-d dbname] [-n nodename] [-u username] [-p passÂ- word] [-V schema] [-i interval] [-P <partition> ] [-b option] [-a] [-B] [-k] [-R] [-x] [-f file </HH:MM:SS> <+offset> ] [-D delimiter] [-C <option>] [-m duration] [-o outfile] db2top [-H host ] [-N port ] [-h] DESCRIPTION db2top is a monitor for DB2 UDB specifically designed for DPF environments. It provides a unified, ’single system view’ of a multi-partition DB2 database that can be used to quickly identify either partition-specific or global problems in the system. The user interface is character-based and built using the curses library and is similar in nature to many UNIX moniÂ- toring utilities. db2top uses the DB2 snapshot monitoring APIs to retrieve data. It uses both global as well as partition-specific monitoring information to provide aggregation as well as quick drill-down capabilities. It can be run interactively or in batch mode. Main feaÂ- tures can be selected by an interactive command or by specifying the option in the personal or system-wide conÂ- figuration file. See below .db2toprc for more information. COMMAND OPTIONS -n specifies the node to attach to. -d specifies the database to monitor. -u specifies the DB2 username used to access the database. -p specifies the DB2 password. -V specifies the default schema used in explains. -i specifies the delay between screen updates. -k specifies whether to display actual or delta values. -R Reset snapshot at startup. -P <number>. Snapshot issued on current or partition numÂ- ber. -x specifies whether to display additionnal counters on session snd appl creens (might run slower on session). -b tells db2top to run in background mode. -a specifies only active queries will be displayed. -B enable bold for active objects. -C Runs db2top in snapshot collector mode, raw snapshot data is saved in <db2snap-Machine>.bin> by default (unless -f is specified). -f <file> </HH:MM:SS> <+offset>. Run db2top in replay mode when snapshot data has been previously collected in <file>. offset will jump to a certain point in time in the file. It can be expressed in seconds (+10s), minutes (+10m) or hours (+10h). /HH:MM:SS will skip entries until the specified point in time. -m Will limit duration of db2top in minutes for -b and -C. -o <outfile>. Outfile for -b option. -D <delimiter>. Separator for -b option. -h short help. Nov 10, 06 22:48 Page 1/7 db2top When using the -b option, db2top will display information in CSV format. db2top can be run in background mode in combination with reading snapshot data from collection file, in this case, use the -f <file> option. Valid sub- options for -b and -C are : d : database l : sessions t : tablespaces b : bufferpools T : Tables D : Dynamic SQL s : Statements U : Locks u : Utilities F : Federation m : Memory pools When using the -X switch with the -b option, the output will be displayed in XML format. When using the -L switch with the -b option, in session mode (sub-option l), all queries will be written to ’ALL.sql’. When using the -A switch with the -b option, db2top will produce a top twenty performance report. When using the -s <sample> switch with the -b option, db2top will only display n samÂ- ples and exit. Interactive commands d Goto database screen. l Goto sessions screen. a Goto application details for agent (or restrict on agent on statement screen). db2top will prompt for the agent-id. G Toggle between all partitions and current partitions. P Select db partition on which to issue snapshot. t Goto tablespaces screen. T Goto tables screen. b Goto bufferpools screen. D Goto the dynamic SQL screen. m Display memory pools. s Goto the statements screen. U Goto the locks screen. p Goto the partitions screen. u Goto the utilities screen. A Goto the HADR screen. F Goto the federation screen. B Goto the bottleneck analysis screen. H Goto the history screen (experimental). f Freeze screen. Nov 10, 06 22:48 Page 2/7 db2top Printed by db2inst2 Friday November 10, 2006 1/4 db2top

Transcript of db2top

Page 1: db2top

DB2TOP( 1) User Manual s DB2TOP( 1)

NAME db2t op − DB2 per f or mance moni t or

SYNOPSI S db2t op [ −d dbname] [ −n nodename] [ −u user name] [ −p passÂ- wor d] [ −V schema] [ −i i nt er val ] [ −P <par t i t i on> ] [ −b opt i on] [ −a] [ −B] [ −k ] [ −R] [ −x ] [ −f f i l e </ HH: MM: SS> <+of f set > ] [ −D del i mi t er ] [ −C <opt i on>] [ −m dur at i on] [ −o out f i l e] db2t op [ −H host ] [ −N por t ] [ −h]

DESCRI PTI ON db2t op i s a moni t or f or DB2 UDB speci f i cal l y desi gned f or DPF envi r onment s. I t pr ovi des a uni f i ed, ’ s i ngl e syst em v i ew’ of a mul t i −par t i t i on DB2 dat abase t hat can be used t o qui ckl y i dent i f y ei t her par t i t i on−speci f i c or gl obal pr obl ems i n t he syst em.

The user i nt er f ace i s char act er −based and bui l t usi ng t he cur ses l i br ar y and i s s i mi l ar i n nat ur e t o many UNI X moni Â- t or i ng ut i l i t i es.

db2t op uses t he DB2 snapshot moni t or i ng API s t o r et r i eve dat a. I t uses bot h gl obal as wel l as par t i t i on−speci f i c moni t or i ng i nf or mat i on t o pr ovi de aggr egat i on as wel l as qui ck dr i l l −down capabi l i t i es.

I t can be r un i nt er act i vel y or i n bat ch mode. Mai n f eaÂ- t ur es can be sel ect ed by an i nt er act i ve command or by speci f y i ng t he opt i on i n t he per sonal or syst em−wi de conÂ- f i gur at i on f i l e. See bel ow . db2t opr c f or mor e i nf or mat i on.

COMMAND OPTI ONS −n speci f i es t he node t o at t ach t o. −d speci f i es t he dat abase t o moni t or . −u speci f i es t he DB2 user name used t o access t he dat abase. −p speci f i es t he DB2 passwor d. −V speci f i es t he def aul t schema used i n expl ai ns. −i speci f i es t he del ay bet ween scr een updat es. −k speci f i es whet her t o di spl ay act ual or del t a val ues. −R Reset snapshot at st ar t up. −P <number >. Snapshot i ssued on cur r ent or par t i t i on numÂ- ber . −x speci f i es whet her t o di spl ay addi t i onnal count er s on sessi on snd appl cr eens ( mi ght r un s l ower on sessi on) . −b t el l s db2t op t o r un i n backgr ound mode. −a speci f i es onl y act i ve quer i es wi l l be di spl ayed. −B enabl e bol d f or act i ve obj ect s. −C Runs db2t op i n snapshot col l ect or mode, r aw snapshot dat a i s saved i n <db2snap−Machi ne>. bi n> by def aul t ( unl ess −f i s speci f i ed) . −f <f i l e> </ HH: MM: SS> <+of f set >. Run db2t op i n r epl ay mode when snapshot dat a has been pr evi ousl y col l ect ed i n <f i l e>. of f set wi l l j ump t o a cer t ai n poi nt i n t i me i n t he f i l e. I t can be expr essed i n seconds ( +10s) , mi nut es ( +10m) or hour s ( +10h) . / HH: MM: SS wi l l sk i p ent r i es unt i l t he speci f i ed poi nt i n t i me. −m Wi l l l i mi t dur at i on of db2t op i n mi nut es f or −b and −C. −o <out f i l e>. Out f i l e f or −b opt i on. −D <del i mi t er >. Separ at or f or −b opt i on. −h shor t hel p.

Nov 10, 06 22:48 Page 1/7db2top When usi ng t he −b opt i on, db2t op wi l l di spl ay i nf or mat i on i n CSV f or mat . db2t op can be r un i n backgr ound mode i n combi nat i on wi t h r eadi ng snapshot dat a f r om col l ect i on f i l e, i n t hi s case, use t he −f <f i l e> opt i on. Val i d sub− opt i ons f or −b and −C ar e : d : dat abase l : sessi ons t : t abl espaces b : buf f er pool s T : Tabl es D : Dynami c SQL s : St at ement s U : Locks u : Ut i l i t i es F : Feder at i on m : Memor y pool s When usi ng t he −X swi t ch wi t h t he −b opt i on, t he out put wi l l be di spl ayed i n XML f or mat . When usi ng t he −L swi t ch wi t h t he −b opt i on, i n sessi on mode ( sub−opt i on l ) , al l quer i es wi l l be wr i t t en t o ’ ALL. sql ’ . When usi ng t he −A swi t ch wi t h t he −b opt i on, db2t op wi l l pr oduce a t op t went y per f or mance r epor t . When usi ng t he −s <sampl e> swi t ch wi t h t he −b opt i on, db2t op wi l l onl y di spl ay n samÂ- pl es and exi t .

I nt er act i ve commands d Got o dat abase scr een.

l Got o sessi ons scr een.

a Got o appl i cat i on det ai l s f or agent ( or r est r i ct on agent on st at ement scr een) . db2t op wi l l pr ompt f or t he agent −i d.

G Toggl e bet ween al l par t i t i ons and cur r ent par t i t i ons.

P Sel ect db par t i t i on on whi ch t o i ssue snapshot .

t Got o t abl espaces scr een.

T Got o t abl es scr een.

b Got o buf f er pool s scr een.

D Got o t he dynami c SQL scr een.

m Di spl ay memor y pool s.

s Got o t he st at ement s scr een.

U Got o t he l ocks scr een.

p Got o t he par t i t i ons scr een.

u Got o t he ut i l i t i es scr een.

A Got o t he HADR scr een.

F Got o t he f eder at i on scr een.

B Got o t he bot t l eneck anal ysi s scr een.

H Got o t he hi st or y scr een ( exper i ment al ) .

f Fr eeze scr een.

Nov 10, 06 22:48 Page 2/7db2top

Printed by db2inst2

Friday November 10, 2006 1/4db2top

Page 2: db2top

W Wat ch mode f or agent _i d, os_user , db_user , appl i caÂ- ^HÂ- t i on or net name. St at ement s r et ur ned by t he sessi on snapshot ( opt i on l ) wi l l be wr i t t en t o agent . sql , os_user −agent . sql , db_user −agent . sql , appl i cat i on− agent . sql or net name−agent . sql . The Dump DB St r uct f i el d wi l l cr eat e scr i pt s i n t he cur r ent di r ect or y t o r ecr eat e t he dat abase. When i ssued f r om t he dynami c SQL scr een ( opt i on D) , st at ement s wi l l be wr i t t en t o db2adv . sql i n a f or mat compat i bl e wi t h db2advi s .

/ Ent er expr essi on t o f i l t er dat a. \ Expr essi on must conf or m t o r egul ar expr essi on. Each f unct i on ( scr een) can be f i l t er ed di f f er ent l y. r egexp check i s appl y i ed t o t he whol e r ow.

<| > Move t o l ef t or r i ght of scr een.

z | Z Sor t on ascendi ng or descendi ng or der .

c Thi s opt i on al l ows t o change t he or der of t he col umns di spl ayed on t he scr een. The synt ax i s i n t he f or m: 1, 2, 3, . . . wher e 1, 2, 3 cor r espond r espect i vel y t o t he 1st , 2nd and 3r d col umns di spl ayed. These ar e t he col umn number s t o use when speci f y i ng a sor t cr i t eÂ- r i a.

S Run nat i ve DB2 snapshot .

L Al l ows t o di spl ay t he compl et e quer y t ext f r om t he SQL scr een. Regul ar DB2 expl ai n can t hen be r un usi ng e or X.

R Reset snapshot dat a.

i Toggl e i dl e sessi ons on/ of f .

I Reset r ef r esh i nt er val .

k Toggl e act ual vs del t a val ues.

g Toggl e gr aph on/ of f .

X Toggl e ext ended mode on/ of f .

C Toggl e snapshot dat a col l ect or on/ of f .

V Set def aul t expl ai ns schema.

O Di spl ay sessi on set up.

w Wr i t e sessi on set t i ngs t o . db2t opr c .

q Qui t db2t op.

I nt er act i ve commands ( appl i cat i ons scr een onl y) r Ret ur n t o pr evi ous f unct i on.

R Toggl e aut omat i c r ef r esh.

g Toggl e gr aph on/ of f .

X Toggl e ext ended mode on/ of f .

d Di spl ay agent s.

Snapshot dat a col l ect or

Nov 10, 06 22:48 Page 3/7db2top db2t op can be r un i n r epl ay mode, whi ch means i t can be r un agai nst a saved copy of t he r aw bi nar y snapshot dat a. I n or der t o do so, db2t op must be r un f i r st i n dat a col Â- l ect or mode, ei t her i n bat ch mode by r unni ng db2t op f r om t he command l i ne wi t h t he [ −C] swi t ch, or by act i vat Â- i ng/ deact i vat i ng dat a col l ect i on f r om an i nt er act i ve sesÂ- s i on by pr essi ng C. Thi s wi l l cr eat e a f i l e <db2snap− Machi ne> i n t he cur r ent di r ect or y. Af t er war ds, db2t op can be r an agai nst <db2snap−Machi ne> by usi ng t he [ −f <db2snap−Machi ne> ar gument s. db2t op does not need t o at t ach t o DB2 i n r epl ay mode, whi ch makes conveni ent t o do r emot e moni t or i ng. I t i s possi bl e t o l i mi t t he cont ent of t he st r eam f i l e ( and i t ’ s s i ze) by speci f y i ng any of t he subopt i ons dl t bTDsUF.

Net wor k dat a col l ect or ( EXPERI MENTAL) db2t op can be r un i n c l i ent / ser ver mode. Thi s means t hat one i nst ance of db2t op can i ssue DB2 snapshot s i n dat a col l ect i on mode and send t he out put st r eam vi a t he net wor k t o ot her i nst ances of db2t op. To enabl e t hi s, db2t op needs t o be st ar t ed i n col l ect i on mode wi t h −C and −N ( net wor k) . Event ual l y, t he −D wi l l set db2t op t o daemon mode; i n t hi s case, messages ar e sent t o sysl og( 3) . Then, ot her i nst ances of db2t op wi l l connect t o t he ser ver usi ng t he −H [ host ] and −N <por t > swi t chs. Net wor k commands −−st op, −−r est ar t , −−pi ng.

FI LES db2t opr c . db2t opr c i s a conf i gur at i on f i l e used t o set up par amet er s at i ni t i al i zat i on t i me. db2t op wi l l sear ch f or t he l ocat i on of . db2t opr c usi ng t he envi r onement var i abl e $DB2TOPRC. I f t he var i abl e i s not set , db2t op wi l l t hen sear ch f or . db2t opr c i n t he cur r ent di r ect or y and f i nal l y i n t he home di r ect or y.

ENVI RONMENT DB2TOPRC see above.

DB2DBDFT I f non nul l and not hi ng has been speci f i ed on t he command l i ne or i n . db2t opr c , db2t op wi l l honor t he DB2DBDFT r egi st r y var i abl e cont ent as t he def aul t dat abase. EDI TOR i f EDI TOR i s set , r esul t s of expl ai n or nat i ve snapshot s wi l l be di spl ayed usi ng t hi s command, ot her wi se, i t wi l l def aul t t o vi ( 1) .

db2t opr c st r uct ur e Sect i ons The var i ous sect i ons of $DB2TOPRC ar e descr i bed her e af t er .

cpu=command Thi s ent r y al l ows t he user t o speci f y a comÂ- mand whi ch r esul t wi l l be di spl ayed on t he 2nd l i ne at t he r i ght of t he scr een, f or exampl e:

Nov 10, 06 22:48 Page 4/7db2top

Printed by db2inst2

Friday November 10, 2006 2/4db2top

Page 3: db2top

cpu=vmst at 2 2 | t ai l −1 | awk ’ { pr i nt f ( " %d( usr +sys) " , $14+$15) ; } ’

wi l l di spl ay ’ Cpu=2( usr +sys) ’ on t he r i ght of t he scr een.

i o=command Thi s ent r y al l ows t he user t o speci f y a comÂ- mand whi ch r esul t wi l l be di spl ayed on t he 2nd l i ne at t he l ef t of t he scr een, f or exampl e:

i o=vmst at 2 2 | t ai l −1 | awk ’ { pr i nt f ( " %d( bi +bo) " , $10+$11) ; } ’

wi l l di spl ay ’ Di sk=76( bi +bo) ’ on t he r i ght of t he scr een.

Bot h commands ar e r un i n a backgr ound pr ocess and t he f i el ds on t he scr een ar e updat ed asynÂ- chr onousl y.

shel l al i as=command The shel l ent r y al l ows t o speci f y a user def i ned command, f or exampl e:

shel l M=t op

wi l l spawn t op f r om a db2t op sessi on when ent er i ng M. I t wi l l r et ur n t o t he cur r ent scr een upon exi t .

f unct i on al i as=command The f unct i on ent r y al l ows t o speci f y a user def i ned command, f or exampl e:

f unct i on N=net st at

wi l l cr eat e a new f unct i on cal l ed N t hat wi l l di spl ay r epet eadl y t he out put of net st at .

Sampl e . db2t opr c f i l e

# # db2t op conf i gur at i on f i l e # On uni x, shoul d be l ocat ed i n $HOME/ . db2t opr c # Fi l e gener at ed by db2t op−1. 0h # node= # [ −n] nodename dat abase=sampl e # [ −d] dat abasename user = # [ −u] dat abase user passwor d= # [ −p] user passwor d ( cr ypt ed) schema= # [ −V] def aul t schema f or expl ai ns i nt er val =2 # [ −i ] sampl i ng i nt er val act i ve=OFF # [ −a] di spl ay act i ve sessi ons onl y ( on/ of f ) r eset =OFF # [ −R] Reset snapshot at st art up ( on/ of f ) del t a=ON # [ −k] Toggl e di spl ay of del ta/ cumul at i ve val ues ( on/ of f ) gr aphi c=ON # Tr ue i f t er mi nal suppor t s semi gr aphi cal char act er s

Nov 10, 06 22:48 Page 5/7db2top col or s=ON # Tr ue i f t er mi nal suppor t s col or s gr aph=ON # di spl ay gr aph on sessions l i s t ( on/ of f ) por t = # Por t f or net wor k col l ect i on st r eamsi ze=si ze # Max col l ect i on s i ze per hour ( eg. 1024 or 1K : K, M or G)

# Command t o get cpu usage i nf or mat i on f r om OS cpu=vmst at 2 2 | t ai l −1 | awk ’ { pr i nt f ( " %d( usr +sys) 0, $14+$15) ; } ’ # Command t o get I O usage i nf or mat i on f r om OS i o=vmst at 2 2 | t ai l −1 | awk ’ { pr i nt f ( " %d( bi +bo) 0, $10+$11) ; }’ # Or der i ng of i nf or mat i on i n sessi ons scr een sessi ons=0, 1, 18, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23 t abl es=0, 1, 2, 4, 3, 5, 6, 7 t abl espaces=0, 1, 18, 2, 3, 4, 5, 6, 7, 8 buf f er pool s=0, 1, 18, 2, 3, 4, 5, 6, 7, 8, 9, 10 dynsql =0, 1, 18, 2, 3, 4, 5, 6, 7, 8, 9 st at ement s=0, 1 l ocks=0, 1 ut i l i t i es=0 f eder at i on=0, 2, 4

# User def i ned commands shel l P=t op f unct i on N=dat e && net st at −t t cp

The col umns or der scr een Af t er pr essi ng c , a scr een wi l l be shown speci f y i ng t he or der of t he col umns di spl ayed on scr een. The l ef t par t of t he sceen di spl ays t he def aul t or der and col umn number s wher eas t he r i ght par t di spl ays t he cur r ent or der i ng. To change t he or der of t he col umns, ent er i n t he t ext f i el d at t he bot t om of t he scr een t he new col umn or der : ent er t he r el at i ve col umn posi t i ons as di spl ayed on t he l ef t seper at ed by comma. Not al l col umns need t o be speci f i ed. Thi s col umn or der i ng can be saved i n $DB2TOPRC f or subseÂ- quent db2t op sessi ons by pr essi ng w. I t i s possi bi l e t o def i ne t he def aul t sor t or der f or t hi s f unct i on by usi ng t he sor t =num<a| d> synt ax, wher e num i s t he col umn number and <a| d> means ascendi ng or descendi ng.

Exampl e : t abl espaces=0, 1, 18, 2, 3, 4, 5, 6, 7, 8, sor t =22a

Val i d keywor ds f or col umn or der i ng i n db2t opr c .

sessi ons= t abl espaces= t abl es= buf f er pool s= dynsql = st at ement s= l ocks= ut i l i t i es= f eder at i on=

BUGS Occasi onal l y st r ange i nf or mat i on may appear when t he snapÂ- shot API r et ur ns unexpect ed ver y l ar ge val ues. db2t op wi l l

Nov 10, 06 22:48 Page 6/7db2top

Printed by db2inst2

Friday November 10, 2006 3/4db2top

Page 4: db2top

t r y t o di spl ay * i nst ead of t hese val ues.

COPYRI GHT Li censed Mat er i al s − Pr oper t y of I BM Copyr i ght I BM Cor p. 2005 Al l Ri ght s Reser ved. US Gover nment User s Rest r i ct ed Ri ght s Use, dupl i cat i on or di scl osur e r est r i ct ed by GSA ADP Schedul e Cont r act wit h I BM Cor p.

I BM/ DB2 JANUARY 2005 DB2TOP( 1)

Nov 10, 06 22:48 Page 7/7db2top

Printed by db2inst2

Friday November 10, 2006 4/4db2top