+ All Categories
Home > Documents > V9 technical briefing - IBM 9 for z/OS Technical Briefing DB2 9 for z/OS and tools workshop April 23...

V9 technical briefing - IBM 9 for z/OS Technical Briefing DB2 9 for z/OS and tools workshop April 23...

Date post: 20-Apr-2018
Category:
Upload: letruc
View: 225 times
Download: 2 times
Share this document with a friend
54
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 DB2 9 for z/OS Technical Briefing DB2 9 for z/OS and tools workshop April 23 rd 2008 Brussels Kurt Struyf Competence Partners
Transcript

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

DB2 9 for z/OS Technical Briefing

DB2 9 for z/OS and tools workshop April 23rd 2008

Brussels

Kurt StruyfCompetence Partners

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

Availability

© Copyright IBM Corporation 2008

V9 Availabilty features

• RENAME COLUMN– No need to drop and recreate table and associated objects– ALTER TABLE tablename RENAME COLUMN Source column name TO

target column name– All dependent plans or packages invalidated– SQLCODE -204 after auto rebind for packages referring to OLD name– RESTRICTIONS apply

• Universal Table space– PARTITION BY GROWTH / PARTITION BY RANGE

– New table space types

– Follow-on to V8 changes regarding partitioning – Combine the advantages of:

> Segmented table spaces

> Partitioned table spaces

© Copyright IBM Corporation 2008

Partition-by-growth table spaces

• Useful for table spaces that: • Do not have a suitable partitioning key

• Are expected to exceed the 64 GB limit

– Can grow up to 128 TB

– Begins its life as single-partition table space

– Additional partitions automatically created over time

– Keyword MAXPARTITIONS on CREATE or ALTER TABLESPACE limits the number of partitions

• Advantageous data structure of a segmented table space

• Can be created explicitly or implicitly

• Has almost all capabilities of partition-level operation

© Copyright IBM Corporation 2008

PBG table spaces – Implicit creation

• Every implicitly created table space is PBG table space by default

– SEGSIZE = 4

– DSSIZE = 4 GB

– MAXPARTITIONS set to 256 – can be increased

• New keyword on CREATE TABLE statement to influence values

– ... PARTITION BY SIZE EVERY integer G

© Copyright IBM Corporation 2008

PBG table spaces – Allocation

First partition full

-> allocate new

Partition

Part 2

Insert

Insert

Rollback

Result

Part 1

Begin UR

Insert

Insert

Insert

Part 2

Empty

Part 1

Old data

New partition remains after rollback

First partition full

-> ROLLBACK

Part 1Part 1

Result

Part 1Part 1

CREATE TB

Insert

Insert

Old data

No new partition while outstanding DDL

Data backed out due to outstanding DDL!

© Copyright IBM Corporation 2008

Range-partitioned table spaces

• Perfect mixture of partitioned and segmented table spaces

• To create, specify both, NUMPARTS and SEGSIZE on CREATE

• One table per table space

• Better space management when using varying-length rows

• Better performance in mass delete operations

© Copyright IBM Corporation 2008

Clone tables

• Purpose -> Give you something similar to online LOAD REPLACE

• ALTER TABLE ADD CLONE• Generate a table with the exact same attributes as base table

• Created using the same page set name as the base table

• .....I0002.... Used rather than .....I0001....

• Indexes, before triggers, LOB objects and so on also created

• Clone table has to have a different name than base table

• Once created, you can independently work with both tables

• Table can be populated via INSERT or LOAD

• Most utilities work the same as for the base table

– Base table must be Universal table space

© Copyright IBM Corporation 2008

Clone table example

DB9AU.DSNDBD.DB1.TS1.I0001.A001

DB9AU.DSNDBD.DB1.TS1.I0001.A001

DB9AU.DSNDBD.DB1.TS1.I0002.A001

ALTER TABLE BASETAB

ADD CLONE paolo.clonetab

paolor7.basetab

paolor7.basetab

