DB2 RTS Usage

52
Real Time Statistics (RTS) Overview and Usage at UBS ab André Goetschy [email protected] Copyright UBS-AG 2005

description

DB2

Transcript of DB2 RTS Usage

Page 1: DB2 RTS Usage

Real Time Statistics (RTS)Overview and Usage at UBS

ab André [email protected]

Copyright UBS-AG 2005

Page 2: DB2 RTS Usage

ab 2

Contents / Topics

♦ The DB2 for z/OS environment at UBS

♦ Database-objects monitoring and gathering statistics in a DB2 for z/OSenvironment

♦ RTS: Overview and characteristics

♦ What can be get out from the RTS-tables ?

♦ Usage and exploitation of RTS at UBS

♦ Summary, conclusion and outlook

Main sources:'DB2 V8 Administration Guide: Appendix G 'Real-time statistics tables' by IBM, March 2004'Using Real Time Statistics (RTS)' by Craig S. Mullins, June 2004'Optimization of the B/R processes and the Housekeeping at UBS' by UBS-KeyTools, February 2005

Page 3: DB2 RTS Usage

ab 3

The DB2 for z/OS environment at UBS (Dec. 2005)

InvestmentBanking

SSP WMUSWeehawken

Stamford LondonAsia

SharedGlobal

SharedDivisions

SharedData

LocalPlexes

The DB2 atUBS

�80 TB of DB2data processedin // sysplexenvironments

�65 DB2 sub-systems(4 SAP)

�17 group-attachmembers

for Prod.:12 way

//-SYSPLEX(with GDPS)

WM&BB IB

Wealth Management&Business Banking

UPl

ex(P

rod.)

DPl

exEPl

exFP

lex

GPl

exN

Plex

SPl

ex1

QPl

ex1

LPle

x1

JPle

x1IP

lex1

MPl

ex1

RPl

ex1

APl

ex2

APl

ex3

APl

ex4

abZ990 with z/OS 1.6

~ 70'000 MIPS

OPl

exTple

xPp

lex

GCU

Bple

x1Kple

x1

Page 4: DB2 RTS Usage

ab 4

Database-objects monitoring in a DB2 for z/OSenvironment♦ To maintain efficient production DB2-based systems:� we must periodically monitor the DB2 objects that make up those systems

♦ DB-objects monitoring is an essential component of post-implementationduties because:� the production environment is dynamic� we have fluctuations in business activity� changes in data access patterns

♦ Lack of attention to administrative needs can cause a system to performinadequately

♦ An effective strategy for monitoring DB2 objects in the production environmentwill catch and forestall problems before they affect performance

♦ One type of DB2 database object monitoring is to query the DB2 Catalog tables

IBM has provided a new feature of DB2 delivers Real Time Statisticsproviding up-to-date information about DB2 database objects.

Page 5: DB2 RTS Usage

ab 5

Two methods for gathering statistics in DB2

♦ Real Time Statistics (RTS) is the first step in IBM’s grand plans to automateparts of DB2 database administration

♦ Introduced after the general availability of Version 7, but before Version 8

♦ RTS provides functionality that maintains statistics about DB2 databases “onthe fly,” without having to run a utility program

♦ Prior to the introduction of RTS, the only way to gather statistics about DB2database structures was by running the RUNSTATS utility

♦ The RUNSTATS utility collects statistical information about DB2 databaseobjects and stores this data in the DB2 Catalog

♦ RTS, on the other hand, runs in the background and automatically updatesstatistics in two special tables as the data in DB2 databases is modified

� RUNSTATS is a 'hands-on' administrative process, RTS is 'hands-off'

Page 6: DB2 RTS Usage

ab 6

RUNSTATS (pictorial view)

Tablespaces Indexspaces

RUNSTATS utility

DB2 Catalog

…….sysindexpart

systablepart

syscolumnssysindexes

systablespacesystables

Page 7: DB2 RTS Usage

ab 7

RTS (pictorial view)

