DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION=...

44
DB2 and Advanced Copy Services: All You Need to Know Paul Pendle Independent Consultant Tuesday, March 11, 2014 Session Number: 15352

Transcript of DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION=...

Page 1: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 and Advanced Copy Services: All You Need to KnowPaul Pendle

Independent Consultant

Tuesday, March 11, 2014

Session Number: 15352

Page 2: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Agenda

• What is/are Advanced Copy Services

• Deep dive into FlashCopy

• Shallow dip into PPRC/XRC

• Using FlashCopy in z/OS

• Consistency Groups

• Using DB2 with FlashCopy

• Considerations for using DB2, FlashCopy, and PPRC/XRC

• Conclusions

2

Page 3: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Introduction to Advanced Copy Services

• Storage array facilities that replicate data

• Locally (FlashCopy)

• Volume to Volume

• Dataset to dataset

• Long distance (PPRC, XRC)

• Synchronously and asynchronously

• Volume to volume

3

Page 4: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Array-based Local Replication

4

Source Target

TSO

ICKDSF

ADRDSSU

ANTRQST

F7

Page 5: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Array-based Copy Advantages

• No host CPU or I/O to perform the data movement

• Extremely fast copies

• Both dataset and volume replication

• Allows incremental copies

• Can allow space efficient copies (FlashCopy SE)

• Time-to-use very fast (before copy completion)

5

Page 6: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy Primitives

• ESTABLISH

• Creates a relationship between a source and target

volume/dataset and in most cases copies the data from

source to target

• WITHDRAW

• Terminates a FlashCopy relationship between a source and

target

• RESTORE !!!!!!!

• ESTABLISH with FAST REVERSE RESTORE ….

6

What’s missing?

Page 7: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy Considerations

• Establish is three phases

• Create the relationship (very fast)

• Copy the tracks (optional: NOCOPY)

• Withdraw the relationship (optional and very fast)

• Three FASTREPLICATION modes under DFDSS

• PREFERRED (default)

• REQUIRED

• NONE

• Copy on first write (COFW) overhead

• Read indirection overhead

7

Page 8: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Source Target

PPP

PPP

PPP

PPP

III

III

III

III

Protection map Indirection map

FlashCopy Relationships (Temporary)

P

P

P

P

I

I

I

I

Establish

Page 9: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Source Target

PPP

PPP

PPP

PPP

III

III

III

III

Protection map

FlashCopy Relationship (Persistent)

P

P

P

P

I

I

I

I

Establish

• Space Efficient

• NOCOPY

• Incremental

Indirection map

Page 10: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Source Target

PP

PP

PPP

II

II

III

Protection map Indirection map

How Does Incremental Help?

P I

Establish

Page 11: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Incremental FlashCopy Considerations

• Reduced work for the storage controller

• Faster completion of background copy

• Reduced COFW impact

• Reduced indirected reads

• Only one FlashCopy session can be incremental

• Others are withdrawn on completion

11

Page 12: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Incremental Limitation (Full Volume)

12

Source

Target Target Target Target Target Target

Target Target Target Target Target Target

Page 13: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Cascading FlashCopy

13

Source Target Target

Source TargetSource

Page 14: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Space Efficient FlashCopy

Establish

Source0

SE DEVICE

Repository

Page 15: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Space Efficient FlashCopy Restore

Source0

Repository

T1

T2S

Page 16: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Space Efficient FlashCopy Planning

• On DS8xxx requires a separate license from basic FC

• Requires dedicated FCSE devices in the DS8xxx config

• Careful planning is required

• Has performance impact

• Change rate during life of FC session <5%

• Repository can fill up:

• IEA499E warnings/errors

• Repository cannot be dynamically expanded

• Need to withdraw the relationship

• Delete, reconfigure and redefine the repository

Page 17: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy Consistency Groups

17

Page 18: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 Status when replicating

For the purposes of the replicating operation there are

only three states that a DB2 database can be in

when you are going to copy it:

• Shut down

• In log suspend mode

• Running normally

Page 19: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 never makes a change to the database without logging the change first (ARIES principle)

Dependent-Write Consistency

Transaction Changes Transaction state Action on Restart

In buffer pool Uncommitted Discarded

On disk Uncommitted Undo process

In buffer pool Committed Redo process

On disk Committed No action necessary

Page 20: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy Consistency

S T

S T

S T

S T

S T

S T

LCU

Page 21: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy Outside of DB2

• Needs:

• Consistency groups or

• Log suspend

• Can replicate beyond the DB2 domain using Con Groups

• IMS, Other DB2, MQ, VSAM, CICS

• Produces a restartable image

21

Page 22: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 and FlashCopy

A brief history

Page 23: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 V8 and FlashCopy

• System Point-in-Time Recovery (SYSPITR)

• Backup System utility (DSNUTILB)

• Implemented for very large applications (e.g. SAP)

• Only stage one (disk copy)

• DFSMS 1.5 or later

• Poor integration with DB2/HSM/SMS

• Difficult to trouble-shoot

• DB2 domain only

• FC support for CHECK INDEX SHRLEVEL CHANGE

23

Page 24: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

SYSPITR Timeline

24

DSNUTILB Backup System

DB2 suspends checkpoints, DDL , changes to ICF catalogs, 32KB writes

Update BSDS with RBLP

Update DSNDB01 with oldest log record (HPGLBRBA)

FlashCopy database pool volumes (any order)

FlashCopy log pool volumes (any order)

Update BSDS with SLB information

Release restrictions

Withdraw FlashCopy relationship

Page 25: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 V9 and FlashCopy

• SYSPITR

• Dataset restore from SLB

• Still using SMS/HSM

• Capability to dump target volumes

• DUMP/DUMPONLY

