38
© 2015 IBM Corporation zAnalytics DB2 Update Day 2015 – March 23-27, 2015 1 DB2 Update Day 2015 Tom Ulveman Jensen Architect DB2 Admin & Compare Development IBM Silicon Valley Lab [email protected]

Db2 day 2015 admin and compare tom

Embed Size (px)

Citation preview

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

1

DB2 Update Day 2015

Tom Ulveman JensenArchitect DB2 Admin & Compare DevelopmentIBM Silicon Valley [email protected]

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

2

Agenda

� DB2 Trends and directions for developers

� Archiving DB2 Data

– DB2 Archives / DB2 Table Archives and others – comparison

� Managing DB2 with IBM Admin & Compare for System z

– Update on functionality & Customer Use Case

� DB2 11 Update for Developers

– DB2 development options and use

� Native Stored Procedures

– SQL/PL for DB2 11

– Revisiting Native Stored Procedures & SQL/PL

– Data Studio NSP example

� Analytics using QMF for DB2 on zOS / Web and Mobile extentions to analytics

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

3

Agenda

� Evolution

� Main functions

– Catalog Navigation

– AL and ALT

– Migrate

– Change Management

– CM batch

– Multi target changes

� Functions you may or may not know about

– Indexes and columns (XC)

– Extended catalog search (xSEL)

– Stored procedure support (Call)

– SQ Explain and PLANTAB

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

4

Admin & OC - Evolution

Initial IBM product - DB2 V5

Admin V6.1 “Try and Buy” - DB2 V6

1999Admin V2.1 (Migrate and Alter support)

2000Admin V3.1, OC V1.1 – DB2 V7

2001

Admin V5.1, OC V3.1 – DB2 V8

2004

Admin V4.1, OC V2.1

2002Admin V4.2

2003

Admin V7.1, OC V7.1

2005Admin V7.2, OC V7.2 – DB2 V9

2007Admin V10.1, OC V10.1 – DB2 V10

2010

1995

Admin V10.2, OC V10.2

2012

Driving factors:Customer RequirementsDB2 Version ExploitationIBM InitiativesCompetitive Gaps

Admin V11.1, OC V11.1 – DB2 V11

2013New function APARs

2014

Internal IBM Tool - DB2 V1 – DB2 V4

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

5

Addressing the needs of the developers, DBAs, …

DB2 AdminDB2 Object Compare

DBAs need to be able to define and change objectsNeed to focus on the business needs and let the tool do the detail work

Object/DataMigration

Compare Object sets

CREATE/ALTERDialogs

Complex Alters(ALT)

ChangeManagement

CatalogNavigation

DB2 UtilityJCL

SQL Statements

Manage DB2ZParms

SpaceManagement

DB2Commands

DBAs are routinely interrupted by the “unexpected”Need to be able to find the problem quickly and solve it even faster

DDL recreation(GEN)

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

6

Catalog Navigation� Full set of object and

authorization options

� Input fields for common predicate values

� May use LIKE or = predicate operator

� May also “fast path” a catalog navigation query with the “CAT” or “?” primary command

– Eg. “?T DSN8%.EMP%:”

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

7

Catalog Navigation – a typical display� Primary commands

perform on all objects in the list

� Line commands perform on one object in the list

� Filter fields to hide objects in the list

� May offer dozens of operations from a given catalog navigation panel

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

8

� Generates the DDL for an object (DB, TS, TB, IX …)

� Dependent objects and privileges (GRANTs) can also be included

� Dependent levels can be excluded (e.g. GEN all tables or all views on tables in a DB)

� Object names can be masked (translated using masks)

� Attributes can be overwritten

� RUNSTATS information can be extracted

� Specific objects can be excluded using exclude specifications

� The GEN extract request can be modified to specify generic object names

� Use the DDL line command to generate DDL for a single object

� Optionally modify the DDL and run it online

� GEN is used extensively in more complex Admin functions

DDL recreation (GEN)

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

9

AL and ALT

AL

–Perform DB2 ALTERs

–Some may lead to DB2 pending changes (+611)

–Prompted for REORG

–ALTER statement can be added to a work statement list (WSL)

ALT

–More complex changes

–Can require UNLOAD, DROP,CREATE, and LOAD

–Additional objects can be included in the changes

–Goes through an ”analyze” phase

–Generates jobs or a WSL to apply the changes

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

10

� Copies DDL and data (or just data or DDL) from one system to an other