Tablespacestats Indexspacestats

DB2 DB-Services(xxxDBM1)

UPDATE

INSERT

DELETE REORG COPY

RUNSTATS

DML Utilities

LOAD

REBUILD INDEX

RECOVER

Page 8: DB2 RTS Usage

ab 8

RTS overview and main characteristics

Detailed information will be provided in the next foils.The newest information and details can always be found in the'DB2 V8 Administration Guide: Appendix G 'Real-time statistics tables'

� DB2 collects statistics in real time as soon RTS are activated

� Data is externalized periodically

� Default externalization is 30 minutes

� The interval can be updated by modifying the systemparameter STATSINT

� In a data-sharing environment each member can have its own interval

�No measurable overhead for the collect/externalization

� Externalization on tables 'SYSIBM.SYSTABLESPACESTATS' and'SYSIBM.SYSINDEXPACESTATS' belonging to DB=DSNRTSDB andTS=DSNRTSTS (in a dedicated bufferpool, e.g. BP49)

Page 9: DB2 RTS Usage

ab 9

RUNSTATS versus RTS� RUNSTATS gathers information for individual objects (TS, IX and TB)

and populates the DB2 Catalog

� RUNSTATS provides information for the DB2 Optimizer

� RUNSTATS influences all applications as the Optimizer determinesaccess paths for all SQL processing

� RUNSTATS has to run as an administrative (housekeeping) utility program

� RTS gather information constantly about all objects in a DB2 system

� RTS populate tables created for RTS that are not used by the DB2 Optimizer

� RTS are used to determine when to run a utility such as a REORG,COPY or RUNSTATS and can eliminate unnecessary utility runsand thus application downtime

� RTS are NOT a replacement for RUNSTATS

Page 10: DB2 RTS Usage

ab 10

The RTS database

TYPE QUALIFIER NAME-------------------- ------------------ -----------Database DSNRTSDBTablespace DSNRTSDB DSNRTSTSTable SYSIBM TABLESPACESTATSIndex SYSIBM TABLESPACESTATS_IXTable SYSIBM INDEXSPACESTATSIndex SYSIBM INDEXSPACESTATS_IX

DSNT360I +UD01 *******************************************DSNT361I +UD01 * DISPLAY DATABASE SUMMARY

* GLOBALDSNT360I +UD01 ********************************************DSNT362I +UD01 DATABASE = DSNRTSDB STATUS = RW

DBD LENGTH = 4028DSNT397I +UD01NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECEDSNRTSTS TS RWINDEXSPA IX RWTABLESPA IX RW******* DISPLAY OF DATABASE DSNRTSDB ENDED **********************DSN9022I +UD01 DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION

Page 11: DB2 RTS Usage

ab 11

The RTS Tables …1. SYSIBM.TABLESPACESTATS � 30 columnsDBNAME POSITION(00001) CHAR (8)NAME POSITION(00009) CHAR (8)PARTITION POSITION(00017) INTEGER EXTERNAL(9)DBID POSITION(00026) INTEGER EXTERNAL( 9)PSID POSITION(00035) INTEGER EXTERNAL( 9)UPDATESTATSTIME POSITION(00044) TIMESTAMP EXTERNALTOTALROWS POSITION(00071) FLOAT EXTERNAL(22)NACTIVE POSITION(00094) INTEGER EXTERNAL(14)SPACE POSITION(00109) INTEGER EXTERNAL(14)EXTENTS POSITION(00124) INTEGER EXTERNAL(9)LOADRLASTTIME POSITION(00134) TIMESTAMP EXTERNALREORGLASTTIME POSITION(00161) TIMESTAMP EXTERNALREORGINSERTS POSITION(00188) INTEGER EXTERNAL(14)REORGDELETES POSITION(00203) INTEGER EXTERNAL(14)REORGUPDATES POSITION(00218) INTEGER EXTERNAL(14)REORGUNCLUSTINS POSITION(00233) INTEGER EXTERNAL( 4)REORGDISORGLOB POSITION(00248) INTEGER EXTERNAL(14)REORGMASSDELETE POSITION(00263) INTEGER EXTERNAL(14)REORGNEARINDREF POSITION(00278) INTEGER EXTERNAL(14)REORGFARINDREF POSITION(00293) INTEGER EXTERNAL(14)STATSLASTTIME POSITION(00308) TIMESTAMP EXTERNALSTATSINSERTS POSITION(00335) INTEGER EXTERNAL(14)STATSDELETES POSITION(00350) INTEGER EXTERNAL(14)STATSUPDATES POSITION(00365) INTEGER EXTERNAL(14)STATSMASSDELETE POSITION(00380) INTEGER EXTERNAL(14)COPYLASTTIME POSITION(00395) TIMESTAMP EXTERNALCOPYUPDATEDPAGES POSITION(00422) INTEGER EXTERNAL(14)COPYCHANGES POSITION(00437) INTEGER EXTERNAL(14)COPYUPDATELRSN POSITION(00452) CHAR (6)COPYUPDATETIME POSITION(00459) TIMESTAMP EXTERNAL

