db2 v8 migration and new functions

66
Cristian Molaro MConsulting BELGIUM Réunion du Guide DB2 pour z/OS France Jeudi 22 novembre 2007 Immeuble CA, Paris-La Défense

Upload: cristian-molaro

Post on 08-Jun-2015

792 views

Category:

Technology


8 download

TRANSCRIPT

Page 1: Db2 V8 Migration And New Functions

Cristian Molaro

MConsulting BELGIUM

Réunion du Guide DB2 pour z/OS FranceJeudi 22 novembre 2007Immeuble CA, Paris-La Défense

Page 2: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 2

Cristian Molaro is a DB2 System engineer who works as a consultant in Belgium.

His main activity is linked to the DB2 for z/OS administration and performance monitoring and tuning.

He is an IBM Certified Professional, graduated in Chemical Engineering and has a Postgraduate in Management Sciences.

Cristian is a former IDUG and GSE speaker.

Page 3: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 3

Page 4: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 4

As much as you can http://www.ibm.com/software/data/db2/zos Installation Guide Migration Informational APAR II13695 Unicode Informational APAR II13048 & II13049 DB2 UDB for z/OS V8 Migration: An Ironman® event SG24-6465: DB2 for z/OS Performance Topics SG24-6079: DB2 V8, Everything you ever wanted to know... IDUG DB2LIST ...

Page 5: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 5

Critical APAR:

============================================================SECTION 1: Toleration, Coexistance and Compatibility PTFs.============================================================ 5740XYR00 R810DB2 V7.1 MIGRATION/FALLBACK INFOAPAR TO/FROM DB2 V8.1 AND UPGRADE V710 FOLLOWING PTFS ARE REQUIRED FOR DB2 V7.1 & V8.1 BEFORE MIGRATION:DB2 system administrator should take a back up from DB2environment (SMP/E, Active logs, BSDSs, DB2 Catalog/Directory)before applying maintenance.Remove any ZAPed (modified) DB2 module/s (lmod) by OEM fromload libraries of a single DB2 subsystem or entire DataSharinggroup before starting DB2 with following maintenance.Vanilla IBM DB2 load modules are needed for processing. PQ48486/UQ81009(0310) Toleration of fallback from DB2 Version 8......PQ84421/UQ85439(0403) adds a new job DSNTIJP8 to V7.

Page 6: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 6

Page 7: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 7

Page 8: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 8

Page 9: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 9

DFSORT is mandatory for IBM utilities

If missing, it will not work Special licence for DB2 usage Shipped with z/OS May need to add a STEPLIB to JCL IBM utilities Does not affect non IBM utilities

DSNU000I DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = PRD.REORGUP DSNU1044I DSNUGTIS - PROCESSING SYSIN AS EBCDIC DSNU1640I DSNUGUTC - Z/OS DFSORT LOAD MODULE NOT LOADED. DSNU012I DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8

Page 10: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 10

Use alias in PROCs, JCLs, etc Simplifies next migration and fallback Target library must be APF (when applicable) Security applied on target library

DSLIST - Data Sets Matching DWA1LIB.* Row 1 of 10 Command ===> Scroll ===> PAGE Command - Enter "/" to select action Message Volume ------------------------------------------------------------------------------- DWA1LIB.SDSNEXIT *ALIAS DWA1LIB.SDSNLOAD *ALIAS DWA1LIB.SDSNLOD2 *ALIAS DWA1LIB.V7.SDSNEXIT IC23A3 DWA1LIB.V7.SDSNLOAD IC23A3 DWA1LIB.V7.SDSNLOD2 IC23A3 DWA1LIB.V8.SDSNEXIT IC23AA DWA1LIB.V8.SDSNLOAD IC23AA DWA1LIB.V8.SDSNLOD2 IC23AA ***************************** End of Data Set list ****************************

Page 11: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 11

SPAS stored procedures not longer supported In CM use V7 version or get -4700 JDBC & ODBC: DSNTIJMS Best performance: NUMTCB > 1 Control Center: DSNTIJCC Tools: Only SP part of DSNTIJSG Care on distributing SP to WLM Environments XML SP MQ Series SP

Page 12: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 12

WLM ENVNAME NUMTCB

APF Authorized Pourpose Origin Description Notes

WLMENV1 40 YES DB2DEBUG.SYS*SQLJ.INSTALL_JARSQLJ.REPLACE_JARSQLJ.REMOVE_JARSYSIBM.SQL*SYSPROC.WLM_REFRESHSYSPROC.DSNTJSPP + STORED PROCEDURES + Control Center