paolo.clonetab

SYSIBM.SYSTABLES:

Name Owner Type

basetab paolor7 T

SYSIBM.SYSTABLES:

Name Owner Type

basetab paolor7 T

clonetab paolo C

SYSIBM.SYSTABLESPACE:

Tsname Dbname Instance Clone

ts1 db1 1 N

SYSIBM.SYSTABLESPACE:

Tsname Dbname Instance Clone

ts1 db1 1 Y

© Copyright IBM Corporation 2008

Clone tables – EXCHANGE

� The whole purpose of creating clone tables is to finally exchange data

� NEW SQL Statement EXCHANGE

EXCHANGE DATA BETWEEN TABLE table-name1 AND table-name2

� Table-name1 and table-name2 can be either base or clone table

� No data movement when exchange is initiated

� Instance numbers that point to the base or clone page set change

� Exchange only possible on table level. Partition Level not allowed

� Statistics NOT invalidated

� Plans and Packages NOT invalidated

� Dynamic Statement Cache NOT invalidated

!!YourYourResponsibilityResponsibility

© Copyright IBM Corporation 2008

Clone tables – DROP

Ways to drop your CLONE tables:

• Drop the base table using DROP TABLE statement

– BASE and CLONE tables, underlying indexes, VSAM ... Dropped

• New ALTER TABLE statement

– ALTER TABLE base-table-name DROP CLONE

– CAUTION: Must specify base table name and NOT CLONE table

– Drops CLONE table, underlying indexes, LOBS...

– SYSCOPY entries removed

– SYSLGRNX entries not removed until DBID/PSID reused

• DROP TABLESPACE

• DROP DATABASE

© Copyright IBM Corporation 2008

Other Availabilty features

• Cancel DB2 commands– To avoid long STOPP status– DISPLAY THREAD(*) SYSTEM to identify command thread

– CANCEL THREAD( )

• WLM exploitation to resolve latch contention– Before V9 : CPU stalls cause latch contention/ DBM1 below the bar storage

constraints

– V9 :

> Built-in monitor to help automate identify and correct Problems> Monitor always active

> Checks health of system on 1 minute intervals

> Identifies CPU stalls that result in latch contention> Attempt to clear latch contention via temporary priority boost

• REFRESH EARLY code– IPL no longer necessary to refresh the EARLY code

– New DB2 Command –REFRESH DB2,EARLY introduced

– DB2 must be down

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

SQL Enhancements

4.1.0.3

© Copyright IBM Corporation 2008

SQL Enhancements

• Instead of triggers– Before V9 : Many views are not updatable, so base tables have to be

accessed for data changes. Triggers can be used to help control updates

– A new type of trigger (~ BEFORE, AFTER triggers)

– Processed instead of the UPDATE, DELETE or INSERT statement that

activated the trigger

– Can only be defined on views

– Example :CREATE TABLE WEATHER (CITY VARCHAR(25), TEMPF DECIMAL(5,2))

CREATE VIEW CELCIUS_WEATHER (CITY, TEMPC) ASSELECT CITY, (TEMPF-32)*5.00/9.00 FROM WEATHER

CREATE TRIGGER CW_INSERT INSTEAD OF INSERTON CELCIUS_WEATHERREFERENCING NEW AS NEWCW DEFAULTS NULLFOR EACH ROW MODE DB2SQL