Page 12: DB2 RTS Usage

ab 12

The RTS Tables …2. SYSIBM.INDEXSPACESTATS � 32 columnsDBNAME POSITION(00001) CHAR (8)INDEXSPACE POSITION(00009) CHAR (8)PARTITION POSITION(00017) INTEGER EXTERNAL(9)DBID POSITION(00026) INTEGER EXTERNAL(9)ISOBID POSITION(00035) INTEGER EXTERNAL(9)PSID POSITION(00044) INTEGER EXTERNAL(9)UPDATESTATSTIME POSITION(00053) TIMESTAMP EXTERNALTOTALENTRIES POSITION(00080) FLOAT EXTERNAL(22)NLEVELS POSITION(00103) INTEGER EXTERNAL(9)NACTIVE POSITION(00113) INTEGER EXTERNAL(14)SPACE POSITION(00128) INTEGER EXTERNAL(14)EXTENTS POSITION(00143) INTEGER EXTERNAL(9)LOADRLASTTIME POSITION(00153) TIMESTAMP EXTERNALREBUILDLASTTIME POSITION(00180) TIMESTAMP EXTERNALREORGLASTTIME POSITION(00207) TIMESTAMP EXTERNALREORGINSERTS POSITION(00234) INTEGER EXTERNAL(14)REORGDELETES POSITION(00249) INTEGER EXTERNAL(14)REORGAPPENDINSERT POSITION(00264) INTEGER EXTERNAL(14)REORGPSEUDODELETES POSITION(00279) INTEGER EXTERNAL(14)REORGMASSDELETE POSITION(00294) INTEGER EXTERNAL(14)REORGLEAFNEAR POSITION(00309) INTEGER EXTERNAL(14)REORGLEAFFAR POSITION(00324) INTEGER EXTERNAL(14)REORGNUMLEVELS POSITION(00339) INTEGER EXTERNAL(14)STATSLASTTIME POSITION(00354) TIMESTAMP EXTERNALSTATSINSERTS POSITION(00381) INTEGER EXTERNAL(14)STATSDELETES POSITION(00396) INTEGER EXTERNAL(14)STATSMASSDELETE POSITION(00411) INTEGER EXTERNAL(14)COPYLASTTIME POSITION(00426) TIMESTAMP EXTERNALCOPYUPDATEDPAGES POSITION(00453) INTEGER EXTERNAL(14)COPYCHANGES POSITION(00468) INTEGER EXTERNAL(14)COPYUPDATELRSN POSITION(00483) CHAR (6)COPYUPDATETIME POSITION(00490) TIMESTAMP EXTERNAL

Page 13: DB2 RTS Usage

ab 13

Description RTS tables columns

The newest description of the individual columns can be found in the'DB2 V8 Administration Guide: Appendix G 'RTS tables'

or'online' via CATEX as demonstrated in the following 'screenshots'…