DSNTIJSDDSNTIJSGDSNTIJSGDSNTIJSGDSNTIJSGDSNTIJSGDSNTIJSG + DSNTIJMS + DSNTIJCC

DB2 Supplied stored procedures Must be autorized for WLM_REFRESH

WLMENV2 1 NO SYSPROC.DSNTPSMPSYSPROC.DSNTBINDSYSPROC.DSNACCTS

DSNTIJSGDSNTIJSG

REXX requires NUMTCB=1 Check for DSNX993I error message in case of problems

WLMENV3 40 NO User SQL stored procedures Created manuallyor by using DB2Development Center orStored ProcedureBuilder

SHOULD have at least ONE unauthorized data set

WLMENV4 8 NO User Java stored procedures Created manuallyor by using DB2Development Center orStored ProcedureBuilder

SHOULD have at least ONE unauthorized data set.One JVM is loaded for each NUMTCBspecified. The presence of the //JAVAENV in the JCL causes the JVM to be loaded

WLMENV5 1 YES DSNUTILS Allows the execution of DB2 utilities

NTMTCB=1 is mandatory

Page 13: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 13

WLM address space fails at start:

Missing WLM environment definition:

Missing RRS:

DMA1WLM IEF403I DMA1WLM - STARTED - TIME=15.14.45 CNTEROC #IEF403I (J1WLM) DMA1WLM - STARTED - TIME=15.14.45 DMA1WLM DSNX967I DSNX9WLM ATTEMPT TO PERFORM WLM FUNCTION IWMCONN FAILED DMA1WLM WITH WLM RC = 0000000C RSN = 11580C1A SSN =

EJES510 USER-ESAMIL--/VARY WLM,APPLENV=WLMENV1,REFRESH WLMENV1,REFRESH IWM030I VARY REFRESH FOR WLMENV1 REJECTED, APPLICATION ENVIRONMENT NOT DEFINED

CNTEROC #IEF403I (J1WLM) DMA1WLM - STARTED - TIME=16.01.32 DMA1WLM DSNX982I DSNX9WLM ATTEMPT TO PERFORM RRS ATTACH FUNCTION SPAS_IDMA1WLM FAILED WITH RRS RC = 00000008 RSN = 00F30091 SSN = DMA1 DMA1WLM PROC= DMA1WLM ASID = 013D WLM_ENV = DMA1WLM .....DSN3029I -DMA1 DSN3RRRS RRS ATTACH PROCESSING IS AVAILABLE

Page 14: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 14

DSNUTILS:

REXX:

//DDA1WLM PROC RGN=0K,APPLENV=WLMDDA1ENV5,DB2SSN=DDA1,NUMTCB=1//IEFPROC EXEC PGM=DSNX9WLM,REGION=&RGN,TIME=NOLIMIT, // PARM='&DB2SSN,&NUMTCB,&APPLENV' //STEPLIB DD DISP=SHR,DSN=DDA1SOFT.RUNLIB.LOAD // DD DISP=SHR,DSN=DDA1LIB.SDSNLOAD //UTPRINT DD SYSOUT=* //RNPRIN01 DD SYSOUT=* //DSSPRINT DD SYSOUT=* //SYSIN DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND) //SYSPRINT DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)

//DDA1WLM PROC RGN=0K,APPLENV=WLMDDA1ENV2,DB2SSN=DDA1,NUMTCB=1 //IEFPROC EXEC PGM=DSNX9WLM,REGION=&RGN,TIME=NOLIMIT, // PARM='&DB2SSN,&NUMTCB,&APPLENV' //SYSEXEC DD DISP=SHR,DSN=DDA1SOFT.V8.SDSNCLST //STEPLIB DD DISP=SHR,DSN=DDA1SOFT.RUNLIB.LOAD // DD DISP=SHR,DSN=DDA1LIB.SDSNLOAD //SYSTSPRT DD SYSOUT=*

Page 15: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 15

Page 16: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 16

Page 17: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 17

CM

CM

CM

CM

ENFM

ENFM

ENFM

ENFM

NFM

NFM

NFM

NFM

CMENFM

NFM

NFM

NFM

NFM

Page 18: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 18

FUNCTION = ENABLE NEW FUNCTION MODE PROCESSING

It is the longest job in ENFMREORG Catalog and DirectoryCritical: verify number of RECORDS in

VSAM definitions Will fail if user defined indexes on Catalog

but missing SHADOW dataset in JCL

Page 19: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 19

DSN TRKS CYLS DB TS CI Size RECORDS

CAT.DSNDBD.DSNDB06.SYSPKAGE.I0001.A001 2250 150 DSNDB06 SYSPKAGE 4096 27000

