Sunteți pe pagina 1din 17

3/16/2012

Top Ten – db2pd command Brian Fairchild bfairchild@xtivia.com @fairchild_db2 Top Ten – db2pd
Top Ten – db2pd command
Brian Fairchild
bfairchild@xtivia.com
@fairchild_db2
Top Ten – db2pd

3/16/2012

Long, long ago, before 2004 AD, database administrators used crude built-in tools to administer their
Long, long ago, before 2004 AD, database administrators
used crude built-in tools to administer their DB2 database.
Mostly, they banged on the database server with sticks and
rocks.
Junior DBA in training

3/16/2012

Those dark days ended when we were given…
Those dark days ended when we were
given…

3/16/2012

db2pd origins • After the acquisition of Informix, IBM converted the “onstat” tool and put
db2pd origins
• After the acquisition of Informix, IBM converted the “onstat” tool and put it
into DB2 version 8.2 as “db2pd”.
• db2pd runs quickly without any locks or latches and runs outside of the DB2
engine. No database connection is necessary.
• This makes it possible to capture information that changes quickly without
negatively impacting the system.
• Benefits include the collection of information without latching, faster
retrieval, and no competition for engine resources.

3/16/2012

My Top Ten Most Useful db2pd commands DISCLAIMER: This presentation and this Top Ten list
My Top Ten Most Useful
db2pd commands
DISCLAIMER:
This presentation and this Top Ten list are my opinions only. This is in no way a reflection of the
views of my employer or IBM. This picture isn't even of me. It's of a person named David
Letterman. He's well-known for other Top Ten lists.

3/16/2012

DB2 Memory Use Monitor DB2 Memory use at a high level. 10 Controller Automatic: Y
DB2 Memory Use
Monitor DB2 Memory use at a high level.
10
Controller Automatic: Y
Memory Limit:
14096056 KB
Current usage:
13810816 KB
HWM usage:
14036160 KB
Cached memory:
2072576 KB
Individual Memory Consumers:
Name
Mem Used (KB) HWM Used (KB) Cached (KB)
========================================================
APPL-DBNAME
26432
160000
5952
DBMS-db2inst1
44096
44096
5376
FMP_RESOURCES
22528
22528
0
PRIVATE
147584
180736
0
DB-DBNAME
13570048
13778560
2061248
LCL-p4294967295
128
128
0

3/16/2012

View HADR status • View Role, State, LogGapRunAvg, Primary log file, Standby log file. HADR
View HADR status
• View Role, State, LogGapRunAvg, Primary log file, Standby log file.
HADR Information:
Role
State
SyncMode HeartBeatsMissed
LogGapRunAvg (bytes)
Standby Peer
nearsync
0
154126
ConnectStatus ConnectTime
Timeout
Connected Sat Mar 3 08:11:15 2012 (1330758675) 120
PrimaryFile PrimaryPg PrimaryLSN
S0058659.LOG 426 0x0000027CF4CC2B84
StandByFile StandByPg StandByLSN StandByRcvBufUsed
S0058659.LOG 426 0x0000027CF4CC299D 0%

3/16/2012

Check database configuration settings Quickly check the database or instance configuration settings and see what’s
Check database configuration settings
Quickly check the database or instance configuration
settings and see what’s saved in memory and disk.
Good when many settings are set to AUTOMATIC
because values come back with current numbers.
Database Configuration Settings:
Description
Memory Value
Disk Value
DATABASE_MEMORY (4KB)
DB_MEM_THRESH
LOCKLIST (4KB)
MAXLOCKS
PCKCACHESZ (4KB)
SHEAPTHRES_SHR (4KB)
SORTHEAP (4KB)
DBHEAP (4KB)
AUTOMATIC(130240) AUTOMATIC(130240)
10
10
832
832
AUTOMATIC(98)
AUTOMATIC(98)
4022
4022
529
529
AUTOMATIC(105)
AUTOMATIC(105)
AUTOMATIC(4120)
AUTOMATIC(4120)

3/16/2012

Check version of DB2 and OS Wondering about the DB2 and OS version along with
Check version of DB2 and OS
Wondering about the DB2 and OS version along
with memory usage and CPU load?
Instance db2inst1 uses 64 bits and DB2 code release SQL09058
with level identifier 06090107
Informational tokens are DB2 v9.5.0.8, s110603, IP23270, Fix Pack 8.
Operating System Information:
OSName: Linux
Version: 2
Release: 6
Machine: x86_64
CPU Information:
TotalCPU
OnlineCPU
ConfigCPU
Speed(MHz) HMTDegree Cores/Socket
8
8
8
2992
1
4
Physical Memory and Swap (Megabytes):
TotalMem
FreeMem
AvailMem
TotalSwap
FreeSwap
16047
2901
n/a
16384
16309
CPU Usage Information (percent):
Total
Usr
Sys
Wait
Idle
25.000000 n/a
n/a
n/a
75.000000

3/16/2012

View Dynamic SQL View the Dynamic SQL statements that are in the package cache. Consider
View Dynamic SQL
View the Dynamic SQL statements that are in the package
cache.
Consider flushing the package cache fist to catch new
statements. (db2 flush package cache dynamic)
Dynamic Cache:
Current Memory Used
Total Heap Size
Cache Overflow Flag
Number of References
Number of Statement Inserts
Number of Statement Deletes
Number of Variation Inserts
Number of Statements
1175280
3973120
0
1039
73
26
49
47
Dynamic SQL Statements:
Address AnchID StmtUID NumEnv NumVar NumRef NumExe Text
0x00002B2417019EC0 111 1 1 1 1 1 SELECT POLICY FROM
SYSTOOLS.POLICY WHERE MED='DB2TableMaintenanceMED'