Page 14: DB2 RTS Usage

ab 14

Page 15: DB2 RTS Usage

ab 15

Page 16: DB2 RTS Usage

ab 16

Page 17: DB2 RTS Usage

ab 17

Page 18: DB2 RTS Usage

ab 18

Page 19: DB2 RTS Usage

ab 19

Page 20: DB2 RTS Usage

ab 20

When are Real Time Statistics externalized ?

♦ DB2 begins to gather Real Time Statistics as soon as� RTS is applied (by running the proper version or maintenance level of DB2)� The RTS tables must exist in order allow DB2 to externalize the real time

statistics that it gathers

♦ Once the RTS tables have been created and started, DB2 externalizes Real TimeStatistics to the tables at the following times:� When the RTS database is stopped, DB2 first externalizes all RTS values from

memory into the RTS tables before stopping the database� When -STOP DB2 MODE(QUIESCE) is issued, DB2 first externalizes all RTS

values. (Caution: if -STOP MODE(FORCE) no RTS values are externalized,they are lost when DB2 comes down !)

� As specified by the dsnzparm STATSINT value. The default is every 30minutes

� During REORG, REBUILD INDEX, COPY, RECOVER, RUNSTATS and LOADutility operations DB2 externalizes the appropriate RTS values impacted byrunning that utility

Page 21: DB2 RTS Usage

ab 21

Are RTS always accurate ?

♦ In certain situations, the RTS values may not be 100% accurate. Situations thatcan cause the real time statistics to be inaccurate include:� Sometimes a restarted utility can cause the RTS values to be wrong� Utility operations that leave indexes in a restrictive state, such as RECOVER

pending (RECP)� A DB2 subsystem failure� A notify failure (e.g. GRECP or LPL) in a data sharing environment

♦ To fix RTS statistics that are inaccurate:� Run a REORG, RUNSTATS, or COPY on the objects for which that

stats are suspect.

NOTE:If DB2 utilities from a third party vendor other than IBM are used, we have to makesure that those utilities work with RTS (the third party utilities should be able both toreset the RTS values and use the RTS stats for recommending when to run utilities).

Page 22: DB2 RTS Usage

ab 22

What can be get out from the RTS-tables ? (1/9)� How to check for activity ?Member 'RTS01' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, UPDATESTATSTIMEFROM SYSIBM.TABLESPACESTATSWHERE (JULIAN_DAY(CURRENT DATE) - JULIAN_DAY(UPDATESTATSTIME)) <= 10AND DBNAME = 'db-name'

� To determine whether any activity has happened in the past several daysfor a particular table space or index, use the UPDATESTATSTIME column

� The above query is an example checking whether any activity hasoccurred in the past ten (10) days for a tablespace(you have just to supply the tablespace-name)

Page 23: DB2 RTS Usage

ab 23

What can be get out from the RTS-tables ? (2/9)� How to obtain a basic tablespace information ?Member 'RTS02' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, TOTALROWS, NACTIVE, SPACE, EXTENTS,UPDATESTATSTIME, STATSLASTTIME, LOADRLASTTIME, REORGLASTTIME, COPYLASTTIMEFROM SYSIBM.TABLESPACESTATSWHERE DBNAME = 'db-name'ORDER BY DBNAME, NAME, PARTITION

� The RTS tables contain some good basic information about table spaces

� The above query can be run to report on the number of rows, active pages, spaceused, number of extents, and when the COPY, REORG, LOAD REPLACE, andRUNSTATS were last runNotes:- Pay particular attention to the timestamps indicating the last time that COPY, REORG, and

RUNSTATS were run. If the date is sufficiently old, consider further investigating whether youshould take an image copy, reorganize the table space, or run RUNSTATS.

- Keep in mind though, that the span of time between utility runs is not the only indicator forwhen to copy, reorganize, or capture statistics. For example, RUNSTATS may need to be runonly once on static data; similar caveats apply to COPY and REORG when data does notchange.