CAT.DSNDBD.DSNDB01.SYSLGRNX.I0001.A001 1500 100 DSNDB01 SYSLGRNX 4096 18000

CAT.DSNDBD.DSNDB06.DSNKSX01.I0001.A001 1125 75 DSNDB06 DSNKSX01 4096 13500

CAT.DSNDBD.DSNDB01.DSNSPT02.I0001.A001 750 50 DSNDB01 DSNSPT02 4096 9000

CAT.DSNDBD.DSNDB06.SYSDBASE.I0001.A001 750 50 DSNDB06 SYSDBASE 4096 9000

CAT.DSNDBD.DSNDB06.SYSCOPY.I0001.A001 450 30 DSNDB06 SYSCOPY 4096 5400

CAT.DSNDBD.DSNDB01.DBD01.I0001.A001 375 25 DSNDB01 DBD01 4096 4500

CAT.DSNDBD.DSNDB01.DSNLLX01.I0001.A001 375 25 DSNDB01 DSNLLX01 4096 4500

CAT.DSNDBD.DSNDB01.DSNSPT01.I0001.A001 375 25 DSNDB01 DSNSPT01 4096 4500

CAT.DSNDBD.DSNDB01.SCT02.I0001.A001 375 25 DSNDB01 SCT02 4096 4500

CAT.DSNDBD.DSNDB06.SYSPLAN.I0001.A001 375 25 DSNDB06 SYSPLAN 4096 4500

RECORDS = (CI Size/4096)*12*Trks

Page 20: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 20

Verify and eventually update RECORDS Special attention to SYSSPT01

//ENFM0113 EXEC PGM=IDCAMS,COND=(2,LE,ENFM0110) //DATADEV DD UNIT=3390,DISP=OLD,VOL=SER=PR23A3 //INDEXDEV DD UNIT=3390,DISP=OLD,VOL=SER=PR23A3 //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER - ( NAME(DPA1CAT.DSNDBC.DSNDB06.SYSPKAGE.J0001.A001) - FILE(DATADEV) - LINEAR - REUSE - VOLUMES(PR23A3) - RECORDS(27000 27000) - SHAREOPTIONS(3 3) ) - DATA - ( NAME(DPA1CAT.DSNDBD.DSNDB06.SYSPKAGE.J0001.A001) - ) CATALOG(DPA1CAT)

Page 21: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 21

Total elapsed time = 5 min Copies were done on TAPE RC = 1 [CHECK THE NFM STATUS OF SYSSPT01]

Page 22: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 22

Why? SPROC are invalidated in V8 before rebind Get V8 optimizer benefits Data types mismatches become stage 1

Need to perform a controlled REBIND process No need to REBIND in NFM Have a list of critical packages to verify Must see the difference of an access path change

because an application change A single worse statement avoids package rebind

Page 23: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 23

Compare EXPLAIN tables V7 vs. V8: If Cost increases: investigate If Cost stays the same: rebind If Cost decreases: rebind

Create a baseline in V7 in dummy collection if not EXPLAIN = YES

Use DSNTESC to create tables: PLAN_TABLE DSN_FUNCTION_TABLE DSN_STATEMNT_TABLE DSN_STATEMENT_CACHE_TABLE

Page 24: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 24

Execution statistics-------------------- Total number of impacted plan_table rows 362953 Number of processed packages 2994 Number of changed plan_table rows 6607

Number of cost changes 23143 ----------------------

Cost increases 3001 Cost decreases/is the same 20142

Page 25: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 25

Page 26: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 26

V7 For logged user (TSO/SDSF): id passed through for

console commands = SYSOPR Zparm SYSOPRn=SYSOPR allows any user to enter

commands from console V8

For logged on user: id passed through for console commands is now the user and not SYSOPR

Console operator could be unable to operate DB2 RACF groups and secondary authids supported in

V8

Page 27: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 27

64 bits addressing is NOT the solution to ALL the VS problems Still need to work on VSCR

Some structures remain under the bar or the line Only IRLM and DBM1 address spaces exploit 64-bit

addressing Several critical storage pools above 2GB bar, i.e. BPOOLS Thread related storage stays below the bar & Thread

footprint increases 30% - 70% Look after REAL storage, not only VIRTUAL storage Observed increase about 3% depends on usage ftp://ftp.software.ibm.com/software/data/db2zos/DB2VSTORprez.pdf

Page 28: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 28

V7: Start IFCID 225 destination SMF if not yet done

Tiny overhead PQ99658:

System parameter STATIME default time is reduced from 30 minutes to 5