INSERT INTO WEATHERVALUES (NEWCW.CITY, 1.8*NEWCW.TEMPC+32

© Copyright IBM Corporation 2008

SQL Enhancements

• Merge statement– Combine UPDATE and INSERT operation to a target table or view

> When source rows match to target, update target rows from source> When source rows do not match to target, insert source rows into target

MERGE INTO account AS T

USING (VALUES ((:hv_id, :hv_amt) FOR 5 ROWS)) AS S(id,amt)

ON T.id = S.id

WHEN MATCHED THEN

UPDATE SET balance = T.balance + S.amt

WHEN NOT MATCHED THEN

INSERT (id, balance) VALUES (S.id, S.amt)

NOT ATOMIC CONTINUE ON SQLEXCEPTION

© Copyright IBM Corporation 2008

SQL Enhancements

• Select from Update/Delete/Merge – In V8 : Select from Insert

to retrieve DB2 generated/ calculated column values

– In V9 : Same capability for UPDATE/DELETE/MERGE– Examples :

SELECT sum(salary) INTO :salary

FROM FINAL TABLE

(UPDATE emp

SET salary = salary * 1.05

WHERE job = ‘DESIGNER');

DECLARE CS1 CURSOR FORSELECT YEAR(CURRENT DATE - HIREDATE)FROM OLD TABLE

(DELETE FROM empWHERE job = ‘ANALYST');

FETCH CS1 INTO :years_of_service;

© Copyright IBM Corporation 2008

SQL Enhancements

• Order by / fetch first.. in Subselect– Before V9: INSERT INTO temp

(SELECT * from T ORDER BY C1 FETCH FIRST 1 ROW ONLY);

– In V9: INSERT INTO temp (SELECT * from T ORDER BY C1 FETCH FIRST 1 ROW ONLY);

• Truncate Statement– Delete all data rows in a table without activating DELETE triggers– No need to drop and recreate delete triggers for faster processing– Empty a table permanently without going through the commit phase– Reuse deallocated storage– Provide functionality of LOAD REPLACE that works on

a table level in a segmented table space with multiple tables– Example :

TRUNCATE TABLE_1 DROP/REUSE STORAGEIGNORE/RESTRICT WHEN DELETE TRIGGERS

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

Application Enablement

4.1.0.3

© Copyright IBM Corporation 2008

Application Enablement

• Optimistic concurrency control a.k.a optimistic locking– Faster and more scalable locking alternative to database locking– Only for static scrollable cursors, not for dynamic scrollable cursors

– Only for cursor stability isolation

– Table should include ROW CHANGE TIMESTAMP column

– V9 : syntax to support row change easily :

CREATE TABLE DSN8910.EMP_INFO

(EMPNO CHAR(6) NOT NULL,

EMP_INFOCHANGE NOT NULL GENERATED ALWAYS

FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP,EMP_ADDRESS VARCHAR(300),EMP_PHONENO CHAR(4),

PRIMARY KEY (EMPNO))

IN DSN8D91A.DSN8S91E

CCSID EBCDIC;

© Copyright IBM Corporation 2008

Application

FETCH

row 1

Lock row 1

FETCH

row 2

Unlock row 1

Lock row 2

UPDATE WHERE

CURRENT OF

Update row 2

Time Line

DB2

Application Enablement

• without optimistic concurrency control

© Copyright IBM Corporation 2008

Application

FETCH

row 1

Lock row 1

Unlock row 1

FETCH

row 2

Lock row 2

Unlock row 2

UPDATE WHERE

CURRENT OF

Lock row 2

Compare by value

Update row 2

If values match

Time Line

DB2

Application Enablement

• with optimistic concurrency control

© Copyright IBM Corporation 2008

Application Enablement

• Skipped locked data– Isolation levels (CS and RS)– Lock sizes (Row and Page)

– Lock mode compatibility (same as before)– Example of inconsistent or incomplete result

Table T(C1 INTEGER

C2 CHAR(4))

C1 C2

1 AAAA

2 BBBB

3 CCCC

4 DDDD

Transaction A: UPDATE T SET C1=99 WHERE C1<3

Transaction B: SELECT COUNT(*) FROM TABLE T

WHERE C2>=‘AAAA’ SKIP LOCKED DATA

result transaction B : assuming no index : 2

© Copyright IBM Corporation 2008

Application Enablement

• Removing Private Protocol – Private Protocol is only used by DB2 for z/OS.– Networks are rarely homogeneous.

– Private Protocol has not been functionally enhanced since DB2 Version 5.

– DRDA support for data blocking and its improved performance make it the

preferred vehicle for remote data access

– V9 : > DB2 is positioned in this release so that outbound private protocol can be

removed in a version after Version 9> tools are made available to help determine what steps are needed to move

from private protocol to DRDA- A trace tool which can be used on both Version 8 and Version 9 systems.

Performance trace IFCID 168

- A catalog analysis tool which can be used on Version 8 and Version 9

catalog tables.

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

Utilities

© Copyright IBM Corporation 2008

Utilities

• Reorg– LOB improvements

– Before V9 : REORG of LOBS in place, SHRLEVEL NONE– V9 : REORG of LOBS SHRLEVEL REFERENCE

> LOB data unloaded to new data set

> Uses shadow data sets> Uses original LOB allocation algorithm

> In-line COPY required

– Elimination of BUILD2 Phase

– Before V9 : REORG at PARTITION LEVEL with NPI resulted in a BUILD2

phase and outage

– V9 : * Entire NPI is shadowed and reorganized

* Higher availability but increased resource consumption

© Copyright IBM Corporation 2008

Utilities

• Point in Time recovery with consistency (TORBA or TOLOGPOINT)

– Auto detect of uncommitted URs at PIT RBA

– Uncommitted changes are backed out

– All objects in RECOVER list at transactional consistent state

• � Include all related objects

• Significantly reduces the need to run QUIESCE

• Consistency not assured for RECOVER TOCOPY, TOLASTCOPY

and TOLASTFULLCOPY using SHRLEVEL CHANGE

U12U11 U21

U22

UW1

UW2

CurrentUWn - Unit of Work number n

Unm –Update number n in Unit of Work m

A

© Copyright IBM Corporation 2008

Utilities

Backout uncommitted changes in identified URs

• Reads backward from recovery PIT

• Reads log once per involved member

• Fast Log Apply is not used

• Periodically issues progress message

• Restart at last commit point

RESTORE

RESTORER

RESTOREW

LOGAPPLY

LOGCSR

LOGUNDO

Identify all active URs

• Run for each data sharing

member using objects in

RECOVER list

• Reads forward from last

checkpoint to recovery PIT

• Restart at beginning

� Backout only done for URs involving objects in RECOVER list

� Include all table spaces with active URs in the RECOVER list

© Copyright IBM Corporation 2008

Utilities

• Rebuild Index SHRLEVEL CHANGE

– Great for

• Building new non-unique indexes

• Index in RBPD

– Not good availability for moving indexes to different volumes

• Use REORG INDEX SHRLEVEL CHANGE

• New LOGAPPLY phase

• Log processing options same as REORG

© Copyright IBM Corporation 2008

Other V9 Utility enhancements

• CPU reductions in several utility operations (Reductions mostly due to improved index processing)

– 5 to 30% in Load

– 35% in Load Partition

– Up to 70% in Load Replace Partition with dummy input

– 5% to 20 in Recover Index, Rebuild Index, Reorg Tablespace,

Copy Tablespace

– 20 to 60% in Check Index

– 30 to 50% in Runstats Index

– 40 to 50% in Reorg Index

• Timeout/Deadlock condition documented in utility output

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

Performance and Scalability

4.1.0.3

© Copyright IBM Corporation 2008

Performance and scalability

• Specialty engine for the System z9 mainframe designed to help:– Integrate data across the enterprise

– Improve resource optimization and lower the cost of ownership for eligible data serving workloads

• z/OS manages and directs work between the general purpose

processor and the zIIP– Number of zIIPs per z9 not to exceed number of standard processors

– No changes to DB2 for z/OS applications

– Lower price for zIIP engines

– No IBM software charges on the zIIP – consistent with other specialty engines

• DB2 for z/OS V8 is the first IBM exploiter of the zIIP with:– System z9 EC or z9 BC

– z/OS 1.6 or higher

– DB2 for z/OS V8 or DB2 9 for z/OS

• Exploiting zIIP

© Copyright IBM Corporation 2008

How does the zIIP work?

The zIIP is designed so that a program can work with z/OS to have a

portion of its enclave Service Request Block (SRB) work directed to the zIIP. The types of DB2 work listed below are those executing in enclave

SRBs, portions of which can be redirected to the zIIP.

1. Distributed SQL requests (DRDA)

– Workloads that access DB2 for z/OS using DRDA over a TCP/IP

connection are dispatched within z/OS in enclave SRBs. z/OS directs a portion of this work to the zIIP.

Includes DB2 V9 native (non-WLM) SQL stored procedures.

2. Complex parallel queries (BI)

– Some complex parallel queries use enclave SRBs.

z/OS directs a portion of this work to the zIIP.

3. DB2 utilities for index maintenance

– DB2 utilities LOAD, REORG, and REBUILD use enclave SRBs for the

portion of the processing related to index maintenance. z/OS directs a portion of this work to the zIIP.

© Copyright IBM Corporation 2008

Mapping blocks

Object blocks

Hashtables

Mapping blocks

Object blocks

DB2 V8 EDM Storage

Dynamic

Cached SQL

DBDs

Skeletons (SKCT/SKPT)

Thread objects (CT/PT)

Hash tables

2g

DB2 V9 EDM Storage

Dynamic

Cached SQL

DBDs

Thread objects (CT/PT)

2g(fixed pools)

Skeletons (SKCT/SKPT)

Thread objects (CT/PT)

Skeletons (SKCT/SKPT)(fixed pools)

Performance and scalability

© Copyright IBM Corporation 2008

DB2 V8 Dynamic SQL caching

2g

DB2 V9 Dynamic SQL caching

2g

SQL STMT

Cache blocks

SQL Statement Cache(where SQL is executed from)

SQL STMT

Cache blocks

SQL STMT

Cache blocks

SQL Statement Cache(where SQL is executed from)

SQL STMT

Cache blocks

(30) (30)

SQL Statement Cache(where SQL is executed from)

(30)

Performance and scalability

© Copyright IBM Corporation 2008

Performance and scalability

• This is a performance enhancement for distributed server processing

• Uses z/OS Shared Memory Facility to reduce data moves between DBM1 and DDF

• The Shared Memory Facility was introduced in z/OS 1.5– Shared memory: A new type of virtual storage allowing multiple address spaces

to easily address storage

– Similar to ECSA – Always addressable, no AR or XM moves needed

– Different to ECSA – Only exists above the bar. Not available to all address spaces on the system, only those registered with z/OS are able to share this

storage

• Before DB2 V9: When DDF invokes DB2 to process a request, data is copied from the DDF address space to DBM1 at the beginning of the request, and is copied back from DBM1 to DDF at the completion of the request

• 64-bit DDF and DBM1 – z/OS shared storage

© Copyright IBM Corporation 2008

Other Performance and scalability features

• Sequential key insert with (a)symmetric page splits– DB2 detects an insert pattern and will determine the best strategy to split

index pages. E.g. Random inserts in the index (50/50 ratio), but ever

increasing index insert, all new entries moved to the new page

• Larger index pages possible– Before V9 : Only 4KB index pages

– V9 : allows 4KB, 8KB, 16KB, 32KB index pages

• REOPT AUTO– DB2 automatically reoptimizes the statement when it detects that the filtering

of one or more of the predicates changes dramatically

– The newly generated access path replaces the current one and is cached in

the statement cache.

• Automatic buffer pool management– By registering the buffer pool to WLM, the size of a buffer pool can vary

between the minimum and maximum size

– +/- 25 % of the defined size, constitutes the min and max size

• Index on expression

© Copyright IBM Corporation 2008

Agenda

• Availability• SQL enhancement• Application enablement• Utility improvement• Performance and scalability• XML introduction• Questions

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.14.1.0.3

XML

© Copyright IBM Corporation 2008

Why XML?

XML is a key technology for…

• Data exchange

• Data integration

• Data evolution and flexibility

• Web applications and Web services

• Service-oriented architectures

• Information on demand!

© Copyright IBM Corporation 2008

SERVER

CLIENT SQL/XML

XQUERY

DB2 Engine

XML

Interface

Relational

Interface Relational

XML

DB2 Storage:

DB2 Client /Customer Client Application

XPath

Hybrid data server

© Copyright IBM Corporation 2008

document

ISBN title

first

url

book

author

version

last

publisher

comment

year

Document node

Element node

Attribute node

Text node

Comment node

•• Document node Document node (or Root node)(or Root node)

•• Element nodesElement nodes

•• Text nodesText nodes

•• Attribute nodesAttribute nodes

•• Namespace nodesNamespace nodes

•• Processing instruction Processing instruction

nodesnodes

•• Comment nodesComment nodes <?xml version=”1.0” ?>

<book ISBN=”0 262 11170 5”>

<title>Genetic Programming</title>

<author>

<last>Koza</last>

<first>John</first>

</author>

<publisher year=”1992”>

The MIT Press

</publisher>

<url>http://www.genetic.org</url>

</book>

<!-- comment at end -->

Types of XML nodes

© Copyright IBM Corporation 2008

A query language designed for XML data…

SABIXML1SABIXML1

C1 XMLCOL DOCID

SABIXML1Base table space

Database DSN00075

CREATE TABLE SABIXML1 (C1 CHAR (10), XMLCOL XML)

XSAB0000XSAB0000

Docid Min_Nodeid XML Data

XSABIXML1XML table space

(auxiliary)

IRDOC IDSIRDOC IDS

Key: docidDOCID - Index

name: 1_DOCIDSABIXML1

IRNODE IDIRNODE ID

Key: docid +

min_nodeid.

NODEID - Index

name: 1_NODEIDSABIXML1

XML column – Implicitly/explicitly created objects

© Copyright IBM Corporation 2008

A query language designed for XML data…

DISPLAY DATABASE command

output for table holding XML column

© Copyright IBM Corporation 2008

INSERT INTO sabixml1

VALUES('123', (SELECT XMLDOCUMENT (

XMLELEMENT (NAME "Emp", e.firstnme!!‘ '!!e.lastname),XMLCOMMENT ('This is just a simple example')

)

FROM dsn8910.EMP e

WHERE e.empno = '000010‘

)

) ;

<Emp>CHRISTINE HAAS</Emp><!--This is just a simple example--> (on retrieval)

SELECT XMLPI (name "access-control" ,'allow="w3.ibm.com" deny="www.*"‘

)

FROM SYSIBM.SYSDUMMY1

<?xml version="1.0" encoding="IBM037"?><?access-control allow="w3.ibm.com“ deny="www.*"?>

XMLCOMMENT, XMLDOCUMENT, XMLPI examples

© Copyright IBM Corporation 2008

XML parsing

book

title price

author

authors

author

keywords

keyword keyword

id=47 id=58 SQL relational

DatabaseSystems

29

John Doe Peter Pan

Serialization

Serialization and parsing

<book>

<authors>

<author id="47">John Doe</author>

<author id="58">Peter Pan</author>

</authors>

<title>Database systems</title>

<price>29</price>

<keywords>

<keyword>SQL</keyword>

<keyword>relational</keyword>

</keywords>

</book>

© Copyright IBM Corporation 2008

XMLSERIALIZE example

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

And more...

© Copyright IBM Corporation 2008

Other V9 feature

• Create / Alter tablespace tsname NOT LOGGED/LOGGED– DB2 is no longer going to log the changes to this table space. – Statement creates a recovery point (entry in SYSCOPY)

– SHOULD only be used for duplicated data

– Normally logging results in a small (<5%) overhead

– THINK before applying, LET’S BE SAFE OUTHERE !

Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1

Questions

[email protected]


Recommended