Page 24: DB2 RTS Usage

ab 24

What can be get out from the RTS-tables ? (3/9)� When to reorganize a tablespace (method 1)?Member 'RTS03' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, SPACE, EXTENTS, REORGLASTTIME, REORGINSERTS,REORGDELETES, REORGUPDATES, REORGINSERTS+REORGDELETES+REORGUPDATESAS TOTAL_CHANGES, REORGDISORGLOB, REORGUNCLUSTINS, REORGMASSDELETE,REORGNEARINDREF, REORGFARINDREFFROM SYSIBM.TABLESPACESTATSWHERE DBNAME = 'db-name' ORDER BY DBNAME, NAME, PARTITION

�Helps us to determine when to reorganize a table space include: space allocated, extents, numberof INSERTs, UPDATEs, and DELETEs since the last REORG or LOAD REPLACE, number ofunclustered INSERTs, number of disorganized LOBs, and number of near and far indirectreferences created since the last REORG

� We may add WHERE clauses that limit the tablespaces returned to just those that exceed aparticular limit :Specification: DescriptionWHERE EXTENTS > 20 Table spaces having more than 20 extentsWHERE TOT_CHANGES > 100000 Table spaces with more than 100K changesWHERE REORGFARINDREF > 50 Table spaces with more than 50 far indirect references

Page 25: DB2 RTS Usage

ab 25

What can be get out from the RTS-tables ? (3/9)� When to reorganize a tablespace (method 2) ?� Another way to get more creative with our RTS queries is to build formulas into

them to retrieve only those table spaces that need to be reorganized. For example,the following query will return only those table spaces having more than 10% oftheir rows as near or far indirect references

� We can change the percentage as we wish. After running the following query wehave a list of tablespaces meeting our criteria for reorganization

Member 'RTS04' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, SPACE, EXTENTSFROM SYSIBM.TABLESPACESTATSWHERE (((REORGNEARINDREF + REORGFARINDREF) *100)/TOTALROWS) > 10AND DBNAME = 'db-name' ORDER BY DBNAME, NAME, PARTITION

Page 26: DB2 RTS Usage

ab 26

What can be get out from the RTS-tables ? (4/9)� How to examine the impact of a program ?� We can use the TOTALROWS column of SYSIBM.TABLESPACESTATS

to determine how many rows were impacted by a particular program orprocess

� We have simply to check TOTALROWS for the table space both beforeand after the process; the difference between the values is the numberof rows impacted

Page 27: DB2 RTS Usage

ab 27

What can be get out from the RTS-tables ? (5/9)� When to 'RUNSTATS' a tablespace ?Member 'RTS05' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, STATSLASTTIME, STATSINSERTS, STATSDELETES,STATSUPDATES, STATSINSERTS+STATSDELETES+STATSUPDATES AS TOTAL_CHANGES,STATSMASSDELETEFROM SYSIBM.TABLESPACESTATSWHERE DBNAME = 'db-name'ORDER BY DBNAME, NAME, PARTITION

� The above query shows the number of INSERTs, UPDATEs, andDELETEs since the last RUNSTATS execution

� There are also statistics to help in determining when RUNSTATSshould be executed

Page 28: DB2 RTS Usage

ab 28

What can be get out from the RTS-tables ? (6/9)� When to 'IMAGE-COPY' a tablespace ?Member 'RTS06' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, NAME, PARTITION, COPYLASTTIME, COPYUPDATEDPAGES, COPYCHANGES,COPYUPDATELRSN, COPYUPDATETIMEFROM SYSIBM.TABLESPACESTATSWHERE DBNAME = 'db-name'ORDER BY DBNAME, NAME, PARTITION

� Basically, as the number of distinct updated pages and changes since thelast COPY execution increase, the need to take an image copy increases

� A good rule of thumb to follow is when the percentage of updated pagessince the last COPY is more than 25% of the active pages, then it is time toCOPY the table space. We can add the following WHERE clause to theabove query to limit the output to only these table spaces:WHERE ((COPYUPDATEDPAGES*100) / NACTIVE) > 25