IFCID 225 is added to STATISTICS trace class 1

DSNW127I -DAC1 CURRENT TRACE ACTIVITY IS - TNO TYPE CLASS DEST QUAL 01 STAT 01,03,04,05, SMF NO 01 06 02 ACCTG 01,02,03 SMF NO *********END OF DISPLAY TRACE SUMMARY DATA*********

-START TRACE(STAT) DEST(SMF) CLASS(6) IFCID(225)

Page 29: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 29

STATISTICS REPORT

DDNAME(STATSDD) LAYOUT(LONG)

EXEC

LOCATION: DBGP DB2 PERFORMANCE MONITOR (V4 ) PAGE: 2-10 GROUP: N/P STATISTICS REPORT - LONG REQUESTED FROM: NOT SPECIFIED MEMBER: N/P TO: NOT SPECIFIED SUBSYSTEM: DBPX INTERVAL FROM: 11/16/07 DB2 VERSION: V8 SCOPE: MEMBER TO: 11/18/07 DBM1 AND MVS STORAGE BELOW 2 GB QUANTITY DBM1 AND MVS STORAGE BELOW 2 GB QUANTITY ---------------------------------------- ---------- --------------------------------------- ----------- TOTAL DBM1 STORAGE BELOW 2 GB (MB) 126.39 24 BIT LOW PRIVATE (MB) 0.21 TOTAL GETMAINED STORAGE (MB) 118.22 24 BIT HIGH PRIVATE (MB) 0.34 VIRTUAL BUFFER POOLS (MB) N/A 31 BIT EXTENDED LOW PRIVATE (MB) 31.41 VIRTUAL POOL CONTROL BLOCKS (MB) N/A 31 BIT EXTENDED HIGH PRIVATE (MB) 142.20 EDM POOL (MB) 117.19 EXTENDED REGION SIZE (MAX) (MB) 1643.00 COMPRESSION DICTIONARY (MB) N/A EXTENDED CSA SIZE (MB) 244.28 … DBM1 STORAGE ABOVE 2 GB QUANTITY REAL AND AUXILIARY STORAGE QUANTITY--------------------------------------- ----------- --------------------------------------- ----------- FIXED STORAGE (MB) 0.01 REAL STORAGE IN USE (MB) 115.68 GETMAINED STORAGE (MB) 164.21 AUXILIARY STORAGE IN USE (MB) 0.00 COMPRESSION DICTIONARY (MB) 0.12 CACHED DYNSQL STATEMENTS (MAX) (MB) 52.89 DBD CACHE (MAX) (MB) 52.89 PAGES HELD BY DBDS 216.20…

Page 30: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 30

WARNING: check activity @ snapshot Should consider trends

Page 31: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 31

Paul Fletcher’s REXX for READS and gather IFC225 [email protected] Can be used for long term monitoring

Page 32: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 32

>500MB = GREEN200-500MB = AMBER<200MB = RED

Page 33: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 33

IBM published CPU expected changes considering no use of new V8 features

0%-10%-20% +10% +20%

Page 34: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 34

IBM objective for regression is less than 10% Not only Acctg Class 2 increase expected Must consider CPU reduction in DB2 system

address spaces

Page 35: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 35

Rebind all packages/plans Multi-row FETCH and INSERT MQTs Increase size of buffer pools Long term page fix buffer pools

Fix the buffer pages once in memory and keep them fixed in real storage

0% to 8% CPU savings Only if enough real storage to back bpools 100% Activated by -ALTER BPOOL(x) PGFIX(YES) Performance benefit is inversely proportional to the buffer hit ratio:

○ The higher the hit ratio, the lower the benefit○ Apply to small buffer pools with lots of I/Os

Page 36: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 36

Page 37: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 37

New in V8: BACKUP SYSTEM RESTORE SYSTEM

Not supported in CM Scenarios:

Backup entire DB2 system. System-level PITR for logical DR: BACKUP SYSTEM DATA ONLY Physical DR: BACKUP SYSTEM FULL System cloning Backup outside of DB2 using DFSMShsm commands New in V9 + z/OS 1.8: Restore DB2 objects from volume

dumps you can prepare now to get advantage

Page 38: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 38

The migration process is a good opportunity for preparing to Backup and Restore System

Consider to apply systematicly to new DB2s Has impact on Storage Management Requires:

Definition of 2 SMS Copy Pools for data and logs○ DSN$locn-name$DB for data○ DSN$locn-name$LG for log

Definition of SMS Copy Pool Backup storage group SMS managed datasets: including DB2 catalog &