• Some ICF catalog issues for datasets being moved

• FC support for CHECK INDEX SHRLEVEL CHANGE

• FC support for CHECK LOB SHRLEVEL CHANGE

• DB2 domain only

25

Page 26: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 V10 and FlashCopy

• SYSPITR

• ICF catalog issues resolved (mostly)

• Incremental Flash enabled

• BACKUP SYSTEM ESTABLISH FCINCREMENTAL

• Still using HSM/SMS

• DB2 domain only

26

Page 27: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Source

Devices Sto

rag

e C

on

trolle

r

Recovery Structures

Recovery Structures

ICF User

Catalog

ICF User

Catalog

Target

Devices

ICF User

Catalog

DB2

Catalog

Table

Spaces

DB2

DirectoryActive

Logs

BSDSArchive

Logs

Data Structures

Data Structures

Active

Logs

Archive

Logs

ICF User

Catalog

DB2

Catalog

DB2

Directory

Table

Spaces

BSDS

1000 1001

1002 1003

1004

1005

1006

1007

4000

4002 4003

4004

4005

4006

4007

4001

DB2 Full Volume Cloning

Page 28: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 and Other FlashCopy Functions

• ZPARM

• CHECK_FASTREPLICATION= (PREFERRED/REQUIRED)

• Some utilities can use FlashCopy

• CHECK DATA

• CHECK INDEX

• CHECK LOB

• REORG TS

• REBUILD INDEX

• REORG INDEX

• COPY

• LOAD

• FCIC in DB2 V10

• With consistency!

28

Page 29: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy, DB2, and Remote Replication

Page 30: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Synchronous (Metro Mirror aka PPRC)

Array-based Remote Replication

30

Source Target

W W

RCRC

Page 31: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Considerations for Synchronous Replication

• Write performance

• Log writes

• VSAM striping can help mitigate some latency

• Synchronous buffer pool writes

• Page steal writes

• Increased DISC time

• Database consistency

• Distance impact on writes

• Every 200km miles adds 2ms additional latency (round trip)

Page 32: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Asynchronous (z/OS Global Mirror aka XRC)

Array-based Remote Replication

32

Source Target

W W

RC

SD

M

Page 33: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Considerations for Asynchronous Replication XRC

• Host write performance largely unaffected

• z/OS timestamps the writes

• Writes are accumulated in a side file

• System data mover on the target side reads the side file

• Some data loss is expected

Page 34: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Synchronous (PPRC)

Array-based Remote Replication

34

Primary1 Secondary1

Primary2 Secondary2

DUPLEX

DUPLEX

FC

PENDING

Page 35: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Duplex Pending Status

• Generally not acceptable in PPRC installations

• Secondary site may not be recoverable

• HyperSwap event will fail

35

Page 36: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Solutions to Duplex Pending Issue

• SYSPITR

• Set up COPY POOLs outside of PPRC

• DB2 utilities

• Point temporary files at non-PPRC SMS storage group

• ZPARM UTIL_TEMP_STORCLAS

36

Page 37: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

AKA Remote Pair FlashCopy

Preserve Mirror and PPRC

37

Primary1 Secondary1

Primary2 Secondary2

DUPLEX

DUPLEX

FC

FC

Page 38: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Preserve Mirror Considerations

• Requires specific microcode levels and APARs

• FlashCopy Source and Targets must be PPRC Primary

volumes

• HyperSwap will work when Preserve Mirror is used

• Copy work performed by FlashCopy does not have to be

transmitted across the network

38

Page 39: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DSNZPARM FLASHCOPY_PPRC

• Values

• NONE results in DUPLEX PENDING

• PREFERRED means DUPLEX PENDING is allowed

• REQUIRED means DUPLEX PENDING is not allowed (GDPS)

• Blank no preserve mirror command sent to DFSMSdss

• Applies to DB2 Utilities

• CHECK DATA/INDEX/LOB

• REORG TABLESPACE/INDEX

• REBUILD INDEX

• LOAD

• COPY/RECOVER

39

Page 40: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 Utilities using DFSMShsm and Preserve Mirror

• No ZPARM settings oddly

• Preserve Mirror attribute set at the Copy Pool level in SMS

• FRBACKUP (NO|PN|PP|PR)

• FRRECOV (NO|PN|PP|PR)

40

Page 41: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

FlashCopy, DB2, and XRC

• FlashCopy to a XRC source is not allowed

• Consider how z/OS timestamps the writes

• BACKUP SYSTEM

• Keep copy pools separated from XRC

• Restore System cannot use FlashCopy

• Or disable mirroring

• Object recovery slow replication

• DB2 utilities

• Point temporary files at non-XRC SMS storage group

• ZPARM UTIL_TEMP_STORCLAS

41

Page 42: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Drivers for Selecting the ACS Solution

• Restartable or recoverable

• Federated with other applications/platforms

• z/OS

• DB2 LUW

• MQ

• Space efficient copies

• DB2 availability

• Volume or dataset

• Object restore requirements

• Integration with DB2 recovery

• Considerations for remote replication

42

Page 43: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

Conclusions

• FlashCopy replication can enhance:

• System backup and restore

• Object backup and restore

• Care must be taken to deploy the correct options for a

given situation

• More care is necessary when using remote replication

• Collaborate closely with system programmers and storage

administrators for success

43

Page 44: DB2 and Advanced Copy Services: All You Need to Know€¦ · •CHECK_FASTREPLICATION= (PREFERRED/REQUIRED) •Some utilities can use FlashCopy •CHECK DATA •CHECK INDEX •CHECK

DB2 and Advanced Copy Services: All You Need to KnowPaul Pendle

Independent Consultant

Tuesday, March 11, 2014

Session Number: 15352