3/16/2012

Troubleshoot Locking Locks being waited on : AppHandl Type Mode Sts CoorEDU AppName AuthID AppID
Troubleshoot Locking
Locks being waited on :
AppHandl Type Mode Sts CoorEDU AppName AuthID AppID
2047
Row
X
GGGG
5160 db2bp VENUS *LOCAL.venus.071207213730
2046
Row .NS
WWWW
5913 db2bp VENUS
Status=G is the owner and Status=W is waiting
Get more information
• What are these applications running?
List of inactive statements of current UOW :
UOW-ID : 2
Activity ID : 1
Package Schema : NULLID
Package Name : SQLC0K14
Package Version :
Section Number : 203
SQL Type : Dynamic Isolation :
CS Statement Type : DML, Insert/Update/Delete
Statement : insert into test values 9099

3/16/2012

View Table statistics View the table size, scans, page reorgs, inserts, updates and deletes. TCB
View Table statistics
View the table size, scans, page reorgs, inserts,
updates and deletes.
TCB Table Information:
TbspaceID TableID PartID MasterTbs MasterTab TableName
SchemaNm ObjClass DataSize
LfSize
LobSize
XMLSize
22
4
n/a
22
4
TEST_TXN
DB2
Perm
2923271
0
0
0
TCB Table Stats:
TableName Scans
UDI
RTSUDI
PgReorgs
NoChgUpdts Reads
FscrUpdates Inserts
Updates
Deletes
OvFlReads OvFlCrtes
TEST_TXN 359878 424431 424431
700973
222951
2341290115*174387
520085
3281159
1
686673901 28286
0

3/16/2012

View Index statistics • These include size of indexes, scans, Index only scans, leaf splits.
View Index statistics
• These include size of indexes, scans, Index only scans, leaf splits.
• Send output to a file usually.
TCB Index Stats:
TableName
IID
EmpPgDel
RootSplits BndrySplts PseuEmptPg Scans
KeyUpdates InclUpdats NonBndSpts PgAllocs
Merges
PseuDels
DelClean
TEST_TXN
15
200
0
763
197
522
551967
0
4072
4816
0
513703
1464486
44
TEST_TXN
14
193
0
0
949
0
1753998
0
2972
2973
0
1702959
1635908
34

3/16/2012

View Tablespace Statistics • Includes total pages, usable pages, used pages, and free pages •
View Tablespace Statistics
• Includes total pages, usable pages, used pages, and free pages
• Easily see if automatic resize is turned on and if it is an automatic storage
tablespace
2
Tablespace 3 Statistics:
TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM State MinRecTime NQuiescers
19597216 19597184 19073984 0 523200 19073984 0x00000000 1331784495 0
Tablespace 3 Autoresize Statistics:
AS AR InitSize
No Yes 0
IncSize
IIP MaxSize
LastResize
LRF
5
Yes None
None
No
Containers:
Address ContainNum Type TotalPgs UseablePgs StripeSet Container
0x00002B0C2B7B0080 0 File 19597216 19597184 0 /db2data/tblspaces/USER4K.dbf

3/16/2012

View Bufferpool Statistics • These include current size, hit ratio, direct reads, direct writes. DatLRds
View Bufferpool Statistics
• These include current size, hit ratio, direct reads, direct writes.
DatLRds DatPRds HitRatio TmpDatLRds TmpDatPRds HitRatio IdxLRds IdxPRds HitRatio TmpIdxLRds TmpIdxPRds HitRatio
2172094823 65639765 96.98% 6830323214 843479398 87.65% 549794315 13718139 97.50% 354109171 78 100.00%
DataWrts IdxWrts DirRds DirRdReqs DirRdTime DirWrts DirWrtReqs DirWrtTime
1183228552 2349724 1663208496 9904653 204391034 5321462 34514 344300
AsDatRds
AsDatRdReq AsIdxRds
AsIdxRdReq AsRdTime
AsDatWrts AsIdxWrts AsWrtTime
846016377 72848156 2912247 194629 2478886149 1181375821 2057132 54288781
TotRdTime TotWrtTime VectIORds VectIOReq BlockIORds BlockIOReq FilesClose NoVictAvl UnRdPFetch
2778549431 64347648 831646395 69387765 0 0 0 1766351 4570976

3/16/2012

Other useful options View running utilities • db2pd -utilities Use the –repeat flag to run
Other useful options
View running utilities
• db2pd -utilities
Use the –repeat flag to run the command
iteratively
• db2pd –option –repeat 5 5
Use the –file option to send output to a
filename
• db2pd –options –file filename
For multi-partitions
• db2pd –options –alldbpartitionnums
• db2pd –options –dbpartitionnum 4

3/16/2012

Thank You
Thank You
3/16/2012 Thank You Brian Fairchild bfairchild@xtivia.com @fairchild_db2 17
3/16/2012 Thank You Brian Fairchild bfairchild@xtivia.com @fairchild_db2 17
3/16/2012 Thank You Brian Fairchild bfairchild@xtivia.com @fairchild_db2 17

Brian Fairchild bfairchild@xtivia.com

@fairchild_db2

3/16/2012 Thank You Brian Fairchild bfairchild@xtivia.com @fairchild_db2 17