directory + logs○ Log placement: use Guaranteed Space for volume allocation +

EF for striping

Page 39: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 39

Define separate ICF Catalogs User data, DB2 catalog and directory Logs (optionally system load libraries)

Define SMS Storage Groups For user data For the DB2 Catalog & Directory and the ICFCTLG For the DB2 logs, BSDS and the ICFCTLG

Page 40: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 40

Storage group

SGP1LG

Copy poolDSN$DPC1$LG

DB2 Logs and BSDS

ICFCTLG

UCAT.PC1.DB2LG

VLG001 VLG002 VLG00n

Storage group

SGP1SY

Copy poolDSN$DPC1$DB

DB2 Catalog and DirectoryDSNDB04DSNDB07

ICFCTLG

UCAT.PC1.DB2SY

VSY001 VSY002 VSY00n

Storage group

SGP1UD

Bussiness Data

Defined on ICFCTLG

UCAT.PC1.DB2SY

VDB001 VDB002 VDB00n

Copy pool backup storage group

CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn

CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn CPVnnn

Page 41: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 41

Creates full volume dasd copies of the DB2 subsystem

Replaces the –set log suspend + –set log resume method

BACKUP SYSTEM FULL or BACKUP SYSTEM DATA ONLY

SYSCTRL or SYSADM authority required DB2 does not take any quiesce points BSDS Backup History is updated DB2 keeps track of 50 backups in the BSDS

Page 42: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 42

DSNU000I DSNUGUTC -OUTPUT START FOR UTILITY, UTILID = PRD.BKUPSYSDSNU1044I DSNUGTIS -PROCESSING SYSIN AS EBCDIC DSNU050I DSNUGUTC -BACKUP SYSTEM FULLDSNU1600I DSNUVBBD -BACKUP SYSTEM UTILITY FOR DATA STARTING,

COPYPOOL = DSN$PRD$DBTOKEN = X'E7F9F6C1BAAF725F60A7E106001C3D582090'.

DSNU1614I DSNUVBBD -BACKUP SYSTEM UTILITY FOR DATA COMPLETED SUCCESSFULLY,COPYPOOL = DSN$PRD$DB TOKEN = X'E7F9F6C1BAAF725F60A7E106001C3D582090' ELAPSED TIME = 00:00:23.

BACKUP SYSTEM UTILITY HISTORY SUBSYSTEM ID PRD 20:03:12 JANUARY 30, 1999 START STCK DATA COMPLETE DATA/LOGDATA LOG RBLP LRSN DATE -----------------------------------------------------------------BAAF725F60A7E106 BAAF7275EF9EF603 001C3D582090001C3D582090 2004/01/27TOKEN = E7F9F6C1BAAF725F60A7E106001C3D582090BAA928EADE2A7E26 BAA92904E3FE8D66 001C3A22B090 001C3A22B090 2004/01/22TOKEN = E7F9F6C1BAA928EADE2A7E26001C3A22B090 COMPLETE LTIME LOCATION NAME----------------------08:40:47 PRD08:40:17 PRD

Page 43: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 43

Restores DB2 system to specified point-in-time RESTORE SYSTEM or RESTORE SYSTEM LOGONLY

Use for logical or for physical DR Needs to conditionally restart DB2 prior to

running RESTORE SYSTEM –DSNJU003, CRESTART CREATE SYSPITR=logpoint

INSTALL SYSADM authority required Handles CREATE, DROP and LOG NO events… …but some LOG NO operations not supported:

LOAD LOG NO, REORG, CREATE INDEX

Page 44: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 44

DSNJU003:

SYSOUT:

CRESTART CREATE SYSPITR=log-point

DSNU000I DSNUGUTC -OUTPUT START FOR UTILITY, UTILID = PRD.SRESTORE DSNU1044I DSNUGTIS -PROCESSING SYSIN AS EBCDIC DSNU050I DSNUGUTC -RESTORE SYSTEM DSNU1606I DSNUVBRD -RESTORE SYSTEM UTILITY STARTING,

COPYPOOL = DSN$PRD$DBTOKEN = X'E7F9F6C1BAAF725F60A7E106001C3D582090'.

DSNU1627I DSNUVBRD -RESTORE SYSTEM PRE-LOG APPLY COMPLETED SUCCESSFULLY, COPYPOOL = DSN$PRD$DB TOKEN = X'E7F9F6C1BAAF725F60A7E106001C3D582090' ELAPSED TIME = 00:00:15.

...DSNU1604I -X96A DSNUVARL -RESTORE SYSTEM PHASE LOG APPLY STARTED AT LOG POINT =