Page 29: DB2 RTS Usage

ab 29

What can be get out from the RTS-tables ? (7/9)� How to obtain a basic Index-space information ?Member 'RTS07' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, INDEXSPACE, PARTITION, TOTALENTRIES, NLEVELS, NACTIVE,SPACE, EXTENTS, UPDATESTATSTIME, LOADRLASTTIME, REBUILDLASTTIME,REORGLASTTIME, STATSLASTTIME, COPYLASTTIMEFROM SYSIBM.INDEXSPACESTATSWHERE DBNAME = 'db-name'ORDER BY DBNAME, INDEXSPACE, PARTITION

� We have to keep in mind that there are also RTS statisticsgathered on indexes

� The above query reports on the number of rows, active pages, spaceused, number of extents, and when the COPY, REORG, LOAD REPLACE,and RUNSTATS were last run

Page 30: DB2 RTS Usage

ab 30

What can be get out from the RTS-tables ? (8/9)� When to reorganize an index-space ?

Member 'RTS08' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, INDEXSPACE, PARTITION, REORGLASTTIME, LOADRLASTTIME,REBUILDLASTTIME, TOTALENTRIES, NACTIVE, SPACE, EXTENTS, NLEVELS, REORGNUMLEVELS,REORGINSERTS, REORGAPPENDINSERT, REORGDELETES, REORGPSEUDODELETES,REORGMASSDELETE, REORGLEAFNEAR, REORGLEAFFARFROM SYSIBM.INDEXSPACESTATSWHERE DBNAME = 'db-name'ORDER BY DBNAME, INDEXSPACE, PARTITION� There are index space statistics that can be used to determine when to reorganize indexes� These statistics include the last time REBUILD, REORG or LOAD REPLACE occurred, as well

as statistics showing the number of INSERTs and DELETEs since the last REORG or REBUILD� We get both real and pseudo DELETEs, as well as both singleton and mass DELETE information� RTS also tracks both the number of index levels and index page split information resulting in

near and far indirect references since the last REORG, REBUILD INDEX, or LOAD REPLACENOTE :These statistics should be examined after running jobs or processes that cause heavy datamodification.Pay particular attention to the REORGAPPENDINSERT column. It contains the number of inserts intoan index since the last REORG for which the index key was higher than any existing key value. If thiscolumn consistently grows, you have identified an object where data is inserted using an ascendingkey sequence. Think about lowering the free space for such objects because the free space is wastedspace if inserts are always done in ascending key sequence.

Page 31: DB2 RTS Usage

ab 31

What can be get out from the RTS-tables ? (9/9)� When to 'RUNSTATS' an index-space ?

Member 'RTS09' in 'SYS3.KEYTOOLS.SQL':SELECT DBNAME, INDEXSPACE, PARTITION, STATSLASTTIME, STATSINSERTS,STATSDELETES, STATSMASSDELETEFROM SYSIBM.INDEXSPACESTATSWHERE DBNAME='db-name'ORDER BY DBNAME, INDEXSPACE, PARTITION

� RTS provides index space statistics to help determine when to runRUNSTATS similar to the table space statistics

� The above query shows the number of INSERTs, UPDATEs, andDELETEs since the last RUNSTATS execution

Page 32: DB2 RTS Usage

ab 32

How to run the above SQL (RTS01-RTS09) ?

You can run the above SQL (RTS01-RTS09) via 'cut and paste' withan SQL-processor of your choice (SPUFI, QMF,…)

or

via the feature SQL within CATEX as demonstrated inthe 'screenshots' below….

Page 33: DB2 RTS Usage

ab 33

Page 34: DB2 RTS Usage

ab 34

Page 35: DB2 RTS Usage

ab 35

Page 36: DB2 RTS Usage

ab 36

Page 37: DB2 RTS Usage

ab 37

Page 38: DB2 RTS Usage

ab 38