� Names can be masked (e.g. SCHEMA, OWNER, NAME)

� Target can be on the same subsystem

� Attributes can be overwritten (e.g. BPOOL, PRIQTY…)

� RUNSTATs information can also be copied

� Operates on levels

–Data bases

–Table spaces

–Tables

–Views (can be elevated to tables or table spaces)

Migrate

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

11

Table Details – “DET”Table details are followed by

columns, indexes and aliases

Can SAVE the information to a file

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

12

Table Details – “DET”ZOOM primary command to

collapse or expand one or all sections

Information is displayed in “sections”

Sections can be collapsed or expanded with ‘-’ and ‘+’ line commands

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

13

13

Package Details – “DET”DET line command against a

package

DET primary command on a list of packages

Show detail information for the package, its SQL and Explain information

SAVE, ZOOM, collapse and expand capability

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

14

Package Details – “DET”� SQL statements are

formatted

� Host variable names are substituted into the statement

� Host variable data type information is included for informational purposes

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

15

DB2 Object Comparison

Source objects Target objectsCompare

Apply

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

1616

Change Management� “CM” is a set of

capabilities for managing changes to DB2 objects

� Requires Admin and Object Compare

� Helps manage the change lifecycle

� Helps to coordinate changes

� Change information stored in DB2

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

17

Change Management Processes

� Register – DBA-initiated modifications to DB2 objects

� Analyze – Product decides how to implement the change

� Run – Job to implement the change

� Recover – Job to undo the change

� Promote – Combine changes together

� Import – Copy changes to other systems

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

18

CM Batch

• Before: • Change Management requires online actions

• Now:• Support CM processes in a single batch step:

• Compare/Import• Register -> Analyze -> Run• Recover• Create a mask (stored in CM database)• Create an ignore (stored in CM database)

• Can mix and match between online and batch• Eg. Register online, Analyze and Run using CM Batch

• Parameters to control the processes• Documented and mimic the online options

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

19

CM Batch – Parameter specification

• Each CM process has a set parameters

• Two DDs are read to obtain the parameters:• PROFPARM DD is read first• PARMS DD is read second

• PROFPARM - Allows installer to provide “shop standards” for any parameter

• PARMS - Allows the DBA to focus only on the parameters specific for their use (Eg. Change name)

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

20

CM Batch – Parameter examples

//PARMS DD *ACTION_IMPORT_MASK = 'Y'

,ACTION_IMPORT_CHANGE = 'Y‘,ACTION_ANALYZE_CHANGE = ‘N‘,REPORT_ONLY_CHANGED_OBJECTS =

‘YES’ ,PDS_FOR_WSL = 'APPL.WSL‘,PREFIX_FOR_DATA_SETS =

‘J148286.CMBATCH'

• Parameters to state which actions to perform

• Parameters to define the change, mask, ignore

• Parameters for utilities and utility options

• …

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

21

� Use a JCLLIB and a PROC to allow installer to set installation standards in PROFPARM DD

� Use PARMS DD to provide specifics for this change

� Default actions:

– Register the statements

– Analyze the change

– Build a Run job

CM Batch Example

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

22

� Upon completion

– The RUN job was built automatically

– The PARMS data set has been prebuilt for the change

– The implementation statements are in a data set

CM Batch Example – The RUN job

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

23

CM Batch Example - PARMS� The prebuilt action to

take is to run this change

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

24

� Allows to create the same change on multiple targets (or groups)

� Separate masks and ignores can be defined for each target

� Targets can be member of a group

� Status and data can be transferred via DRDA or files

� Central system keeps track of the status of the individual target changes

Multi target changes

Central

Target group 1

Target 1.1

Target 1.2

Target 2

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

25

Centralized view of all target changes

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

26

Centralized view of all target changes

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

27

� Extended catalog search

� Indexes and columns

� Call stored procedures

� Plan table rows for a statement in a package

� Explain a statement in a package

Functions you may or may not know about

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

28

Extended catalog search

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

29

Extended catalog search

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

30

Indexes and columns

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

31

Indexes and columns

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

32

Call procedure support – input parameters

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

33

Call procedure support - results

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

34

Call procedure support – result sets

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

35

Explain SQL statement in a package

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

36

Explain SQL statement in a package

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

37

Display PLAN_TABLE rows for a statement

© 2015 IBM Corporation

zAnalytics DB2 Update Day 2015 – March 23-27, 2015

38

Display PLAN_TABLE rows for a statement