X’001C3D582090’DSNU1629I -X96A DSNUVARL -DB2 PUT ONE OR MORE OBJECTS INTO THE RECOVER-PENDING

STATE, THE REBUILD-PENDING STATE OR THE LOGICAL PAGE LIST DURING THE LOG APPLY PHASE.

DSNU1628I DSNUVBRD -RESTORE SYSTEM PHASE LOG APPLY COMPLETED, ELAPSED TIME = 00:01:42.

DSNU010I DSNUGBAC -UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

Page 45: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 45

Good news: sliding secondary allocation quantity size

DB2 calculates the secondary extents size by using a sliding scale algorithm

Applies to DB2 managed pagesets only Tries to avoid VSAM maximum extent limit errors Scenarios:

No need for PRIQTY/SECQTY values Don’t know space requirements or are volatile Test environment: SET and FORGET

Page 46: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 46

Some advantages: It minimizes the potential for wasted space by increasing the

size of secondary extents slowly at first It prevents very large allocations for the remaining extents,

which would likely cause fragmentation It does not require users to specify SECQTY values when

creating and altering table spaces and index spaces It is theoretically possible to always reach maximum data set

size without running out of secondary extents WARNING: DB2 uses the value of the SECQTY option

to allocate a secondary extent only if the value of the option is larger than the value that is derived from the sliding scale algorithm

Page 47: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 47

Default PRIQTY 1 cylinder for non-LOB tablespaces and indexes 10 cylinders for LOB tablespaces

First 127 extents are allocated in increasing size, and the remaining extents are allocated based on the initial size of the data set: For 32 GB and 64 GB data sets, each extent is allocated

with a size of 559 cylinders For data sets that range in size from less than 1 GB to

16 GB, each extent is allocated with a size of 127 cylinders

Page 48: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 48

< 16GB: 127 CYLs

< 64GB: 559 CYLs

Page 49: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 49

INSTALL DB2 - SIZES PANEL 2 ===> Check numbers and reenter to change: 1 USER LOB VALUE STORAGE ===> 10240 Max storage per user for LOB values in kilobytes 2 SYSTEM LOB VALUE STORAGE ===> 2048 Max storage per system for LOB values in megabytes 3 MAXIMUM LE TOKENS ===> 20 Maximum tokens at any time. 0-50 4 TABLE SPACE ALLOCATION ===> 0 Default space allocation in KB for table spaces (0 for DB2 default or 1-4194304) 5 INDEX SPACE ALLOCATION ===> 0 Default space allocation in KB for index spaces (0 for DB2 default or 1-4194304) 6 VARY DS CONTROL INTERVAL ===> YES Optimize VSAM CONTROL INTERVAL to page size for data set allocation 7 OPTIMIZE EXTENT SIZING ===> YES Use sliding secondary quantity for DB2-managed data sets

Can be activated online Zparm MGEXTSZ=YES (default = NO) Existing pagesets: ALTER PRIQTY/SECQTY to -1 + REORG

Page 50: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 50

Is it working?------------------------------------------------------------------------- DPA1CAT.DSNDBC.DSN8D81A.DSN8SBIN.I0001.A001 listcat ent(/) all NDBD.DSN8D81A.DSN8SBIN.I0001.A001 540 ? 8 33 ***************************** End of Data Set list **********************VOLUME VOLSER------------PR23A3 PHYREC-SIZE---------8192 HI-A-RBA--------26542080 EXTENT-NUMBER----------8 DEVTYPE------X'3010200F' PHYRECS/TRK------------6 HI-U-RBA--------25804800 EXTENT-TYPE--------X'40' VOLFLAG------------PRIME TRACKS/CA-------------15 EXTENTS: LOW-CCHH-----X'03C80000' LOW-RBA----------------0 TRACKS----------------15 HIGH-CCHH----X'03C8000E' HIGH-RBA----------737279 LOW-CCHH-----X'04680000' LOW-RBA-----------737280 TRACKS----------------30 HIGH-CCHH----X'0469000E' HIGH-RBA---------2211839 LOW-CCHH-----X'046A0000' LOW-RBA----------2211840 TRACKS----------------45 HIGH-CCHH----X'046C000E' HIGH-RBA---------4423679 LOW-CCHH-----X'046D0000' LOW-RBA----------4423680 TRACKS----------------60 HIGH-CCHH----X'0470000E' HIGH-RBA---------7372799 LOW-CCHH-----X'04740000' LOW-RBA----------7372800 TRACKS----------------75 HIGH-CCHH----X'0478000E' HIGH-RBA--------11059199 LOW-CCHH-----X'04790000' LOW-RBA---------11059200 TRACKS----------------90 HIGH-CCHH----X'047E000E' HIGH-RBA--------15482879 LOW-CCHH-----X'0A280000' LOW-RBA---------15482880 TRACKS---------------105 HIGH-CCHH----X'0A2E000E' HIGH-RBA--------20643839 LOW-CCHH-----X'0A3F0000' LOW-RBA---------20643840 TRACKS---------------120 HIGH-CCHH----X'0A46000E' HIGH-RBA--------26542079