DSNACCOR: The RTS Stored Procedure (1/2)

♦ IBM supplies a sample stored procedure called DSNACCOR that can be usedto query the RTS tables and make recommendations based on the statistics

� We can use DSNACCOR to recommend when to run a REORG, take anIMAGE-COPY (FULL or INCR) or run RUNSTATS

� Additionally, DSNACCOR can report on the data set extents of table spaces andindex spaces as well as on objects in a restricted/unavailable state (however thisinformation about possible objects unavailability is by far not so accurate andprecise than the information provided by DB2RCF)

� We can specify parameters to indicate to DSNACCOR which table spaces andindexes to analyze, or just run it without parameters to evaluates all table-spaces and index spaces in the subsystem

We have to keep in mind, that if the RTS values are inaccurate, the recommendations made byDSNACCOR will not be correct.Also, DSNACCOR makes recommendations based on general formulas requiring user input about ourmaintenance policies. These recommendations might not be accurate for every installation orsubsystem.

Page 39: DB2 RTS Usage

ab 39

DSNACCOR: The RTS Stored Procedure (2/2)

The newest information and details about 'DSNACCOR' can be found in the'DB2 V8 Administration Guide: Appendix H 'DB2-supplied stored procedures'

The DSNACCOR exception table:

� Optionally, the procedure described before can process an exception table� Within this table, an object can be registered along with a freely definable

user text� This user text is printed out by DSNACCOR in a list, together with the

determined objects� How the information should be considered depends on further processing� For instance In an SAP R/3 system, this exception table is already

used. The objects that have to be excluded from the RUNSTATS utility aredefined herein

� The exception table represents a unique list in which exclusions orrestrictions for the maintenance processing can be defined. Unfortunatelythere are no rules or defaults for the text (e.g., the actual maintenancerestriction) that is entered together with the objects

Note: The DSNACCOR exception table is used at UBS in the 'CARES Automated Reorg.' to exclude,for instance, some objects from 'Inline- statistics' (RUNSTATS) during the reorg-process toavoid possible access-path modification.

Page 40: DB2 RTS Usage

ab 40

Issues of RTS/DSNACCOR for the Housekeepingat UBS (SSP and SAP)

RTSTables

DSNACCOR(IBM supplied)

CARES (U006)or

CATEX (HKR)

DB2 Catalog

• Allows to optimize/automate the scheduling of Runstats/Reorg/IC (generate only when necessary)

• Allows to optimize the scheduling of Image Copy(generate only IIC or FIC when necessary)

Reorg Runstats ICTS1 Y Y FICTS2 N N IICIX1 N Y NTS3 N Y NIX2 N Y FIC

Automation(CARES and DB2ICF)

Page 41: DB2 RTS Usage

ab 41

The CATEX function 'HKR'

CATEX exploits the functionality of 'DSNACCOR' within the'Administrative Functions' for Databases, Tablespaces andIndexspaces.

This feature is named 'House-Keeping Recommendations' (HKR) anddemonstrated in the 'screenshots' below….

Page 42: DB2 RTS Usage

ab 42

Page 43: DB2 RTS Usage

ab 43

Page 44: DB2 RTS Usage

ab 44

Page 45: DB2 RTS Usage

ab 45

Page 46: DB2 RTS Usage

ab 46

Page 47: DB2 RTS Usage

ab 47

Optimization of the B/R processes and the Housekeepingat UBS (SSP, SAP and IB)

FIC: Weekly non disruptive Full IC (dual) for all DB's per groupLog/Arch: Permanent Logging (dual) on DASD and Archive on tapeRTS/IIC:RTS/IIC: According RTS (Real time statistics) the IBM supplied stored procedure(DSNACCOR triggers IIC's for all DB's which have been updated since last IIC )Merge:Merge: Mergecopy utility will merge all IIC's since last FIC to a new FICQuiesce: Daily QUIESCE before TEV (needed point of consistency for the DB's)Runstats:Runstats: According RTS (Real time statistics) the IBM supplied stored procedure(DSNACCOR triggers Runstats for all DB's which need a "refresh" of the statistics)Reorg:Reorg: According RTS (Real time statistics), CARES (Report U006 using DSNACCOR)