Page 51: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 51

Materialized Query Tables = MQTs Table containing materialized data derived from one

or more source tables specified by a fullselect Similar to automatic summary tables Query rewrite for dynamic SQL Can be accessed directly by static and dynamic SQL System-maintained MQTs (default) are populated with

REFRESH TABLE User-maintained MQTs can be populated by REFRESH

TABLE, load, insert, update and delete

Page 52: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 52

Datawarehouse Need to improve performance of critical query Query:

10 tables involved in a multiple join can be improved by the use of a MQT

Validate the REFRESH needs for the MQT and schedule it

The created MQT needs to be validated need to determine which part of the query is fix and which part is variable (local predicates)

Page 53: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 53

Original query:SELECT DISTINCT(REP.REPID) representativeId, REP_LOC.LOCATIONID locationId, REP_PROD.PRODUCTID productId FROM EIS.REP_REPRESENTATIVE REP join EIS.REP_LOCATION REP_LOC on REP.REPID=REP_LOC.REPID AND REP_LOC.STATUSID=1 AND REP_LOC.PRODUCTDIFFERENTIATIONFLAG = 1 left join EIS.GEN_CITY CITY on CITY.cityId = REP_LOC.cityId join EIS.REPPRODUCTCONFIG REP_PROD on REP.REPID = REP_PROD.REPID AND REP_PROD.STATUSID=1 join EIS.LOCPRODUCTCONFIG REP_LOC_PROD on REP_PROD.PRODUCTCONFIGID = REP_LOC_PROD.PRODUCTCONFIGID AND REP_LOC.LOCATIONID = REP_LOC_PROD.LOCATIONID AND REP_LOC_PROD.STATUSID=1 AND REP_LOC_PROD.CURRENCYDIFFFLAG=2 join EIS.PRDCURRENCYCONFIG REP_LOC_CURR on REP_LOC_CURR.STATUSID=1 AND REP_LOC_PROD.PRODUCTCONFIGID = REP_LOC_CURR.PRODUCTCONFIGID AND REP_LOC_CURR.LOCATIONCONFIGID IS NULL AND REP_LOC_CURR.OPERATORCONFIGID IS NULL join EIS.MTCURRENCYCONFIG REP_MT_CURR on REP_LOC_CURR.PRODUCTCURRENCYID=REP_MT_CURR.PRODUCTCURRENCYID join EIS.GEN_PRODUCT GEN_SERVICE on GEN_SERVICE.PARENTPRODUCTID=REP_PROD.PRODUCTID join EIS.REPPRODUCTSERVICES REP_SERV on REP_PROD.PRODUCTCONFIGID = REP_SERV.PRODUCTCONFIGID AND REP_SERV.SERVICEID=GEN_SERVICE.PRODUCTID AND REP_SERV.STATUSID=1 join EIS.LOCPRODUCTSERVICES REP_LOC_SERV on REP_SERV.SERVICEID=REP_LOC_SERV.SERVICEID AND REP_LOC_PROD.LOCATIONCONFIGID=REP_LOC_SERV.LOCATIONCONFIGID AND REP_LOC_SERV.STATUSID=1 WHERE REP.STATUSID=1 AND REP_MT_CURR.DIRECTION IN (2,3) AND REP_LOC.COUNTRYID=32 AND REP_PROD.PRODUCTID=2 AND CITY.NAME LIKE 'CONCEI%O DO ARAGUAIA%' AND GEN_SERVICE.productid IN (102) GROUP BY REP.REPID, REP_LOC.LOCATIONID, REP_PROD.PRODUCTID HAVING count(*)=1 ORDER BY REP.REPID, REP_LOC.LOCATIONID, REP_PROD.PRODUCTID

Page 54: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 54

Original access path:

Page 55: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 55