triggers Reorgs incl. Inline Runstats, IC, Rebinds and Dataset-Resizing

FICFIC

ALP, BT/BTX, CI, TECH, ...

Monday Tuesday Wednesday Thursday Friday Saturday/Sunday

Log

Arch

Log Log

Arch

Log Log

Arch

Log Log

Arch

Log Log

Arch

Log Log

Arch

Log Log

Arch

Log

Quiesce�RTS

Merge

IIC

FIC

Runstats

Quiesce�RTS

Merge

IIC

FIC

Runstats

Quiesce�RTS

Merge

IIC

FIC

Runstats

Quiesce�RTS

Merge

IIC

FIC

Runstats

Quiesce�RTS

Merge

IIC

FIC

Runstats

�RTS

Reorg

Page 48: DB2 RTS Usage

ab 48

CARES Automated REORG (Pictural Flow)

CARES (non RTS) CARES (with RTS)

Alternative 1 Alternative 2

Automation:• for Groups of DB's• according set/reached thresholds

Automation:• for Groups of DB's• according DSNACCORrecommendations

DSNACCOR

U002 R010 R011

• TS/IX Reorgs• Inline Runstats• Inline copy

• DS-Resizing• Rebinds OPC

U006

RTSTables

DB2 Catalog

TS statsIX statsDB2ICF

Phase I

Runstats via RTS

Phase II

ICF Catalog

Page 49: DB2 RTS Usage

ab 49

CARES Automated REORG (Technical Flow)

CARES Reports

Low CLUSTERRATIO on Index /Table-/Indexspaces candidate

for REORG

CARES Report

Extract of DB2Table-/Indexspace

datasets(DECOLLECT)

CARES Report

Compressionswitched on/off butno REORG/LOAD

CARES Report

Extract of Real-TimeStatistics

Recommendations(DSNACCOR)

DB2 CatalogStatistics Mode

Real TimeStatistics Mode

DB2ICFGrouping

DB2Catalog

CARESR010Table

CARESR011Table

CARESU002Table

CARESR027Table

CARESU006Table

R010 R011 U002 R027 U006

Real-TimeStatisticsTablesCARES Automated REORGCARES Automated REORG

USERTS(N) USERTS(Y)COMPSWIT(Y)

Real-TimeStatistics

Statistics

Statist

ics

StatisticsExtents

Space

DB-Group

Definitions

Page 50: DB2 RTS Usage

ab 50

Summary, conclusion and outlook (1 of 2)

In General:

♦ Real Time Statistics (and DSNACCOR) help DBA's and Monitor Programsto identify objects for which database maintenance is needed:� Efficient use of DBA time� Improved system and application performance� Reduction of batch window constraints� Indispensable for an efficient administration of 'black-box'

DB2 subsystems like 'SAP'

♦ RTS provide a foundation for DB2 to manage itself in the future

♦ Possible future (in V-next) exploitation by the DB2 Query optimizerand DB2 Utilities (!?)

Page 51: DB2 RTS Usage

ab 51

Summary, conclusion and outlook (2 of 2)

For UBS:

♦ Real Time Statistics have been very early exploited at UBS to� to augment and enrich our DB2 object monitoring processes� to optimize our Backup/Recovery and Housekeeping processes

♦ RTS will become a solid basis for new DB2 features to be developed like'DB- HISTORY' or 'DB2ETRS' (Event Tracking and Reporting System for DB2)as well as new functions for the estimation of recovery runtimes.

♦ We will continue to take advantage of the continuously updated RTS valuesto improve the administration and performance of our DB2 databases

(SSP/SAP, IB and WMUS) within our approx. 65 DB2 subsystems

Page 52: DB2 RTS Usage

ab 52

ab André [email protected]

Copyright UBS-AG 2005