MQT creation:CREATE TABLE MQT.TEST3 AS (SELECT DISTINCT(REP.REPID) REPRESENTATIVEID, REP_LOC.LOCATIONID LOCATIONID, REP_PROD.PRODUCTID PRODUCTID, CITY.NAME AS CITY, REP.STATUSID AS REP_STATUSID, REP_MT_CURR.DIRECTION AS REP_MT_CURR_DIRECTION, REP_LOC.COUNTRYID AS REP_LOC_COUNTRYID, REP_PROD.PRODUCTID AS REP_PROD_PRODUCTID, GEN_SERVICE.PRODUCTID AS GEN_SERVICE_PRODUCTID FROM EIS.REP_REPRESENTATIVE REP JOIN EIS.REP_LOCATION REP_LOC ON REP.REPID = REP_LOC.REPID AND REP_LOC.STATUSID = 1 AND REP_LOC.PRODUCTDIFFERENTIATIONFLAG = 1 LEFT JOIN EIS.GEN_CITY CITY ON CITY.CITYID = REP_LOC.CITYID JOIN EIS.REPPRODUCTCONFIG REP_PROD ON REP.REPID = REP_PROD.REPID AND REP_PROD.STATUSID = 1 JOIN EIS.LOCPRODUCTCONFIG REP_LOC_PROD ON REP_PROD.PRODUCTCONFIGID = REP_LOC_PROD.PRODUCTCONFIGID AND REP_LOC.LOCATIONID = REP_LOC_PROD.LOCATIONID AND REP_LOC_PROD.STATUSID = 1 AND REP_LOC_PROD. CURRENCYDIFFFLAG = 2 JOIN EIS.PRDCURRENCYCONFIG REP_LOC_CURR ON REP_LOC_CURR.STATUSID = 1 AND REP_LOC_PROD. PRODUCTCONFIGID = REP_LOC_CURR.PRODUCTCONFIGID AND REP_LOC_CURR.LOCATIONCONFIGID IS NULL AND REP_LOC_CURR. OPERATORCONFIGID IS NULL JOIN EIS.MTCURRENCYCONFIG REP_MT_CURR ON REP_LOC_CURR.PRODUCTCURRENCYID = REP_MT_CURR. PRODUCTCURRENCYID JOIN EIS.GEN_PRODUCT GEN_SERVICE ON GEN_SERVICE.PARENTPRODUCTID = REP_PROD.PRODUCTID JOIN EIS.REPPRODUCTSERVICES REP_SERV ON REP_PROD.PRODUCTCONFIGID = REP_SERV.PRODUCTCONFIGID AND REP_SERV.SERVICEID = GEN_SERVICE.PRODUCTID AND REP_SERV. STATUSID = 1 JOIN EIS.LOCPRODUCTSERVICES REP_LOC_SERV ON REP_SERV.SERVICEID = REP_LOC_SERV.SERVICEID AND REP_LOC_PROD.LOCATIONCONFIGID = REP_LOC_SERV. LOCATIONCONFIGID AND REP_LOC_SERV.STATUSID = 1) ;

Page 56: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 56

A daily REFRESH TABLE process was scheduled Query rewrite:

SELECT representativeId, locationId, productId  

FROM mqt.test3 WHERE REP_STATUSID=1 AND  

REP_MT_CURR_DIRECTION IN (2,3) AND  REP_LOC_COUNTRYID=32 AND REP_PROD_PRODUCTID=2 AND  CITY LIKE 'CONCEI%O DO ARAGUAIA%' AND  GEN_SERVICE_productid IN (102)

GROUP BY representativeId, LOCATIONID, PRODUCTID

HAVING  count(*)=1 ORDER BY 1,2,3

Page 57: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 57

New access path:

Page 58: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 58

Page 59: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 59

New in V8: Statistics Advisor List cached statements and explain from statement

cache Detailed explain information (incomplete list):

○ Qualified rows estimates ○ Detailed index costing information ○ Parallelism details ○ Sort details

Page 60: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 60

RedBook SG24-7421 Not fully activated in V8

V8 NFM only Full support in V9

Page 61: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 61

Page 62: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 62

Page 63: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 63

zIIPs NOT PADDED Indexes Backwards Index Scanning Unlike Types are now Indexable Non-Uniform Distribution Statistics on Non-Indexed Columns Partitioning and clustering separated Parallel Sorting 64-bit Exploitation Data Partitioned Secondary Indexes 4096 Partitions 2000 byte Keys Long Object Names 2 MB SQL Statements 225 Table Joins Multi-row FETCH and INSERT More log space Online schema change…

Page 64: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 64

Page 65: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 65

Moving to V8 is goodTake documentation seriouslyPlanning is key in the migration processA lot of improvements and new featuresPlan to get value of the new V8 featuresEducate yourself and others

Page 66: Db2 V8 Migration And New Functions

© 2007 MConsulting - [email protected] 66

Questions?

[email protected]