cv8317xstud

238

Click here to load reader

Upload: rashokkumar82

Post on 13-Feb-2016

71 views

Category:

Documents


5 download

DESCRIPTION

IBM DB2

TRANSCRIPT

Page 1: CV8317XSTUD

Enterprise Computing Solutions

Business Intelligence

Data Centre Cloud Mobility

Comunidad de Madrid

Dirección General de Formación

CONSEJERÍA DE EMPLEO,TURISMO Y CULTURA

UNIÓN EUROPEAFONDO SOCIAL EUROPEO

El Fondo Social Europeo invierte en tu futuro

EDUCATIONS E R V I C E S

Student Manual

Page 2: CV8317XSTUD

V5.4.0.3

cover

Exclus

ivo fo

r

proy

ecto

Front cover

DB2 10 for z/OS Database Administration Workshop Part 1 (Course code CV831)

Student ExercisesERC 7.0

IBM certified course material

mación

C.F.T.I.C.

Page 3: CV8317XSTUD

Student Exercises

.

Trademarks

The reader should recognize that the following terms, which appear in the content of this training document, are official trademarks of IBM or other companies:

IBM® is a registered trademark of International Business Machines Corporation.

The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both:

Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Linux® is a registered trademark of Linus Torvalds in the United States, other countries, or both.

Windows is a trademark of Microsoft Corporation in the United States, other countries, or both.

UNIX® is a registered trademark of The Open Group in the United States and other countries.

Other product and service names might be trademarks of IBM or other companies.

AIX® CICS® DB2®DRDA® IMS™ Lotus®Notes® OS/390® Parallel Sysplex®QMF™ RACF® RETAIN®z/OS® zSeries® 1-2-3®

xclus

ivo fo

rmac

ión

yecto

C.F.T.I.C

October 2011 edition

The information contained in this document has not been submitted to any formal IBM test and is distributed on an “as is” basis without any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer’s ability to evaluate and integrate them into the customer’s operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk.

© Copyright International Business Machines Corporation 1993, 2011.This document may not be reproduced in whole or in part without the prior written permission of IBM.Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp.

E pr

o

Page 4: CV8317XSTUD

Student ExercisesV5.4.0.3

TOC

E

Contents

Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

Exercises description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Exercise 1. Creating databases and table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

Exercise 2. Creating tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1Table LOCATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Table DEPARTMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3Table EMPLOYEE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4Table PROJECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5Tables ON_PROJECT and ACTIVITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6Table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7

Exercise 3. Creating and using views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1

Exercise 4. Creating indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1

Exercise 5. Creating referential structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1Referential structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

Exercise 6. Loading and unloading tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1

Exercise 7. Running RUNSTATS and REORG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1

Exercise 8. Running COPY and RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1

Exercise 9. Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1

Exercise 10. Locking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1

Appendix A. Exercise solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1Exercise 1: Creating databases and table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3Exercise 2: Creating tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9Exercise 3: Creating and using views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-15Exercise 4: Creating indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-27Exercise 5: Creating referential structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-37Exercise 6: Loading and unloading tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-43Exercise 7: Running RUNSTATS and REORG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-95Exercise 8: Running COPY and RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-133Exercise 9: Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-153Exercise 10: Locking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-161

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Contents iii

Page 5: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

iv DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 6: CV8317XSTUD

Student ExercisesV5.4.0.3

TMK

E

Trademarks

The reader should recognize that the following terms, which appear in the content of this training document, are official trademarks of IBM or other companies:

IBM® is a registered trademark of International Business Machines Corporation.

The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both:

Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Linux® is a registered trademark of Linus Torvalds in the United States, other countries, or both.

Windows is a trademark of Microsoft Corporation in the United States, other countries, or both.

UNIX® is a registered trademark of The Open Group in the United States and other countries.

Other product and service names might be trademarks of IBM or other companies.

AIX® CICS® DB2®DRDA® IMS™ Lotus®Notes® OS/390® Parallel Sysplex®QMF™ RACF® RETAIN®z/OS® zSeries® 1-2-3®

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Trademarks v

Page 7: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

vi DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 8: CV8317XSTUD

Student ExercisesV5.4.0.3

pref

E

Exercises description

Exercise instructions

Use the information you have learned in the unit presentation to work through each exercise. You should also make use of your Student Notebook and the DB2 manuals.

Note

Your instructor will assign each team a 2-digit team ID, for example, 21, 22, and so on.

Machine lab environment

You have been provided with a partitioned data set named userid.CV83.CNTL which contains the members supplied for each exercise. The first two characters of a member name are 'Ln', where 'n' represents the number of the exercise which uses the member. For example, Exercise 1 uses a member called L1QUERY1.

The exercise instructions assume that SPUFI will be used to execute SQL statements.

Optional labs

For those who are experienced and fast, optional lab steps are provided, which are sometimes a bit more challenging. But the majority of students should concentrate on performing the normal lab steps. These are totally sufficient to meet the course objectives. And these students should be careful not to waste their time with these optional steps at the expense of the important labs for each unit.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercises description vii

Page 9: CV8317XSTUD

Student Exercises

.

Figure 1. Logging on (1 of 3) CV8317.0

Notes:

Machine lab environment

Your Personal Communications session will already be configured with the host name mopedvm2.ilsvpn.ibm.com and you should see the screen above.

We shall be accessing the IBM Training system MOPEDVM2 in Montpellier via the Internet.

The Aventail client software will enable you to access this system and this software should already be running on your PC.

On the command line, type the designated z/OS system assigned to your lab, such as MVSDI11, and press Enter.

© Copyright IBM Corporation 2009

Logging on (1 of 3)

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

viii DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 10: CV8317XSTUD

Student ExercisesV5.4.0.3

pref

E

Figure 2. Logging on (2 of 3) CV8317.0

Notes:

Type TSO followed by space, followed by your TSO user ID. Your TSO userid will be allocated by your instructor and will be something like, for example, TSOUB01.

Press Enter.

© Copyright IBM Corporation 2009

Logging on (2 of 3)

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercises description ix

Page 11: CV8317XSTUD

Student Exercises

.

Figure 3. Logging on (3 of 3) CV8317.0

Notes:

Type your password as provided by your instructor.

Check:

• Procedure is set to STUDENT

• Account Number is set to 1CV83G26

• Command is set to %C26 B CV831

Press Enter.

© Copyright IBM Corporation 2009

Logging on (3 of 3)

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

x DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 12: CV8317XSTUD

Student ExercisesV5.4.0.3

pref

E

Figure 4. ISPF main menu CV8317.0

Notes:

From the ISPF main menu:

• Option D will take you to DB2I and SPUFI.

- We shall be using a DB2 subsystem something like, for example, DSNB.

- Check via DB2I option D that your DB2 name is set to the correct subsystem identifier.

• Option 3.4 will take you to your partitioned data set and the skeleton members.

- Each team is provided with a partitioned data set named userid.CV83.CNTL which contains the edited skeleton members used in the machine exercises.

• Option S is for SDSF.

© Copyright IBM Corporation 2009

ISPF main menu

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercises description xi

Page 13: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

xii DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 14: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 1. Creating databases and table spaces

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with creating databases and table spaces.

What you should be able to do

At the end of the exercise, you should be able to create a:

• Database

• Segmented table space

• Partition by growth universal table space

• Range partitioned universal table space

You should also be familiar with the type of information held in the DB2 catalog for databases and table spaces.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 1. Creating databases and table spaces 1-1

Page 15: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

Throughout these exercises, search for ?? within the PDS members provided for each problem and replace any ?? with your team ID. Not all members will contain ??.

Creating a database

__ 1. Create a database which has the following attributes:

• The name of the database should be WWV83??D, where ?? represents your team ID.

• The name of the default buffer pool to be used for table spaces created within the database should be BP1.

• The name of the default buffer pool to be used for indexes created within the database should be BP2.

• The name of the default storage group to be used to support the DASD space requirements for table spaces and indexes created within the database should be WWV83??S, where ?? represents your team ID. This storage group has already been created for you.

Creating table spaces

When creating the following table spaces, do not specify any other than the requested options:

__ 2. Create a segmented table space named TSLOCN in your database.

__ 3. Create a partition by growth universal table space named TSDEPT in your database. TSDEPT should be able to grow up to a maximum of 5 partitions and have a segment size of 32.

__ 4. Create a range partitioned universal table space named TSEMPL in your database. TSEMPL should contain 3 partitions. SEGSIZE, if required, should be 4.

__ 5. Create a segmented table space named TSPROJ in your database. TSPROJ should have a segment size of 4. Also, specify that you want zero percent of each page to be left as free space when the table space is loaded or reorganized.

Querying the DB2 catalog tables

The supplied catalog queries refer to a DB2 special register called USER. This special register contains the value of your TSO userid.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

1-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 16: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ 6. Execute member L1QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSDATABASE), explain the meaning of the values held for each column.

__ 7. Execute member L1QUERY2 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSTABLESPACE), explain the meaning of the values held for each column.

__ 8. Execute member L1QUERY3 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSTABLEPART), explain the meaning of the values held for each column.

Optional Labs

__ 9. Queries about volumes:

• Which volumes are recorded in the DB2 catalog for the storage group you use? _________________________

• If explicit volumes are defined, can you be sure that the data sets of your table spaces are stored on these? ________ Why? __________________________________________________________ __________________________________________________________

__ 10. What are the names of the VSAM clusters of your table space TSEMPL? _____________________________________________________________ _____________________________________________________________ _____________________________________________________________

__ 11. On which volume does the data set of partition 1 of table space TSEMPL reside? ___________

__ 12. Execute the statement provided in member L1CREATE. Why does the CREATE TABLESPACE statement fail?

You have two possibilities:

a. You try to answer this question almost on your own, with a few hints only.

b. You work with some more hints.

So, choose the way you prefer:

a. Few hints: Inspect the DB2 address space which issues messages. Or inspect the syslog. Which reason is given? __________________________________ Is that really the reason, in other words, is there really a difference to the previous CREATE TABLESPACE statements, which were successful? What else could be the reason?

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 1. Creating databases and table spaces 1-3

Page 17: CV8317XSTUD

Student Exercises

.

b. More hints: First follow the previous section “Few hints”. Use SDSF and inspect either the DB2 master address space (ssnnMSTR) or the SYSLOG. In either case, in order to find the error message(s), look for a portion of the data set name you intended to define (containing db name and ts name): “WWV83ZZD.TEST??A”.

Depending on the environment, the error messages point to security or volume problems. Ignore these hints: What else, besides security and volumes, is specified by storage groups, which is used by follow-on table space creations? ___________

Determine from the DB2 catalog the vcat specifications used for TEST??A __________ and for the other, previously created table spaces: ____________.

Test via ISPF 3.4 whether an alias for these two high-level qualifiers exist at all (by entering their name in the ‘dsname level’ field). DB2 can only create a data set if an alias has been defined for the high-level qualifier or if DB2 is allowed to update the z/OS master catalog (not recommended, and not allowed on our system).

End of exercise

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

1-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 18: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 2. Creating tables

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with creating tables.

What you should be able to do

At the end of the exercise, you should:

• Be able to create tables, including the tasks

- To define table check constraints

- To complete the definition of table-controlled table spaces

- To store a table in the correct table space

• Be familiar with the type of information held in the DB2 catalog for tables

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 2. Creating tables 2-1

Page 19: CV8317XSTUD

Student Exercises

.

Figure 2-1. Table LOCATION CV8317.0

Notes:

The six tables which you will create in this exercise are described on this and the following pages. Take time to browse these pages before you start the exercise. The exercise instructions begin on page 2-8.

Each row in the LOCATION table describes a business location.

© Copyright IBM Corporation 2007

Column Name Data Type(Length)

Null Description

LOCID CHAR(10) NO Identifier for locationADDRESS CHAR(30) NO Street and street number for locationCITY CHAR(30) NO City in which location is situatedPOSTAL_CODE CHAR(15) NO Postal code for location (state + zip-code)COUNTRY CHAR(30) NO Country in which location is situated

LOCATION

Table LOCATION

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

2-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 20: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Figure 2-2. Table DEPARTMENT CV8317.0

Notes:

Each row in the DEPARTMENT table describes a department.

© Copyright IBM Corporation 2007

Column Name Data Type(Length)

Null Description

DEPTNO CHAR(3) NO Department number for departmentSUPERIOR_DEPTNO CHAR(3) YES Department number for superior

department (next higher level department)MGRNO CHAR(6) YES Person number of manager for

departmentNAME VARCHAR(50) NO Department name

DEPARTMENT

Table DEPARTMENT

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 2. Creating tables 2-3

Page 21: CV8317XSTUD

Student Exercises

.

Figure 2-3. Table EMPLOYEE CV8317.0

Notes:

Each row in the EMPLOYEE table describes an employee.

© Copyright IBM Corporation 2007

Column Name Data Type(Length)

Null Description

EMPNO CHAR(6) NO Person number of employeeFIRST_NAME CHAR(20) NO First name of employeeMIDDLE_INITIAL CHAR(1) YES Middle initial of employeeSEX CHAR(1) NO Sex of employeeBIRTHDATE DATE YES Date of birth of employeePHONE CHAR(4) YES Extension for employeeHIRING_DATE DATE YES Hiring date for employeeJOB CHAR(20) YES Job title for employeeEDUCATION SMALLINT NO Education level of employeeSALARY DECIMAL(9,2) YES Current salary for employeeBONUS DECIMAL(9,2) YES Current bonus for employeeCOMMISSION DECIMAL(9,2) YES Current commission for employeeDEPTNO CHAR(3) YES Department for employeeLOCID CHAR(10) YES Work location (identifier) for employeeLAST_NAME VARCHAR(50) NO Last name for employee

EMPLOYEE

Table EMPLOYEE

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

2-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 22: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Figure 2-4. Table PROJECT CV8317.0

Notes:

Each row in the PROJECT table describes a project.

© Copyright IBM Corporation 2007

Column Name Data Type(Length)

Null Description

PROJNO CHAR(6) NO Project number for projectDEPTNO CHAR(3) NO Department responsible for projectEMPNO CHAR(6) NO Employee responsible for projectSTAFFING DECIMAL(5,2) YES Estimated mean staffing for projectSTART_DATE DATE YES Projected starting date for projectEND_DATE DATE YES Projected ending date for projectNAME VARCHAR(50) NO Project name

PROJECT

Table PROJECT

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 2. Creating tables 2-5

Page 23: CV8317XSTUD

Student Exercises

.

Figure 2-5. Tables ON_PROJECT and ACTIVITY CV8317.0

Notes:

The rows in the ON_PROJECT table describe which employees have been assigned to which projects independently of activities. Not all employees assigned to a project have activities for the project.

Each row of the ACTIVITY table describes an activity performed by an employee for a project.

© Copyright IBM Corporation 2007

Column Name Data Type(Length)

Null Description

PROJNO CHAR(6) NO Project number for projectEMPNO CHAR(6) NO Employee working on project

ON_PROJECT

Column Name Data Type(Length)

Null Description

PROJNO CHAR(6) NO Project number for projectEMPNO CHAR(6) NO Employee performing activity for projectSEQNO SMALLINT NO Sequence number for activity

(per project and employee)CODE SMALLINT NO Code describing the activityTIME_SPENT DECIMAL(5,2) YES Proportion of employee’s time spent on

projectSTART_DATE DATE YES Starting date for employee’s activity on

projectEND_DATE DATE YES Ending date for employee’s activity on

project

ACTIVITY

Tables ON_PROJECT and ACTIVITY

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

2-6 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 24: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Figure 2-6. Table spaces CV8317.0

Notes:

The tables are defined in the following table spaces:

• TSLOCN is used to store the LOCATION table

• TSEMPL is used to store the EMPLOYEE table

• TSDEPT is used to store the DEPARTMENT table

• TSPROJ is used to store the following tables:

- PROJECT

- ON_PROJECT

- ACTIVITY

© Copyright IBM Corporation 2007

TABLE SPACE TYPE TABLES

TSLOCN SEGMENTED (SEGSIZE 4) LOCATION

TSEMPL

RANGE -PARTITIONED(NUMPARTS 3 and SEGSIZE 4)

EMPLOYEE

TSDEPT

PARTITION -BY GROWTH(MAXPARTITIONS 5 and SEGSIZE 32)

DEPARTMENT

TSPROJ SEGMENTED(SEGSIZE 4)

1. PROJECT2. ON_PROJECT3. ACTIVITY

Table spaces

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 2. Creating tables 2-7

Page 25: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

Throughout the exercise, search for ?? within the pdf member provided for each problem and replace any ?? with your team ID. Not all members will contain ??.

Creating tables

__ 1. Member L2LOCN contains an SQL statement to create the LOCATION table. Edit the member and specify that the table should be created in table space TSLOCN in your database.

__ 2. Execute the statement using SPUFI. SQLCODE 0 should be returned.

__ 3. Member L2DEPT contains an SQL statement to create the DEPARTMENT table. Edit the member and specify that the table should be created in table space TSDEPT in your database.

__ 4. Execute the statement using SPUFI. SQLCODE 0 should be returned.

__ 5. Member L2PROJ contains an SQL statement to create the PROJECT table. Edit the member and specify that the table should be created in table space TSPROJ in your database.

__ 6. Execute the statement using SPUFI. SQLCODE 0 should be returned.

__ 7. Member L2ONPROJ contains an SQL statement to create the ON_PROJECT table. Edit the member and specify that the table should be created in table space TSPROJ in your database.

__ 8. Execute the statement using SPUFI. SQLCODE 0 should be returned.

__ 9. Member L2ACTY contains an SQL statement to create the ACTIVITY table. Edit the member and specify that the table should be created in table space TSPROJ in your database.

__ 10. Execute the statement using SPUFI. SQLCODE 0 should be returned.

__ 11. Create an SQL statement to create the EMPLOYEE table. The name, data type, length, and null attribute for each column are shown in the visual on “Table EMPLOYEE” on page 2-4. Take care to make sure that you specify the columns correctly. In addition, specify a table check constraint, which ensures that column SEX can only have a value of 'F' or 'M'.

Enable table-controlled partitioning using EMPNO as the key column and specify the limit key values for the three partitions as follows:

• '000150' for partition 1

• '000230' for partition 2

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

2-8 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 26: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

• '001000' for partition 3

Create the table in table space TSEMPL in your database.

__ 12. Execute the statement using SPUFI. SQLCODE 0 should be returned.

Querying the DB2 catalog tables

__ 13. Execute member L2QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSTABLES), explain the meaning of the values held for each column.

__ 14. Execute member L2QUERY2 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSTABLESPACE), explain the meaning of the values held for each column.

__ 15. Execute member L2QUERY3 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSCOLUMNS), explain the meaning of the values held for each column.

Optional labs

__ 16. Query the two catalog tables which document the check constraint you have defined.

__ 17. Query the appropriate catalog table to verify the external and internal limit keys for your table-controlled partition table.

End of exercise

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 2. Creating tables 2-9

Page 27: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

2-10 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 28: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 3. Creating and using views

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with creating and using views.

What you should be able to do

At the end of the exercise, you should be able to:

• Create views

• Explain how SELECT, INSERT, UPDATE, and DELETE statements are processed when executed against a view

- Especially if the CHECK OPTION is involved

• Derive from the catalog that a DML operation cannot be performed on a view

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 3. Creating and using views 3-1

Page 29: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

Throughout the exercise, search for ?? within the pdf member provided for each problem and replace any ?? with your team ID. Not all members will contain ??.

Creating and using views

__ 1. Examine member L301 which contains an SQL statement to create view V1. A table called EMP has already been created for you to use in this exercise and the table has been loaded with data. The definition of EMP is the same as table EMPLOYEE which is documented on page 2-4.

__ 2. Execute member L301 using SPUFI. SQLCODE 0 should be returned.

__ 3. Execute member L302 using SPUFI and examine the rows returned by each query.

__ 4. Examine member L303 which inserts two rows into table EMP using view V1. Note that the first row inserted has a SALARY column value less than 20000, and the second row inserted has a SALARY column value greater than 20000.

__ 5. Execute member L303 using SPUFI. Why are both INSERTs successful?

__ 6. Execute member L302 using SPUFI and examine the rows returned by each query.

__ 7. Execute member L304 using SPUFI. Why is the row deleted?

__ 8. Execute member L305 using SPUFI. Why is the row not found?

__ 9. Execute member L302 using SPUFI and examine the rows returned by each query. Notice that the row with a SERIAL_NUMBER of 000360 is not returned by the first query.

__ 10. Execute member L306 using SPUFI. Why is the row updated?

__ 11. Execute member L307 using SPUFI. Why is the row not found?

__ 12. Execute member L302 using SPUFI and examine the rows returned by each query. Notice that the row with a SERIAL_NUMBER of 000260 is no longer returned by the first query.

__ 13. Examine member L308 which contains an SQL statement to create view V2. Notice that the view definition contains the WITH CHECK OPTION clause.

__ 14. Execute member L308 using SPUFI. SQLCODE 0 should be returned.

__ 15. Execute member L309 using SPUFI. Why does the second INSERT fail?

__ 16. Execute member L310 using SPUFI. Why does the second UPDATE fail?

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

3-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 30: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ 17. Examine member L311 which contains an SQL statement to create view V3. Notice that the view definition does not include column EDUCATION.

__ 18. Execute member L311 using SPUFI. SQLCODE 0 should be returned.

__ 19. Execute member L312 using SPUFI. Why does the INSERT fail?

__ 20. Execute member L3QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSTABAUTH), explain the meaning of the values held for each column.

End of exercise

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 3. Creating and using views 3-3

Page 31: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

3-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 32: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 4. Creating indexes

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with creating indexes.

What you should be able to do

At the end of the exercise, you should:

• Be able to create different types of indexes:

- Unique and non-unique

- Clustering

- Partitioning

- Partitioned

• Be familiar with the type of information held in the DB2 catalog for indexes

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 4. Creating indexes 4-1

Page 33: CV8317XSTUD

Student Exercises

.

Exercise instructions

Creating indexes

__ 1. Create CREATE INDEX statements to define the first 4 indexes listed in the above table. For each index, specify only the attributes which are stated in the table. All indexes should be defined as ascending (which is the default). Execute the statements using SPUFI.

__ 2. In contrast to working interactively using SPUFI, perform this step in batch: Submit the job containing the DB2 sample program DSNTEP2 (in member L4CREATE) to create the remaining 10 indexes listed in the above table. Thereby ensure that:

__ a. The index IXEMPL1 consists of as many data sets as its underlying table space.

__ b. DB2 tries to store the EMPLOYEE data according to the sequence of this index IXEMPL1.

__ c. The index IXONPR1 is defined as requested.

Use SDSF to see the job output and check for successful execution.

Table Name Index Name Key Columns Unique Clustering

LOCATION IXLOCN1 LOCID Yes

DEPARTMENT IXDEPT1 DEPTNO Yes Yes

DEPARTMENT IXDEPT2 MGRNO

DEPARTMENT IXDEPT3 SUPERIOR_DEPTNO

EMPLOYEE IXEMPL1 EMPNO Yes Yes

EMPLOYEE IXEMPL2 DEPTNO

EMPLOYEE IXEMPL3 LOCID

PROJECT IXPROJ1 PROJNO Yes

PROJECT IXPROJ2 DEPTNO

PROJECT IXPROJ3 EMPNO Yes

ON_PROJECT IXONPR1 PROJNO,EMPNO Yes

ON_PROJECT IXONPR2 EMPNO Yes

ACTIVITY IXACTY1 PROJNO,EMPNO,SEQNO Yes

ACTIVITY IXACTY2 EMPNO

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

4-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 34: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Querying the DB2 catalog tables

__ 3. Execute member L4QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (table SYSIBM.SYSINDEXES), explain the meaning of the values held for the selected columns.

__ 4. Execute member L4QUERY2 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (table SYSIBM.SYSINDEXPART), explain the meaning of the values held for the selected columns.

__ 5. Execute member L4QUERY3 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (table SYSIBM.SYSKEYS), explain the meaning of the values held for the selected columns.

Optional labs:

__ 6. Using DB2I, option 7, display the status of your database and its table spaces and index spaces via the DB2 command -DISPLAY DATABASE (..).

__ 7. List the VSAM clusters of your table spaces and index spaces.

End of exercise

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 4. Creating indexes 4-3

Page 35: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

4-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 36: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 5. Creating referential structures

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with defining a referential structure.

What you should be able to do

At the end of the lab, you should:

• Be able to define:

- Primary keys

- Foreign keys

• Be familiar with the type of information held in the DB2 catalog for a referential structure.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 5. Creating referential structures 5-1

Page 37: CV8317XSTUD

Student Exercises

.

Figure 5-1. Referential structure CV8317.0

Notes:

The visual shows the referential structure which will be defined in this exercise. The primary keys are shown by the dark boxes, and each arrow points from a primary key to a foreign key. The notation used for the referential delete rules is as follows:

1. 'NA' stands for NO ACTION

2. 'SN' stands for SET NULL

3. 'C' stands for CASCADE

Take time to study the visual before you start the exercise. The exercise instructions begin on the next page.

© Copyright IBM Corporation 2007

LOCID

EMPNOLOCIDDEPTNO

MGRNODEPTNOSUPERIOR_DEPTNO

EMPNODEPTNOPROJNO

EMPNOPROJNO

EMPNOPROJNO SEQNO

LOCATION

EMPLOYEE

DEPARTMENT

PROJECT

ON_PROJECT

ACTIVITY

NA

SNNASN

NANA

C C

C

Referential structure

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

5-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 38: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise instructions

Defining primary keys

__ 1. Create ALTER TABLE statements to define the primary key for each of the tables listed above. Make sure that you remember to specify the Primary Key Constraint Name. Execute the statements using SPUFI.

The exercise continues on the next page ...

Parent Table Primary Key Columns Primary Key Constraint Name

LOCATION LOCID LOCID

DEPARTMENT DEPTNO DEPTNO

EMPLOYEE EMPNO EMPNO

PROJECT PROJNO PROJNO

ON_PROJECT PROJNO,EMPNO PROJNO_EMPNO

ACTIVITY PROJNO,EMPNO,SEQNO PROJNO_EMPNO_SEQNO

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 5. Creating referential structures 5-3

Page 39: CV8317XSTUD

Student Exercises

.

Defining foreign keys and delete rules

__ 2. Create ALTER TABLE statements to define the first 2 foreign keys listed in the above table (that is, where DEPARTMENT is the dependent table). Make sure that you remember to specify the referential constraint name. Execute the statements using SPUFI.

__ 3. Execute member L5ALTER using SPUFI to define the remaining 7 foreign keys listed in the above table. Edit this member to ensure that the foreign key on ACTIVITY is defined as requested.

Querying the DB2 catalog tables

__ 4. Execute member L5QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (tables SYSIBM.SYSTABCONST, SYSIBM.SYSKEYCOLUSE, and SYSIBM.SYSRELS), explain the meaning of the values held for the selected columns.

Optional lab

__ 5. In which catalog table exists one row per foreign key column? ________________ Query this table for your foreign key columns. How many rows pertain to your 9 referential relationships? ___ Why? ___________________________________

End of exercise

Parent Table Dependent Table

Foreign Key Columns Referential Constraint

Name

Delete Rule

DEPARTMENT DEPARTMENT SUPERIOR_DEPTNO DD NO ACTION

EMPLOYEE DEPARTMENT MGRNO ED SET NULL

LOCATION EMPLOYEE LOCID LE NO ACTION

DEPARTMENT EMPLOYEE DEPTNO DE SET NULL

DEPARTMENT PROJECT DEPTNO DP NO ACTION

EMPLOYEE PROJECT EMPNO EP NO ACTION

EMPLOYEE ON_PROJECT EMPNO EO CASCADE

PROJECT ON_PROJECT PROJNO PO CASCADE

ON_PROJECT ACTIVITY PROJNO,EMPNO OA CASCADE

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

5-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 40: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 6. Loading and unloading tables

What this exercise is about

This exercise provides an opportunity to gain hands-on experience on loading several tables, with a lot of specialties to consider, such as when dealing with a multi-table table space. Moreover, you learn to load tables, which are referentially connected, and to preserve the referential integrity among these tables. You will also unload data from a table.

What you should be able to do

At the end of the exercise, you should be able to:

• Run the following utilities and correctly use a variety of their respective options:

- LOAD

- CHECK DATA

- UNLOAD

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 6. Loading and unloading tables 6-1

Page 41: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

Throughout the exercise, search for ?? within the pdf member provided for each problem and replace any ?? with your team ID. Not all members will contain ??.

Creating a LOAD utility control statement

__ 1. Create a member called L6TSLOCN in your CV83.CNTL library which contains a LOAD utility control statement to load data into the LOCATION table. The above table describes the layout of the records in the input data set. The definition of the LOCATION table is shown on page 2-2. Be sure to specify the control statement correctly.

The syntax for the LOAD utility control statement can be found in the Utility Guide and Reference manual.

Loading the LOCATION table

We are now going to use DB2 Interactive (DB2I) to build a LOAD utility job to load the LOCATION table.

• Select DB2I on the ISPF Primary Option Menu.

• Select DB2I DEFAULTS on the DB2I Primary Option Menu.

• You will be presented with DB2I DEFAULTS PANEL 1. Press Enter.

• Copy the JOB statement present in member $JC in your CV83.CNTL data set.

• Press Enter.

• Select UTILITIES on the DB2I Primary Option Menu.

• You will be presented with the DB2 UTILITIES panel shown on the next page.

Column Name Input Field Position

LOCID 001:010

ADDRESS 011:040

CITY 041:070

POSTAL_CODE 071:085

COUNTRY 086:115

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

6-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 42: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

• Fill in field 1 as shown. Choosing this option means that you want to view the JCL before submitting the utility job.

• Fill in field 2 with the value of your TSO userid.

• Fill in field 3 with the name of the utility you want to run, which is LOAD.

• Fill in field 4 as shown. This is the name of the data set and member which contains your LOAD utility control statement.

• Fill in field 5 as shown.

• Fill in the options for field 6 as shown.

• Leave field 7 as blank.

• Press Enter.

• You will now be presented with the Data Set Names panel shown on the next page.

DB2 UTILITIES SSID: DSNB===>

Select from the following:

1 FUNCTION ===> EDITJCL (SUBMIT job, EDITJCL, DISPLAY, TERMINATE) 2 JOB ID ===> userid (A unique job identifier string) 3 UTILITY ===> LOAD (CHECK DATA, CHECK INDEX, CHECK LOB, COPY, DIAGNOSE, LOAD, MERGE, MODIFY, QUIESCE, REBUILD, RECOVER, REORG INDEX, REORG LOB, REORG TABLESPACE, REPORT, REPAIR, RUNSTATS, STOSPACE, UNLOAD) 4 STATEMENT DATA SET ===> CV83.CNTL(L6TSLOCN)

5 RESTART ===> NO (NO, CURRENT, PHASE or PREVIEW)

6 LISTDEF? (YES|NO) ===> NO TEMPLATE? (YES|NO) ===> NO 7 lib == > (BLANK or DB2 Library name). * The data set names panel will be displayed when required by a utility.F1=HELP F2=SPLIT F3=END F4=RETURN F5=RFIND F6=RCHANGE F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 6. Loading and unloading tables 6-3

Page 43: CV8317XSTUD

Student Exercises

.

• Fill in field 1 as shown. This is the name of the data set which contains the records to be loaded.

• Fill in field 2 as shown. This is the name of the data set to be used for discard processing.

• Blank out fields 3, 4, 5, 6, and 7.

• Press Enter.

• After you have viewed the utility job, specify SUBMIT on the editor command line to submit the job.

• Press PF3 to return to the DB2 Utilities panel.

• The utility should end with return code 0. Use SDSF to view the utility output.

DATA SET NAMES SSID: DB26 ===> Enter data set name for LOAD, REORG TABLESPACE, or UNLOAD: 1 RECDSN ===> CV83.TSLOCN.DATA Enter data set name for LOAD or REORG TABLESPACE: 2 DISCDSN ===> CV83.TSLOCN.DISCARD Enter output data sets for local/current site for COPY, MERGECOPY, LOAD, or REORG TABLESPACE: 3 COPYDSN ===> 4 COPYDSN2 ===> Enter output data sets for recovery site for COPY, LOAD, or REORG TABLESPACE: 5 RCPYDSN1 ===> 6 RCPYDSN2 ===> Enter output data sets for REORG or UNLOAD 7 PUNCHDSN ===> F1=HELP F2=SPLIT F3=END F4=RETURN F5=RFIND F6=RCHANGE F7=UP F8=DOWN F9=SWAP F10=LEFT F11=RIGHT F12=RETRIEVE

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

6-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 44: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Loading DEPARTMENT and EMPLOYEE (a cycle)

The LOAD utility control statements required to load the remaining tables are provided. You might find it useful to refer to page 2-7 and page 5-2 during this exercise.

__ 2. The utility control statement to load the DEPARTMENT table is supplied in member L6TSDEPT. First have a look at the contents of this member.

__ 3. How does the LOAD utility know when to set the MGRNO column value for a row to NULL?

__ 4. How does the LOAD utility know the length of the input data for column NAME?

__ 5. Should the control statement specify ENFORCE CONSTRAINTS (which is the default) or ENFORCE NO? Edit member L6TSDEPT accordingly.

__ 6. Using DB2I, prepare a utility job to load the DEPARTMENT table. The name of the data set which contains the records to be loaded is CV83.TSDEPT.DATA, and the name of the data set to be used for discard processing is CV83.TSDEPT.DISCARD.

__ 7. Submit the utility job. The utility should end with return code 4.

__ 8. Use SDSF to view the utility output. Why were two rows deleted during the INDEXVAL phase? Has table space TSDEPT been placed in a pending state?

__ 9. Select DB2 COMMANDS on the DB2I panel.

__ 10. Execute a -DISPLAY DATABASE command to confirm that table space TSDEPT has been placed in a pending status. The pending status will be corrected in Steps 15 to 23.

__ 11. The utility control statement to load the EMPLOYEE table is supplied in member L6TSEMPL. Why can the control statement specify (by default) ENFORCE CONSTRAINTS?

__ 12. Using DB2I, prepare a utility job to load the EMPLOYEE table. The name of the data set which contains the records to be loaded is CV83.TSEMPL.DATA, and the name of the data set to be used for discard processing is CV83.TSEMPL.DISCARD.

__ 13. Submit the utility job. The utility should end with return code 4.

__ 14. Use SDSF to view the utility output. Why were three rows discarded during the RELOAD phase? Why were three rows deleted during the ENFORCE phase? xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 6. Loading and unloading tables 6-5

Page 45: CV8317XSTUD

Student Exercises

.

Checking the cycle via CHECK DATA

__ 15. Recall that table space TSDEPT is in check pending state. You should run the CHECK DATA utility to remove the check pending state. However, before running the CHECK DATA utility against table space TSDEPT, you need to create exception tables for the dependent tables. Edit member L6EXCEPT, change all occurrences of ?? to your team ID, and make a note of the names of the exception tables. Execute the statements using SPUFI. SQLCODE 0 should be returned.

Steps 16 to 19 are optional.

__ 16. Create a member which contains a CHECK DATA utility control statement to check table space TSDEPT. Specify the DELETE NO option.

__ 17. Using DB2I, prepare a utility job to run the CHECK DATA utility, and submit the utility job. The utility should end with return code 4.

__ 18. Use SDSF to view the utility output. Has table space TSDEPT remained in check pending status? How many rows has CHECK DATA found to be invalid, and why?

__ 19. Execute member L6SELECT using SPUFI to query the contents of the exception tables for DEPARTMENT and EMPLOYEE.

__ 20. Create a member which contains a CHECK DATA utility control statement to check table space TSDEPT. Specify the DELETE YES option.

__ 21. Using DB2I, prepare a utility job to run the CHECK DATA utility and submit the utility job. The utility should end with return code 4.

__ 22. Use SDSF to view the utility output. Verify that table space TSDEPT is no longer in check pending status. How many rows has CHECK DATA deleted from table DEPARTMENT, and why?

__ 23. Execute member L6SELECT using SPUFI to query the contents of the exception tables for DEPARTMENT and EMPLOYEE. Try to explain why CHECK DATA deleted the rows which are listed for the second run of the utility.

Loading the remaining tables: PROJECT, ON_PROJECT, and ACTIVITY

__ 24. Using DB2I, prepare a utility job to load the PROJECT table. The utility control statement is supplied in member L6TSPRJ1. The name of the data set which contains the records to be loaded is CV83.TSPROJ.DATA1, and the name of the data set to be used for discard processing is CV83.TSPROJ.DISCARD1.

__ 25. What is the purpose of using the keyword STATISTICS in the LOAD utility control statement when loading the PROJECT table?

__ 26. Submit the utility job. The utility should end with return code 0.

__ 27. Use SDSF to view the utility output.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

6-6 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 46: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ 28. Using DB2I, prepare a utility job to load the ON_PROJECT and ACTIVITY tables. The utility control statement is supplied in member L6TSPRJ2. The name of the data set which contains the records to be loaded is CV83.TSPROJ.DATA2, and the name of the data set to be used for discard processing is CV83.TSPROJ.DISCARD2.

__ 29. Submit the utility job. The utility should end with return code 8.

__ 30. Use SDSF to view the utility output.

__ 31. Why did the utility fail? Edit member L6TSPRJ2 and add an option so that the LOAD utility adds to the existing data already present in table space TSPROJ.

__ 32. Submit the utility job. The utility should end with return code 0.

__ 33. Use SDSF to view the utility output.

Answer the following questions without actually working on the system:

a. Can the REPLACE option of the LOAD utility be used to replace the existing data for the ON_PROJECT and ACTIVITY tables while preserving the data for the PROJECT table?

b. How was the use of REPLACE option appropriate when the PROJECT table data was loaded?

c. Assuming you have reset the ACTIVITY table, can you repeat steps 28 to 30 to load the ON_PROJECT and ACTIVITY tables?

Understanding partition by growth universal table space

__ 34. Create a partition by growth universal table space named TSNEWDEP in your database. The maximum data set size should be 1 GB and TSNEWDEP should be able to grow up to a maximum of 5 partitions. Also, specify that you want 99 percent of each page to be left as free space and every other page should be a page of free space when the table space or partition is loaded or reorganized. Create table NEWDEPT which is identical to your table DEPARTMENT, but without any primary or foreign keys, in the table space TSNEWDEP in your database. Use member L6PBG1.

__ 35. Examine the catalog tables to note the important information for table space TSNEWDEP in your database. Use member L6PBG2.

__ 36. How many partitions are created?

Determine this from the catalog table information and also using ISPF 3.4 by using DBDSNB.DSNBB*.WWV83??D.TSNEWDEP (where ?? is your team-id) to narrow the search.

__ 37. Using DB2I, prepare and run a utility job to load the NEWDEPT table. The utility control statement is in member L6PBG3. The name of the data set which contains

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 6. Loading and unloading tables 6-7

Page 47: CV8317XSTUD

Student Exercises

.

the records to be loaded is CV83.TSNEWDEP.DATA, and the name of the data set to be used for discard processing is CV83.TSNEWDEP.DISCARD.

Please be patient as it will take a few minutes to complete.

__ 38. After the successful completion of the LOAD utility, how many partitions do you see?

Determine this from the utility output messages and also using ISPF 3.4 by using DBDSNB.DSNBB*.WWV83??D.TSNEWDEP (where ?? is your team-id) to narrow the search.

__ 39. Drop the table space TSNEWDEP in your database. Use member L6PBG4.

Unloading data

__ 40. Create a member called L6UNLOAD in your CV83.CNTL library with an UNLOAD utility control statement to unload data in EBCDIC from the table space TSPROJ.

Specify CV83.TSPROJ.UNLOAD.DATA and CV83.TSPROJ.UNLOAD.PUNCH for the unload and punch data sets. Examine what these contain after the UNLOAD utility completes successfully.

Optional lab steps

__ 41. Try to unload from TSPROJ in delimited format (at least from table PROJECT). Use the default characters for column delimiter, string delimiter, and decimal point. In order not to override the previous data sets, specify new names for the unload and punch data sets.

Examine what these data sets contain after the UNLOAD utility completes successfully.

__ 42. Let’s unload from a view.

__ a. To this end, create a view which lists the department by employees, and the manager who is responsible for this department:

---------+---------+---------+---------+-----EMPNO LAST_NAME DEPTNO MGRNO MGRNAME ---------+---------+---------+---------+-----000010 HAAS A00 000010 HAAS 000110 LUCCHESI A00 000010 HAAS 000120 O'CONNELL A00 000010 HAAS 000020 THOMPSON B01 000020 THOMPSON 000030 KWAN C01 000030 KWAN ....

(You may create the view on your own or use the member L6VIEW provided.)

__ b. Use the DB2 sample program DSNTIAUL for unloading; see member L6TIAUL. Add a second query involving a join into the same job. (Each SQL statement must end with a semicolon.) DSNTIAUL generates separate output data sets per

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

6-8 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 48: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

query and one additional data set with pertinent LOAD statements. Specify some meaningful output data set names (the provided DDNAMEs are fixed).

__ c. Inspect the three output data sets. Can you use the generated LOAD statements without modification? ____ Why? ___________________________________

__ 43. In order to consolidate what you learned about the data page structure, use the DB2 stand-alone utility DSN1PRNT to print the contents of your table space TSDEPT. (Hint: use provided member L6PRINT.) Provide DSN1PRNT parameters in the form: PARM='PRINT(f,l),EBCDIC,FORMAT', where f, l are the numbers of the first and last page respectively to print (f,l in hexadecimal format).

__ a. What did you specify for SYSUT1? _________________________________

__ b. Which values did you use for f, l? ____, ____

__ c. How many pages were printed? ________ What kind of pages? ______________________________________________________________

__ d. Look for the ID MAP in the data page. How many entries (records) do you find there? ______

__ e. Look for HOLEs: How many do you find? ______

__ f. Explain the number of holes: _______________________________________

__ g. Verify what you found out by comparing it with the number of rows (= ________) in the table space TSDEPT by selecting from its tables.

__ h. According to the DSN1PRNT output, what is the OBID of the table (PGSOBD) to which the rows belong? _______ Compare this with the OBID of the table in TSDEPT, as recorded in the DB2 catalog.

__ i. Find the prefix of the first two rows. What are the row lengths (PGSLTH)? _____,_____ Why different? ______________________________________

__ j. Insert a row with maximal length (use member L6INSERT). What is the length of the row according to the DB2 catalog? ______ Stop and start the table space, then issue the DSN1PRNT job again. What is the length of the newly-inserted record according to the job output? ______ Why different?

End of exercisexc

lusivo

form

ación

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 6. Loading and unloading tables 6-9

Page 49: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

6-10 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 50: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 7. Running RUNSTATS and REORG

What this exercise is about

This exercise provides an opportunity to gain hands-on experience concerning the following questions:

1. When and how should I retrieve statistics about a table space and its indexes and store these statistics in the catalog?

2. When and how should I reorganize a table space?

What you should be able to do

At the end of the exercise, you should be able to:

• Select from the catalog table SYSIBM.SYSTABLESPACESTATS and correctly interpret the results

• Run the RUNSTATS and the REORG utilities and use a variety of their respective options

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 7. Running RUNSTATS and REORG 7-1

Page 51: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

Throughout the exercise, search for ?? within the provided pdf member for each problem and replace any ?? with your team ID. Not all members will contain ??.

Use real-time statistics to determine the need for RUNSTATS

__ 1. Examine member L7QUERY1. Execute the statement using SPUFI. What is the query doing? By referring to DB2 catalog tables section in the Appendix of SQL Reference explain the meaning of the values held for each column, and complete the following table:

__ 2. Is TOTALROWS what you expect?

Hint

Refer to the solution of Exercise 6 and look at the LOAD output for all tables in table space TSPROJ.

__ 3. Explain the STATSINSERTS value.

__ 4. Based on the values in table 1, would you recommend to run RUNSTATS on table space TSPROJ, if your rule of thumb is to run RUNSTATS if at least 20% of the table space content has changed?

__ 5. Before running RUNSTATS, let us do another change to the content of one of the tables in table space TSPROJ. First, examine member L7UPDATE, then execute this member using SPUFI. What type of disorganization might this introduce into the table space?

__ 6. The previous step contained a query after the UPDATE statement. According to the result of that query, did any values change compared to table 1? Why not? When will STATSUPDATES reflect the 120 rows updated by query L7UPDATE? Be patient, it could take several minutes for STATSUPDATES to reflect the change. The time it takes depends on the interval STATSINT set in zparm.

Table 1: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJ

TOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

7-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 52: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ 7. After a while, execute member L7QUERY1. Is STATSUPDATES now what you expect?

Perform a RUNSTATS

__ 8. Create a RUNSTATS utility control statement to:

__ a. Update the DB2 catalog tables with all statistics for table space TSPROJ and all indexes.

__ b. The collected statistics should also be reported in the job output.

__ c. Allow read and write applications to execute while the utility is running.

__ 9. Using DB2I, prepare a utility job to run the RUNSTATS utility and submit the utility job. The utility should end with return code 0.

__ 10. Use SDSF to view the utility output. By referring to the RUNSTATS report and to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference, complete the following tables and explain the meaning of the values held for each column in these tables:

Table 2: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJ

TOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

Table 3: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJ

TOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

Table 4: SYSIBM.SYSTABLEPART Catalog StatisticsCARDF NEARINDREF FARINDREF

Table 5: SYSIBM.SYSINDEXPART Catalog StatisticsIndex Name CARDF NEAROFFPOSF FAROFFPOSF LEAFFAR

IXPROJ3

IXPROJ1

IXPROJ2

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 7. Running RUNSTATS and REORG 7-3

Page 53: CV8317XSTUD

Student Exercises

.

__ 11. Execute L7QUERY1 to cross-check with the real-time statistics to see if you get the same values. By the way, why are STATSINSERTS and STATSUPDATES now 0?

__ 12. Have any variable length rows overflowed to another page?

__ 13. Why is the data for the PROJECT table still reported as being well-clustered even though a number of rows in the PROJECT table have overflowed?

Use catalog statistics to conditionally perform a REORG

You can use the real-time statistics counters for determining whether to perform a REORG. However, you will now learn how to use the catalog statistics, gathered by running the RUNSTATS utility, to determine if there is a need to perform reorganization of table space TSPROJ in your database.

__ 14. Prepare a REORG TABLESPACE utility control statement to reorganize table space TSPROJ. Specify an OFFPOSLIMIT and INDREFLIMIT of 15. Also specify that a REORG should not be performed but that the utility should report whether or not a REORG is recommended.

__ 15. Using DB2I, prepare a utility job to run the REORG TABLESPACE utility. The name of the unload data set (field 1 of the Data Set Names panel) should be CV83.TSPROJ.UNLOAD. All other fields on the Data Set Names panel should be blanked out.

__ 16. Submit the utility job. The utility should end with return code 1. Use SDSF to view the utility output. Why does the utility end with return code 1?

__ 17. Modify your REORG TABLESPACE utility control statement and specify an OFFPOSLIMIT and INDREFLIMIT of 10. Again, a REORG should not be performed but the utility should report whether or not a REORG is recommended.

IXONPR2

IXONPR1

IXACTY1

IXACTY2

Table 6: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJ

TOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

Table 5: SYSIBM.SYSINDEXPART Catalog StatisticsIndex Name CARDF NEAROFFPOSF FAROFFPOSF LEAFFAR

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

7-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 54: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ 18. Submit the utility job. The utility should end with return code 2. Use SDSF to view the utility output. Which REORG limit has been met?

__ 19. Modify your REORG TABLESPACE utility control statement again so that a REORG is performed if the OFFPOSLIMIT or INDREFLIMIT of 10 is exceeded. In addition, specify that REORG should gather statistics for table space TSPROJ and all indexes. The job output should contain the statistics figures.

__ 20. Submit the utility job and use SDSF to view the utility output. The utility should end with return code 2. By referring to the REORG report, complete the following tables:

__ 21. NEARINDREF and FARINDREF should now both be 0.

Table 7: SYSIBM.SYSTABLEPART Catalog StatisticsCARDF NEARINDREF FARINDREF

Table 8: SYSIBM.SYSINDEXPART Catalog StatisticsIndex Name CARDF NEAROFFPOSF FAROFFPOSF LEAFFAR

IXPROJ3

IXPROJ1

IXPRPOJ2

IXONPR2

IXONPR1

IXACTY1

IXACTY2

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 7. Running RUNSTATS and REORG 7-5

Page 55: CV8317XSTUD

Student Exercises

.

Optional steps:

__ 22. Calculate how much space is needed for TSPROJ:

__ a. Determine how many segments are needed just for the PROJECT table alone. Then determine the total number of pages needed for TSPROJ.

__ b. Calculate the number of tracks needed (on a 3390 volume, a track can store 48 KB).

__ c. For such a small table space, the actual space allocated greatly depends on the environment, such as the zparm TSQTY. Here, 1 cylinder (= 15 tracks) is allocated.

Verify this by executing the IDCAMS command LISTCAT.

(Use member L7LISTC.)

__ 23. Restarting a utility, here REORG:

__ a. Simulating a typing error, enlarge the primary allocation for the index IXLOCN1 on LOCATION to the extreme value 999999999.

__ b. Try to reorganize the TSLOCN table space. (The job will of course fail because of the index space.) Check whether you can still retrieve data from the LOCATION table. Display the status of the database and of the REORG utility. Which phases of the REORG have been completed? ______________________________ Check whether the unloaded data exists.

__ c. Correct the problem and restart the utility. Be sure to change neither the utility ID nor the utility control statement nor the sysrec data set name. Which REORG phases are performed by this second job?

Note that there is no need to specify RESTART. When the job is submitted, DB2 automatically figures out if it is normal execution or restart. If it is restart, it also figures out if it should be phase restart or current restart.

______________________________________________________________ Again, check the status of the database and verify that you can query the data.

End of exerciseExclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

7-6 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 56: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 8. Running COPY and RECOVER

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with creating backup copies of table spaces and recovering physically corrupted table spaces to the current point in time.

What you should be able to do

At the end of the exercise, you should be able to:

• Run the COPY utility with various options

• Run the RECOVER utility in its basic form and explain its job output

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 8. Running COPY and RECOVER 8-1

Page 57: CV8317XSTUD

Student Exercises

.

Exercise instructions

Running the COPY utility

__ 1. Create a COPY utility control statement to create a local primary and a local backup FULL image copy of table space TSEMPL. Specify SYSCOPY for the local primary DDNAME and SYSCOPY2 for the local backup DDNAME. (These are the DDNAMEs generated by the Data Set Names panel of DB2I.)

__ 2. Using DB2I, prepare a utility job to run the COPY utility. The image copy data sets should be named CV83.TSEMPL.FIC1A for the local primary (field 3 of the Data Set Names panel) and CV83.TSEMPL.FIC1B for the local backup (field 4 of the Data Set Names panel). All other fields on the Data Set Names panel should be blanked out.

__ 3. Submit the utility job and use SDSF to view the utility output. The utility should end with return code 0.

__ 4. Execute member L8UPDATE using SPUFI. This UPDATE statement updates one row in partition 1 and one row in partition 3.

__ 5. Create a COPY utility control statement to create a local primary and a local backup INCREMENTAL image copy of table space TSEMPL. Specify SYSCOPY for the local primary DDNAME and SYSCOPY2 for the local backup DDNAME. (These are the DDNAMEs generated by the Data Set Names panel of DB2I.)

__ 6. Using DB2I, prepare a utility job to run the COPY utility. The image copy data sets should be named CV83.TSEMPL.IIC1A for the local primary (field 3 of the Data Set Names panel) and CV83.TSEMPL.IIC1B for the local backup (field 4 of the Data Set Names panel). All other fields on the Data Set Names panel should be blanked out.

__ 7. Submit the utility job and use SDSF to view the utility output. The utility should end with return code 0.

__ 8. Execute member L8UPDATE using SPUFI.

__ 9. Edit member L8QUERY1 and change ?? to your team ID.

__ 10. Execute member L8QUERY1 using SPUFI. By referring to DB2 Catalog Tables topic in Appendix "Additional Information for DB2 SQL" of the SQL Reference manual (SYSIBM.SYSCOPY), explain the meaning of the values held for each column.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

8-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 58: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Running the RECOVER utility

__ 11. Create a RECOVER utility control statement to recover table space TSEMPL.

__ 12. Using DB2I, prepare a utility job to run the RECOVER utility.

__ 13. Submit the utility job and use SDSF to view the utility output. The utility should end with return code 0.

__ 14. Which image copies are used by the RECOVER utility?

__ 15. Why must the RECOVER utility apply log records after restoring the image copies?

__ 16. Delete image copy CV83.TSEMPL.IIC1A

__ 17. Submit the RECOVER utility job again, and use SDSF to view the utility output. The utility should end with return code 0.

__ 18. Explain the response of the RECOVER utility.

__ 19. Delete image copy CV83.TSEMPL.IIC1B

__ 20. Submit the RECOVER utility job again, and use SDSF to view the utility output. The utility should end with return code 0.

__ 21. Explain the response of the RECOVER utility.

__ 22. Why must the RECOVER utility now apply an additional range of log records?

Optional labs

__ 23. Simulate an I/O error for a single partition of table space TSEMPL itself (rather than for copy data sets) and recover the table space partition. More precisely:

__ a. Copy only the first partition of TSEMPL. The name of the copy data set should be userid.CV83.TSEMPL.PART1.FCOPY1.

__ b. Determine the volumes the individual table space partitions reside on (use member L8LISTC, then look for “VOLSER”): ________, ________, ________

__ c. In order to simulate an I/O error, try to delete the VSAM cluster of the first partition (use member L8DELC). Why does the job fail? ________________ “Who” is the current user? __________

__ d. How can you delete the current user? _____________________________ (Use DB2I or alternatively member L8DB2CMD.) Then delete the first partition.

__ e. Now a substitution of the defect volume is needed, either by altering the DB2 storage group or by asking the SMS colleagues to replace the volume. (Remember, we know the volume which is defective.) As this depends on individual circumstances, we skip this step, pretending the volume has been replaced.

__ f. Recover only the first partition of TSEMPL. Which copy data set is used? ___________________________________________________

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 8. Running COPY and RECOVER 8-3

Page 59: CV8317XSTUD

Student Exercises

.

__ 24. In the optional lab on DSN1PRNT (Exercise 6, Step 43(j)), you were asked to perform the following steps: run DSN1PRNT, insert a new row, stop the table space, start the table space, run DSN1PRNT again, and observe the difference in the job outputs.

Why should you stop and then restart the table space? _____________________ ________________________________________________________________

You may check what happens if you run the second DSN1PRNT directly after the INSERT, without stopping and starting the table space.

__ 25. Clean up the system:

__ a. Use the appropriate utility to retrieve all recovery information DB2 has stored for the table space TSLOCN.

__ b. Delete some old SYSCOPY entries for this table space.

__ c. Retrieve the recovery information again. What differences do you see? _____________________________________________________________

End of exercise

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

8-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 60: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 9. Security

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with DB2 security.

What you should be able to do

At the end of the exercise, you should be able to:

• Request and give appropriate grants

• Retrieve and work with your primary and secondary authorization IDs, that is, with USER and CURRENT SQLID

• Navigate through the various security tables in the DB2 catalog and explain where and how security information is stored in DB2

• Create tables for others, with various qualifiers

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 9. Security 9-1

Page 61: CV8317XSTUD

Student Exercises

.

Exercise instructions

Note

As usual, replace ?? by your team number.

Privileges on tables you do not own

__ 1. Attempt to SELECT data from your neighbor's EMPLOYEE table. What happens?

__ 2. Ask your neighbor to GRANT you the SELECT privilege on their EMPLOYEE table.

__ 3. Attempt to SELECT data from your neighbor's EMPLOYEE table. What happens this time?

__ 4. Attempt to DELETE data from your neighbor's EMPLOYEE table. What happens?

RACF groups and current SQLID

The value of your Primary Authid and Current SQLID are each contained in a DB2 special register called USER and CURRENT SQLID respectively.

__ 5. Determine the value of your Primary Authid and Current SQLID by executing member L9AUTHID using SPUFI.

__ 6. Is it possible to determine your Secondary Authids using SQL? ________

Execute the TSO command LISTUSER (TSO LU) which lists the RACF group(s) to which you belong (“you are connected to”). If the list contains more than one group, note your so-called default group: ______________. You will use this group in the following exercises.

(The Connection Exit Routine assigns these groups as your Secondary Authids.)

__ 7. Use SQL to change your Current SQLID to something different from your Primary Authid. Remember your Current SQLID can only be changed to either your Primary Authid or to one of your Secondary Authids.

__ 8. Use L9AUTHID to check your Current SQLID setting.

Determining privileges held by authorization IDs

Certain privileges have been granted on database WWV83XXD (note: XX is really XX) to your Secondary Authid but not to your Primary Authid. (In the following, use your default Secondary Authid.)

__ 9. Query the appropriate DB2 catalog tables to determine:

__ a. Which Authid is the owner (creator) of this database.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

9-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 62: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

__ b. What privileges your Secondary Authid holds on this database.

__ c. Who granted your Secondary Authid these privileges.

__ d. What privileges the database owner holds on the database.

Privileges required to create a table (for example, with different owner)

Before performing the next part of the exercise, you should read the description of the privilege set required to create a table which is documented in the SQL Reference manual. Refer to the section which describes the CREATE TABLE statement and then read the information under heading Authorization. (Note that the manual uses the term SQL authorization ID rather than Current SQLID.)

__ 10. Member L9CRE1 sets your Current SQLID to your Primary Authid and attempts to create an implicitly qualified table in database WWV83XXD. Execute the member using SPUFI.

__ 11. What happens and why?

__ 12. Member L9CRE2 sets your Current SQLID to your Secondary Authid and attempts to create an implicitly qualified table in database WWV83XXD. Execute the member using SPUFI.

__ 13. What happens and why?

__ 14. Member L9CRE3 sets your Current SQLID to your Primary Authid and attempts to create an explicitly qualified table in database WWV83XXD. The explicit qualifier is your Secondary Authid. Execute the member using SPUFI.

__ 15. What happens, and why?

__ 16. Member L9CRE4 sets your Current SQLID to your Secondary Authid and attempts to create an explicitly qualified table in database WWV83XXD. The explicit qualifier is your Primary Authid. Edit this member, change xxxxxxx to your Primary Authid, and then execute the member using SPUFI.

__ 17. What happens, and why?

Privileges needed for DML

__ 18. Set your Current SQLID to your Primary Authid, and try to SELECT data from table sauthid.T??A, which you created earlier (where sauthid is your Secondary Authid and ?? is your team ID).

__ 19. Why is the SELECT successful, even though your Primary Authid does not have SELECT privilege on table sauthid.T??A?

__ 20. Query the appropriate DB2 catalog table to determine:

__ a. Which Authid owns tables T??A and T??B (where ?? is your team ID).

__ b. Which Schema is used for tables T??A and T??B (where ?? is your team ID).

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 9. Security 9-3

Page 63: CV8317XSTUD

Student Exercises

.

__ 21. Query the appropriate DB2 catalog table to determine which of your Authids has the privilege to query DB2 catalog table SYSIBM.SYSTABLES.

End of exercise

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

9-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 64: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 10.Locking

What this exercise is about

This exercise provides an opportunity to gain hands-on experience with DB2 locking.

What you should be able to do

At the end of the exercise, you should be able to:

• Explain where locking parameters for a table space, such as lock size, are documented in the DB2 catalog

• Find applications using potentially problematic parameters when it comes to concurrency, that is, for the RELEASE or ISOLATION options

• Display the current locking situation in a database

• Bypass a lock when selecting data

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 10. Locking 10-1

Page 65: CV8317XSTUD

Student Exercises

.

Exercise instructions

Retrieving locking information from the DB2 catalog

__ 1. Query the relevant DB2 catalog tables to determine:

__ a. What lock size is specified for your table spaces

__ b. Whether any application packages exist that will hold table space locks until deallocation

__ c. Whether any application packages exist that require a repeatable read capability.

Diagnose an unsuccessful lock request

__ 2. Try to execute a SELECT against table WWCV831.DEPARTMENT and wait to see what happens. What is the reason code you receive? ____________________ Look it up in the Codes manual and explain what it means. _______________________________________________________________

Displaying locking information for a segmented table space

__ 3. Execute member LAQUERY1 using SPUFI. Note down the name of the database and table space for table WWCV831.DEPARTMENT. Also note down the object ID (OBID column value) of the table.

__ 4. Use the appropriate DB2 command to display any locks that are held on the table space. Look up message DSNT397I in the Messages manual, and use the information to explain the output of the DISPLAY command.

__ a. Who is holding a lock on the table space, and what is the mode of the lock?

__ b. Who is holding a lock on the table, and what is the mode of the lock?

__ c. When will the locks be freed?

__ d. Is anyone waiting for a lock on the table space or table?

__ e. Query catalog table SYSIBM.SYSTABLESPACE to find out what lock size was specified for the table space.

Optional: Displaying locking information for a partitioned table space

__ 5. Use the appropriate DB2 command to display any locks that are held on table space WWV83YYD.TSEMPL. Again, look up message DSNT397I in the Messages manual, and use the information to explain the output of the DISPLAY command. Are all partitions locked? _______

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

10-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 66: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Reading uncommitted data

__ 6. Run your SELECT against table WWCV831.DEPARTMENT again (see step 2 above), but first add the WITH UR option to your SELECT statement.

__ 7. Why is the SELECT now successful?

__ 8. Run your SELECT against table WWCV831.DEPARTMENT again (see step 6 above), but first add the SKIP LOCKED DATA option instead of WITH UR to your SELECT statement. Explain the difference between WITH UR and SKIP LOCKED DATA.

End of exercise

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Exercise 10. Locking 10-3

Page 67: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

10-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 68: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Appendix A. Exercise solutions

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-1

Page 69: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-2 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 70: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 1: Creating databases and table spaces

Step 1: Creating a database

CREATE DATABASE WWV8301D BUFFERPOOL BP1 INDEXBP BP2 STOGROUP WWV8301S; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Steps 2 to 5: Creating table spaces

CREATE TABLESPACE TSLOCN IN WWV8301D

---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

CREATE TABLESPACE TSDEPT IN WWV8301D SEGSIZE 32 MAXPARTITIONS 5; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLESPACE TSEMPL IN WWV8301D SEGSIZE 4 NUMPARTS 3; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLESPACE TSPROJ IN WWV8301D SEGSIZE 4 PCTFREE 0; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-3

Page 71: CV8317XSTUD

Student Exercises

.

Steps 6 to 8: Querying the DB2 catalog tables SELECT SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR,

SUBSTR(STGROUP,1,8) AS STGROUP, BPOOL, INDEXBP FROM SYSIBM.SYSDATABASE WHERE CREATOR = USER WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+ NAME CREATOR STGROUP BPOOL INDEXBP ---------+---------+---------+---------+---------+---------+---------+---------+ WWV8301D TSOUB01 WWV8301S BP1 BP2 DSNE610I NUMBER OF ROWS DISPLAYED IS 1 ---------+---------+---------+---------+---------+---------+---------+---------+ SELECT SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(DBNAME,1,8) AS DBNAME, TYPE, BPOOL, PARTITIONS, MAXPARTITIONS, PGSIZE, STATUS, NTABLES, SEGSIZE FROM SYSIBM.SYSTABLESPACE WHERE CREATOR = USER WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+---------+ NAME CREATOR DBNAME TYPE BPOOL PARTITIONS MAXPARTITIONS PGSIZE STATUS NTABLES SEGSIZE ---------+---------+---------+---------+---------+---------+---------+---------+---------+ TSLOCN TSOUB01 WWV8301D BP1 0 0 4 T 0 4 TSDEPT TSOUB01 WWV8301D G BP1 1 5 4 T 0 32 TSEMPL TSOUB01 WWV8301D R BP1 3 0 4 T 0 4 TSPROJ TSOUB01 WWV8301D BP1 0 0 4 T 0 4 DSNE610I NUMBER OF ROWS DISPLAYED IS 4 ---------+---------+---------+---------+---------+---------+---------+---------+---------+ SELECT SUBSTR(TSNAME,1,8) AS TSNAME, PARTITION, PQTY, STORTYPE, SUBSTR(STORNAME,1,8) AS STORNAME, SUBSTR(VCATNAME,1,8) AS VCATNAME, FREEPAGE, PCTFREE FROM SYSIBM.SYSTABLEPART WHERE DBNAME = 'WWV8301D' WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+--TSNAME PARTITION PQTY STORTYPE STORNAME VCATNAME FREEPAGE PCTFREE ---------+---------+---------+---------+---------+---------+---------+---------+--TSLOCN 0 -1 I WWV8301S DBDSNB 0 5 TSDEPT 1 -1 I WWV8301S DBDSNB 0 5 TSEMPL 1 -1 I WWV8301S DBDSNB 0 5 TSEMPL 2 -1 I WWV8301S DBDSNB 0 5 TSEMPL 3 -1 I WWV8301S DBDSNB 0 5 TSPROJ 0 -1 I WWV8301S DBDSNB 0 0 DSNE610I NUMBER OF ROWS DISPLAYED IS 6 ---------+---------+---------+---------+---------+---------+---------+---------+--

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-4 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 72: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Remarks: PQTY = -1 indicates that no value has been specified for the primary quantity. The actual amount of space allocated depends on the TSQTY DSNZPARM value (here: one cylinder if TSQTY=0).

Optional labs:

Step 9a: Volume IDs according to the DB2 catalog

---------+---------+---------+---------+---------+---------+---------+SELECT * FROM SYSIBM.SYSVOLUMES WHERE SGNAME = 'WWV8301S' WITH UR ;---------+---------+---------+---------+---------+---------+---------+SGNAME SGCREATOR VOLID IBMREQD ---------+---------+---------+---------+---------+---------+---------+WWV8301S SYSPROG * N DSNE610I NUMBER OF ROWS DISPLAYED IS 1 ---------+---------+---------+---------+---------+---------+---------+

In this installation, the storage group has been defined with VOLUMES (’*’). That means that SMS routines should determine the volume per data set.

Step 9b: Explicit volume IDs reliable?

No. If SMS routines (so-called ACS routines) are activated, their rules may override even explicit volume specifications made via the DB2 command CREATE STOGROUP.

Step 10: Data set names of table space TSEMPL

We already know the high-level qualifier DBDSNB from querying SYSTABPLEPART (see above). As we assume that the name TSEMPL will be preserved in the data set name, we therefore search for DBDSNB.**.TSEMPL.* in ISPF 3.4 (without TSEMPL would work but would generate a longer list):

Data Set List Utility Option ===> More: + blank Display data set list P Print data set list V Display VTOC information PV Print VTOC information Enter one or both of the parameters below: Dsname Level . . . DBDSNB.**.TSEMPL.* Volume serial . .

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-5

Page 73: CV8317XSTUD

Student Exercises

.

The resulting list:

DSLIST - Data Sets Matching DBDSNB.**.TSEMPL.* Row 1 of 54 Command ===> Scroll ===> CSR Command - Enter "/" to select action Message Volume ------------------------------------------------------------------------------- DBDSNB.DSNBBC.WWV83YYD.TSEMPL.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV83YYD.TSEMPL.I0001.A002 *VSAM* DBDSNB.DSNBBC.WWV83YYD.TSEMPL.I0001.A003 *VSAM* DBDSNB.DSNBBC.WWV83ZZD.TSEMPL.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV83ZZD.TSEMPL.I0001.A002 *VSAM* ...........

Second attempt to narrow down this list (qualifying TSEMPL with its database name):

DSLIST - Data Sets Matching DBDSNB.**.WWV8301D.TSEMPL.* Row 1 of 6 Command ===> Scroll ===> CSR Command - Enter "/" to select action Message Volume ------------------------------------------------------------------------------- DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A002 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A003 *VSAM* DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A002 SMS012 DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A003 SMS012 ***************************** End of Data Set list ****************************

Step 11: Volume ID of TSEMPL, partition 1As can be seen, the data set of partition 1 of TSEMPL resides on volume SMS012.

Step 12: Why does CREATE TABLESPACE fail?---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLESPACE TEST01A IN WWV83ZZD ; ---------+---------+---------+---------+---------+---------+---------+---------+DSNT408I SQLCODE = -904, ERROR: UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE. REASON 00D70025, TYPE OF RESOURCE 00000220, AND RESOURCE NAME DBV8ZZZ.DSNBBC.WWV83ZZD.TEST01A.I0001.A001 DSNT418I SQLSTATE = 57011 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXICTS SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 105 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000069' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-6 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 74: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

In ssnnMSTR, you see various error messages, for example:

03.18.48 STC00436 DSNP009I -DSNB THE FOLLOWING ERROR MESSAGES WERE 316 316 RECEIVED FOR DEFINE CLUSTER ON 316 DBV8ZZZ.DSNDBC.WWV83ZZD.TEST01A.I0001.A001 316 IGD17103I CATALOG ERROR WHILE DEFINING VSAM DATA SET 316 DBV8ZZZ.DSNDBC.WWV83ZZD.TEST01A.I0001.A001 316 RETURN CODE IS 56 REASON CODE IS 6 IGG0CLFT 316 IGD306I UNEXPECTED ERROR DURING IGG0CLFT PROCESSING 316 RETURN CODE 56 REASON CODE 6 316 THE MODULE THAT DETECTED THE ERROR IS IGDVTSCU 316 SMS MODULE TRACE BACK - VTSCU VTSCT VTSCH VTSCG VTSCD VTSCC V 316 SSIRT 316 SYMPTOM RECORD CREATED, PROBLEM ID IS IGD00000 316 IGD17219I UNABLE TO CONTINUE DEFINE OF DATA SET 316 DBV8ZZZ.DSNDBC.WWV83ZZD.TEST01A.I0001.A001 316 IDC3018I SECURITY VERIFICATION FAILED 316 IDC3009I ** VSAM CATALOG RETURN CODE IS 56 - REASON CODE IS 316 IGG0CLFT-6 316 IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12

The System Log produces similar error messages, that is, in these examples, “SECURITY VERIFICATION FAILED”, when DB2 tries to define cluster DBV8ZZZ.DSNBBC.WWV83ZZD.TEST01A.I0001.A001.

Query which volumes are used for the last (unsuccessful) trial and the previous (successful) trials to create table spaces in databases WWV83ZZD or WWV8301D respectively:

---------+---------+---------+---------+---------+---------+-- SELECT * FROM SYSIBM.SYSVOLUMES WHERE SGNAME IN (SELECT STGROUP FROM SYSIBM.SYSDATABASE WHERE NAME IN ('WWV8301D', 'WWV83ZZD') ) WITH UR ;---------+---------+---------+---------+---------+---------+--SGNAME SGCREATOR VOLID ---------+---------+---------+---------+---------+---------+--WWV83ZZS SYSPROG * WWV8301S SYSPROG * DSNE610I NUMBER OF ROWS DISPLAYED IS 2 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+--

In both cases, the storage groups are defined with VOLUMES(’*’).

So, there must be another reason.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-7

Page 75: CV8317XSTUD

Student Exercises

.

By looking at the ssnnMSTR or the syslog message:

“DBV8ZZZ.DSNBBC.WWV83ZZD.TEST01A.I0001.A001 could not be defined”,

now inspect the VCAT specification:

---------+---------+---------+---------+---------+---------+- SELECT NAME, VCATNAME FROM SYSIBM.SYSSTOGROUP WHERE NAME IN (SELECT STGROUP FROM SYSIBM.SYSDATABASE WHERE NAME IN ('WWV8301D', 'WWV83ZZD') ) WITH UR ;---------+---------+---------+---------+---------+---------+-NAME VCATNAME ---------+---------+---------+---------+---------+---------+-WWV8301S DBDSNB WWV83ZZS DBV8ZZZ DSNE610I NUMBER OF ROWS DISPLAYED IS 2 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+-

By looking at this result, check, whether the hlq (or “alias”) DBV8ZZZ exists at all:

Data Set List Utility No data set names foundOption ===> More: + blank Display data set list P Print data set list V Display VTOC information PV Print VTOC information Enter one or both of the parameters below: Dsname Level . . . DBV8ZZZ Volume serial . .

You get the message “No data set names found”.

On the other hand, if you enter the high-level qualifier DBDSNB, you see lots of entries, so this qualifier obviously exists. This difference points to the reason why the last CREATE TABLESPACE statement failed: DB2 can only create data sets if the aliases for their hlq have already been defined.Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-8 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 76: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 2: Creating tables

Steps 1 to 12: Creating tables

CREATE TABLE LOCATION (LOCID CHAR(10) NOT NULL, ADDRESS CHAR(30) NOT NULL, CITY CHAR(30) NOT NULL, POSTAL_CODE CHAR(15) NOT NULL, COUNTRY CHAR(30) NOT NULL) IN WWV8301D.TSLOCN; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLE DEPARTMENT (DEPTNO CHAR(3) NOT NULL, SUPERIOR_DEPTNO CHAR(3) , MGRNO CHAR(6) , NAME VARCHAR(50) NOT NULL) IN WWV8301D.TSDEPT; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLE PROJECT (PROJNO CHAR(6) NOT NULL, DEPTNO CHAR(3) NOT NULL, EMPNO CHAR(6) NOT NULL, STAFFING DECIMAL(5,2) , START_DATE DATE , END_DATE DATE , NAME VARCHAR(50) NOT NULL) IN WWV8301D.TSPROJ; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLE ON_PROJECT (PROJNO CHAR(6) NOT NULL, EMPNO CHAR(6) NOT NULL) IN WWV8301D.TSPROJ; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-9

Page 77: CV8317XSTUD

Student Exercises

.

CREATE TABLE ACTIVITY (PROJNO CHAR(6) NOT NULL, EMPNO CHAR(6) NOT NULL, SEQNO SMALLINT NOT NULL, CODE SMALLINT NOT NULL, TIME_SPENT DECIMAL(5,2) , START_DATE DATE , END_DATE DATE ) IN WWV8301D.TSPROJ; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE TABLE EMPLOYEE (EMPNO CHAR(6) NOT NULL, FIRST_NAME CHAR(20) NOT NULL, MIDDLE_INITIAL CHAR(1) , SEX CHAR(1) NOT NULL, BIRTHDATE DATE , PHONE CHAR(4) , HIRING_DATE DATE , JOB CHAR(20) , EDUCATION SMALLINT NOT NULL, SALARY DECIMAL(9,2) , BONUS DECIMAL(9,2) , COMMISSION DECIMAL(9,2) , DEPTNO CHAR(3) , LOCID CHAR(10) , LAST_NAME VARCHAR(50) NOT NULL, CONSTRAINT SEX CHECK(SEX IN ('M', 'F'))) PARTITION BY (EMPNO ASC) (PARTITION 1 ENDING AT ('000150'), PARTITION 2 ENDING AT ('000230'), PARTITION 3 ENDING AT ('001000')) IN WWV8301D.TSEMPL; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-10 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 78: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Steps 13 to 15: Querying the DB2 catalog tablesSELECT SUBSTR(NAME,1,10) AS NAME, TYPE,

SUBSTR(DBNAME,1,8) AS DBNAME, SUBSTR(TSNAME,1,8) AS TSNAME, COLCOUNT, RECLENGTH, CHECKS, STATUS

FROM SYSIBM.SYSTABLES WHERE CREATOR = USER AND NAME NOT IN ('EMP')WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+--- NAME TYPE DBNAME TSNAME COLCOUNT RECLENGTH CHECKS STATUS---------+---------+---------+---------+---------+---------+---------+---------+---- LOCATION T WWV8301D TSLOCN 5 123 0 DEPARTMENT T WWV8301D TSDEPT 4 74 0 PROJECT T WWV8301D TSPROJ 7 89 0 ON_PROJECT T WWV8301D TSPROJ 2 20 0 ACTIVITY T WWV8301D TSPROJ 7 38 0 EMPLOYEE T WWV8301D TSEMPL 15 160 1 DSNE610I NUMBER OF ROWS DISPLAYED IS 6 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

SELECT SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(DBNAME,1,8) AS DBNAME, PARTITIONS, STATUS, NTABLES

FROM SYSIBM.SYSTABLESPACE WHERE CREATOR = USER WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+ NAME CREATOR DBNAME PARTITIONS STATUS NTABLES ---------+---------+---------+---------+---------+---------+---------+---------+ TSLOCN TSOUB01 WWV8301D 0 A 1 TSDEPT TSOUB01 WWV8301D 1 A 1 TSEMPL TSOUB01 WWV8301D 3 A 1 TSPROJ TSOUB01 WWV8301D 0 A 3 DSNE610I NUMBER OF ROWS DISPLAYED IS 4 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+ xc

lusivo

form

ación

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-11

Page 79: CV8317XSTUD

Student Exercises

.

SELECT SUBSTR(NAME,1,18) AS NAME, SUBSTR(TBNAME,1,10) AS TBNAME, COLNO, COLTYPE, LENGTH, SCALE, NULLS FROM SYSIBM.SYSCOLUMNS WHERE TBCREATOR = USER AND TBNAME NOT IN ('EMP') ORDER BY TBNAME, COLNO WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+ NAME TBNAME COLNO COLTYPE LENGTH SCALE NULLS ---------+---------+---------+---------+---------+---------+---------+---------+ PROJNO ACTIVITY 1 CHAR 6 0 N EMPNO ACTIVITY 2 CHAR 6 0 N SEQNO ACTIVITY 3 SMALLINT 2 0 N CODE ACTIVITY 4 SMALLINT 2 0 N TIME_SPENT ACTIVITY 5 DECIMAL 5 2 Y START_DATE ACTIVITY 6 DATE 4 0 Y END_DATE ACTIVITY 7 DATE 4 0 Y DEPTNO DEPARTMENT 1 CHAR 3 0 N SUPERIOR_DEPTNO DEPARTMENT 2 CHAR 3 0 Y MGRNO DEPARTMENT 3 CHAR 6 0 Y NAME DEPARTMENT 4 VARCHAR 50 0 N EMPNO EMPLOYEE 1 CHAR 6 0 N FIRST_NAME EMPLOYEE 2 CHAR 20 0 N MIDDLE_INITIAL EMPLOYEE 3 CHAR 1 0 Y SEX EMPLOYEE 4 CHAR 1 0 N BIRTHDATE EMPLOYEE 5 DATE 4 0 Y PHONE EMPLOYEE 6 CHAR 4 0 Y HIRING_DATE EMPLOYEE 7 DATE 4 0 Y JOB EMPLOYEE 8 CHAR 20 0 Y EDUCATION EMPLOYEE 9 SMALLINT 2 0 N SALARY EMPLOYEE 10 DECIMAL 9 2 Y BONUS EMPLOYEE 11 DECIMAL 9 2 Y COMMISSION EMPLOYEE 12 DECIMAL 9 2 Y DEPTNO EMPLOYEE 13 CHAR 3 0 Y LOCID EMPLOYEE 14 CHAR 10 0 Y LAST_NAME EMPLOYEE 15 VARCHAR 50 0 N LOCID LOCATION 1 CHAR 10 0 N ADDRESS LOCATION 2 CHAR 30 0 N CITY LOCATION 3 CHAR 30 0 N POSTAL_CODE LOCATION 4 CHAR 15 0 N COUNTRY LOCATION 5 CHAR 30 0 N PROJNO ON_PROJECT 1 CHAR 6 0 N EMPNO ON_PROJECT 2 CHAR 6 0 N PROJNO PROJECT 1 CHAR 6 0 N DEPTNO PROJECT 2 CHAR 3 0 N EMPNO PROJECT 3 CHAR 6 0 N STAFFING PROJECT 4 DECIMAL 5 2 Y START_DATE PROJECT 5 DATE 4 0 Y END_DATE PROJECT 6 DATE 4 0 Y NAME PROJECT 7 VARCHAR 50 0 N DSNE610I NUMBER OF ROWS DISPLAYED IS 40

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-12 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 80: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Optional labs:

Step 16: Catalog information on check constraints---------+---------+---------+---------+---------+---------+---------+SELECT TBOWNER, CREATOR, TBNAME, CHECKNAME, CHECKCONDITION FROM SYSIBM.SYSCHECKS WHERE TBOWNER = 'TSOUB01' AND TBNAME = 'EMPLOYEE'WITH UR ;---------+---------+---------+---------+---------+---------+---------+TBOWNER CREATOR TBNAME CHECKNAME CHECKCONDI ---------+---------+---------+---------+---------+---------+---------+TSOUB01 TSOUB01 EMPLOYEE SEX SEX IN ('M', 'F')DSNE610I NUMBER OF ROWS DISPLAYED IS 1 ---------+---------+---------+---------+---------+---------+---------+

---------+---------+---------+---------+---------+---------+---------+SELECT TBOWNER, TBNAME, CHECKNAME, COLNAME FROM SYSIBM.SYSCHECKDEP WHERE TBOWNER = 'TSOUB01' AND TBNAME = 'EMPLOYEE'WITH UR ;---------+---------+---------+---------+---------+---------+---------+TBOWNER TBNAME CHECKNAME COLNAME ---------+---------+---------+---------+---------+---------+---------+TSOUB01 EMPLOYEE SEX SEX DSNE610I NUMBER OF ROWS DISPLAYED IS 1 ---------+---------+---------+---------+---------+---------+---------+

Step 17: Catalog information on partition limit keys

---------+---------+---------+---------+---------+---------+---------+---------+SELECT PARTITION, TSNAME, DBNAME, LIMITKEY, LIMITKEY_INTERNAL FROM SYSIBM.SYSTABLEPART P WHERE DBNAME = 'WWV8301D' AND TSNAME = 'TSEMPL' WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+PARTITION TSNAME DBNAME LIMITKEY LIMITKEY_INTERNAL ---------+---------+---------+---------+---------+---------+---------+---------+ 1 TSEMPL WWV8301D '000150' 000150 2 TSEMPL WWV8301D '000230' 000230 3 TSEMPL WWV8301D '001000' 001000 DSNE610I NUMBER OF ROWS DISPLAYED IS 3 ---------+---------+---------+---------+---------+---------+---------+---------+

Remark:

Since table-controlled partitioning is used, LIMITKEY_INTERNAL is filled with values.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-13

Page 81: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-14 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 82: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 3: Creating and using views

Steps 1 to 2: Create view V1

CREATE VIEW V1 AS SELECT EMPNO AS SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION FROM EMP WHERE SALARY < 20000 ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-15

Page 83: CV8317XSTUD

Student Exercises

.

Step 3: Select from V1 and EMP

SELECT * FROM V1; ---------+---------+---------+---------+---------+---------+---------+---------+ SERIAL_NUMBER SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000210 18270.00 WILLIAM JONES 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA DSNE610I NUMBER OF ROWS DISPLAYED IS 7 SELECT EMPNO, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION, MIDDLE_INITIAL, BIRTHDATE, PHONE, HIRING_DATE, JOB, BONUS, COMMISSION, DEPTNO, LOCID FROM EMP ---------+---------+---------+---------+---------+---------+---------+---------+ EMPNO SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000010 52750.00 CHRISTINE HAAS 000020 41250.00 MICHAEL THOMPSON ... 15 lines removed ................................. 000200 27740.00 DAVID BROWN 000210 18270.00 WILLIAM JONES 000220 29840.00 JENNIFER LUTZ 000230 22180.00 JAMES JEFFERSON 000240 28760.00 SALVATORE MARINO 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000270 27380.00 MARIA PEREZ 000280 26250.00 ETHEL SCHNEIDER 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA 000330 25370.00 WING LEE 000340 23840.00 JASON GOUNOT DSNE610I NUMBER OF ROWS DISPLAYED IS 32 Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-16 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 84: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Steps 4 to 5: INSERT using V1

INSERT INTO V1 (SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION) VALUES('000350', 15000, 'GEORGE', 'HARRISON','M', 22); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ INSERT INTO V1 (SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION) VALUES('000360', 50000, 'RINGO', 'STARR','M', 22) ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Rows inserted through view V1 do not have to conform to the definition of V1.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-17

Page 85: CV8317XSTUD

Student Exercises

.

Step 6: Select from V1 and EMP

SELECT * FROM V1; ---------+---------+---------+---------+---------+---------+---------+---------+ SERIAL_NUMBER SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000210 18270.00 WILLIAM JONES 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA 000350 15000.00 GEORGE HARRISON DSNE610I NUMBER OF ROWS DISPLAYED IS 8 SELECT EMPNO, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION, MIDDLE_INITIAL, BIRTHDATE, PHONE, HIRING_DATE, JOB, BONUS, COMMISSION, DEPTNO, LOCID FROM EMP ---------+---------+---------+---------+---------+---------+---------+---------+ EMPNO SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000010 52750.00 CHRISTINE HAAS 000020 41250.00 MICHAEL THOMPSON ... 15 lines removed ................................. 000200 27740.00 DAVID BROWN 000210 18270.00 WILLIAM JONES 000220 29840.00 JENNIFER LUTZ 000230 22180.00 JAMES JEFFERSON 000240 28760.00 SALVATORE MARINO 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000270 27380.00 MARIA PEREZ 000280 26250.00 ETHEL SCHNEIDER 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA 000330 25370.00 WING LEE 000340 23840.00 JASON GOUNOT 000350 15000.00 GEORGE HARRISON 000360 50000.00 RINGO STARR DSNE610I NUMBER OF ROWS DISPLAYED IS 34 Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-18 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 86: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 7: DELETE using V1

DELETE FROM V1 WHERE SERIAL_NUMBER = '000350' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

The row with a serial number of 000350 satisfies the definition of view V1.

Step 8: DELETE using V1

DELETE FROM V1 WHERE SERIAL_NUMBER = '000360' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

The row with a serial number of 000360 does not satisfy the definition of view V1.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-19

Page 87: CV8317XSTUD

Student Exercises

.

Step 9: Select from V1 and EMP

SELECT * FROM V1; ---------+---------+---------+---------+---------+---------+---------+---------+ SERIAL_NUMBER SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000210 18270.00 WILLIAM JONES 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA DSNE610I NUMBER OF ROWS DISPLAYED IS 7 SELECT EMPNO, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION, MIDDLE_INITIAL, BIRTHDATE, PHONE, HIRING_DATE, JOB, BONUS, COMMISSION, DEPTNO, LOCID FROM EMP ---------+---------+---------+---------+---------+---------+---------+---------+ EMPNO SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000010 52750.00 CHRISTINE HAAS 000020 41250.00 MICHAEL THOMPSON ... 15 lines removed ................................. 000200 27740.00 DAVID BROWN 000210 18270.00 WILLIAM JONES 000220 29840.00 JENNIFER LUTZ 000230 22180.00 JAMES JEFFERSON 000240 28760.00 SALVATORE MARINO 000250 19180.00 DANIEL SMITH 000260 17250.00 SYBIL JOHNSON 000270 27380.00 MARIA PEREZ 000280 26250.00 ETHEL SCHNEIDER 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA 000330 25370.00 WING LEE 000340 23840.00 JASON GOUNOT 000360 50000.00 RINGO STARR DSNE610I NUMBER OF ROWS DISPLAYED IS 33 Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-20 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 88: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 10: UPDATE using V1

UPDATE V1 SET SALARY = SALARY + 5000 WHERE SERIAL_NUMBER = '000260' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

The row with a serial number of 000260 satisfies the definition of view V1.

Step 11: UPDATE using V1

UPDATE V1 SET SALARY = SALARY - 5000 WHERE SERIAL_NUMBER = '000260' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

The row with a serial number of 000260 does not satisfy the definition of view V1.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-21

Page 89: CV8317XSTUD

Student Exercises

.

Step 12: Select from V1 and EMP

SELECT * FROM V1; ---------+---------+---------+---------+---------+---------+---------+---------+ SERIAL_NUMBER SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000210 18270.00 WILLIAM JONES 000250 19180.00 DANIEL SMITH 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA DSNE610I NUMBER OF ROWS DISPLAYED IS 6 SELECT EMPNO, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION, MIDDLE_INITIAL, BIRTHDATE, PHONE, HIRING_DATE, JOB, BONUS, COMMISSION, DEPTNO, LOCID FROM EMP ---------+---------+---------+---------+---------+---------+---------+---------+ EMPNO SALARY FIRST_NAME LAST_NAME ---------+---------+---------+---------+---------+---------+---------+---------+ 000010 52750.00 CHRISTINE HAAS 000020 41250.00 MICHAEL THOMPSON ... 15 lines removed ................................. 000200 27740.00 DAVID BROWN 000210 18270.00 WILLIAM JONES 000220 29840.00 JENNIFER LUTZ 000230 22180.00 JAMES JEFFERSON 000240 28760.00 SALVATORE MARINO 000250 19180.00 DANIEL SMITH 000260 22250.00 SYBIL JOHNSON 000270 27380.00 MARIA PEREZ 000280 26250.00 ETHEL SCHNEIDER 000290 15340.00 JOHN PARKER 000300 17750.00 PHILIP SMITH 000310 15900.00 MAUDE SETRIGHT 000320 19950.00 RAMLAL MEHTA 000330 25370.00 WING LEE 000340 23840.00 JASON GOUNOT 000360 50000.00 RINGO STARR DSNE610I NUMBER OF ROWS DISPLAYED IS 33 Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-22 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 90: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Steps 13 to 14: Create view V2

CREATE VIEW V2 AS SELECT EMPNO AS SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION FROM EMP WHERE SALARY < 20000 WITH CHECK OPTION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 15: INSERT using V2

INSERT INTO V2 (SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION) VALUES('000370', 15000, 'LIAM', 'GALLAGHER','M', 22); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ INSERT INTO V2 (SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX, EDUCATION) VALUES('000380', 50000, 'NOEL', 'GALLAGHER','M', 22) ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -161, ERROR: THE INSERT OR UPDATE IS NOT ALLOWED BECAUSE A RESULTING ROW DOES NOT SATISFY THE VIEW DEFINITION DSNT418I SQLSTATE = 44000 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXRSVW SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -160 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFF60' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ xc

lusivo

form

ación

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-23

Page 91: CV8317XSTUD

Student Exercises

.

Step 16: UPDATE using V2

UPDATE V2 SET SALARY = SALARY + 0100 WHERE SERIAL_NUMBER = '000290'; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ UPDATE V2 SET SALARY = SALARY + 5000 WHERE SERIAL_NUMBER = '000290' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -161, ERROR: THE INSERT OR UPDATE IS NOT ALLOWED BECAUSE A RESULTING ROW DOES NOT SATISFY THE VIEW DEFINITION DSNT418I SQLSTATE = 44000 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXRSVW SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -160 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFF60' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Steps 17 to 18: Create view V3

CREATE VIEW V3 AS SELECT EMPNO AS SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX FROM EMP WHERE SALARY < 20000 ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-24 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 92: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 19: INSERT using V3

INSERT INTO V3 (SERIAL_NUMBER, SALARY, FIRST_NAME, LAST_NAME, SEX) VALUES('000380', 50000, 'NOEL', 'GALLAGHER','M') ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -551, ERROR: TSOUB01 DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION INSERT ON OBJECT TSOUB01.V3 DSNT418I SQLSTATE = 42501 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXOIN SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -600 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFDA8' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

The insert fails because the definition of view V3 does not include non-nullable column EDUCATION.

Step 20: Querying the DB2 catalog table SELECT SUBSTR(TCREATOR,1,8) AS TCREATOR,

SUBSTR(TTNAME,1,8) AS TTNAME, SELECTAUTH, DELETEAUTH, INSERTAUTH, UPDATEAUTH

FROM SYSIBM.SYSTABAUTH WHERE TCREATOR = USER AND TTNAME LIKE 'V%'

---------+---------+---------+---------+---------+---------+---------+---------+ TCREATOR TTNAME SELECTAUTH DELETEAUTH INSERTAUTH UPDATEAUTH ---------+---------+---------+---------+---------+---------+---------+---------+ TSOUB01 V1 G G G G TSOUB01 V2 G G G G TSOUB01 V3 G G G DSNE610I NUMBER OF ROWS DISPLAYED IS 3 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

The owner of view V3 does not have INSERT privilege on V3 because the definition of V3 does not include non-nullable column EDUCATION.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-25

Page 93: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-26 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 94: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 4: Creating indexes

Step 1: Create four indexes (on LOCATION and DEPARTMENT)

CREATE UNIQUE INDEX IXLOCN1 ON LOCATION(LOCID); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE UNIQUE INDEX IXDEPT1 ON DEPARTMENT(DEPTNO) CLUSTER; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE INDEX IXDEPT2 ON DEPARTMENT(MGRNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ CREATE INDEX IXDEPT3 ON DEPARTMENT(SUPERIOR_DEPTNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-27

Page 95: CV8317XSTUD

Student Exercises

.

Step 2: Create the remaining 10 indexes - with specifications for IXEMPL1 and IXONPR1 - via DSNTEP2

***************************** Top of Data ******************************//DSNTEP2 EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) //STEPLIB DD DSN=DBDSNB.DB2A10.SDSNLOAD,DISP=SHR //DBRMLIB DD DSN=DBDSNB.DB2A10.DBRMLIB.DATA,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DSNB) RUN PROGRAM(DSNTEP2) PLAN(DSNTEP10) - LIB('DBDSNB.DB2A10.RUNLIB.LOAD') PARMS('/ALIGN(MID)') END //SYSIN DD * CREATE UNIQUE INDEX IXEMPL1 ON EMPLOYEE(EMPNO) PARTITIONED CLUSTER; CREATE INDEX IXEMPL2 ON EMPLOYEE(DEPTNO); CREATE INDEX IXEMPL3 ON EMPLOYEE(LOCID); CREATE UNIQUE INDEX IXPROJ1 ON PROJECT(PROJNO); CREATE INDEX IXPROJ2 ON PROJECT(DEPTNO); CREATE INDEX IXPROJ3 ON PROJECT(EMPNO) CLUSTER; CREATE UNIQUE INDEX IXONPR1 ON ON_PROJECT(PROJNO, EMPNO); CREATE INDEX IXONPR2 ON ON_PROJECT(EMPNO) CLUSTER; CREATE UNIQUE INDEX IXACTY1 ON ACTIVITY(PROJNO, EMPNO, SEQNO); CREATE INDEX IXACTY2 ON ACTIVITY(EMPNO); **************************** Bottom of Data ****************************

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-28 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 96: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Partial DSNTEP2 job output:

********************************* TOP OF DATA **********************************1 1PAGE 1 ***INPUT STATEMENT: CREATE UNIQUE INDEX IXEMPL1 ON EMPLOYEE(EMPNO) PARTITIONED CLUSTER; RESULT OF SQL STATEMENT: DSNT400I SQLCODE = 000, SUCCESSFUL EXECUTION DSNT418I SQLSTATE = 00000 SQLSTATE RETURN CODE DSNT416I SQLERRD = 0 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF' .... INFORMATION CREATE SUCCESSFUL 1PAGE 1 ***INPUT STATEMENT: CREATE INDEX IXEMPL2 ON EMPLOYEE(DEPTNO); RESULT OF SQL STATEMENT: DSNT400I SQLCODE = 000, SUCCESSFUL EXECUTION DSNT418I SQLSTATE = 00000 SQLSTATE RETURN CODE DSNT416I SQLERRD = 0 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF' .... INFORMATION CREATE SUCCESSFUL ............. etc.........******************************** BOTTOM OF DATA ********************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-29

Page 97: CV8317XSTUD

Student Exercises

.

Steps 3 to 5: Querying the DB2 catalog tables

SELECT SUBSTR(NAME,1,7) AS NAME, SUBSTR(TBNAME,1,10) AS TBNAME, SUBSTR(DBNAME,1,8) AS DBNAME, UNIQUERULE, CLUSTERING, INDEXSPACE, BPOOL, PIECESIZE FROM SYSIBM.SYSINDEXES WHERE CREATOR = USER AND NAME NOT IN ('IXLAB3') ORDER BY NAME WITH UR ; ---------+---------+---------+---------+---------+---------+---------+---------+---------+ NAME TBNAME DBNAME UNIQUERULE CLUSTERING INDEXSPACE BPOOL PIECESIZE ---------+---------+---------+---------+---------+---------+---------+---------+---------+ IXACTY1 ACTIVITY WWV8301D U N IXACTY1 BP2 2097152 IXACTY2 ACTIVITY WWV8301D D N IXACTY2 BP2 2097152 IXDEPT1 DEPARTMENT WWV8301D U Y IXDEPT1 BP2 4194304 IXDEPT2 DEPARTMENT WWV8301D D N IXDEPT2 BP2 4194304 IXDEPT3 DEPARTMENT WWV8301D D N IXDEPT3 BP2 4194304 IXEMPL1 EMPLOYEE WWV8301D U Y IXEMPL1 BP2 0 IXEMPL2 EMPLOYEE WWV8301D D N IXEMPL2 BP2 4194304 IXEMPL3 EMPLOYEE WWV8301D D N IXEMPL3 BP2 4194304 IXLOCN1 LOCATION WWV8301D U N IXLOCN1 BP2 2097152 IXONPR1 ON_PROJECT WWV8301D U N IXONPR1 BP2 2097152 IXONPR2 ON_PROJECT WWV8301D D Y IXONPR2 BP2 2097152 IXPROJ1 PROJECT WWV8301D U N IXPROJ1 BP2 2097152 IXPROJ2 PROJECT WWV8301D D N IXPROJ2 BP2 2097152 IXPROJ3 PROJECT WWV8301D D Y IXPROJ3 BP2 2097152 DSNE610I NUMBER OF ROWS DISPLAYED IS 14 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-30 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 98: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

---------+---------+---------+---------+---------+---------+---------+ SELECT SUBSTR(IXNAME,1,8) AS IXNAME, PARTITION, SUBSTR(CHAR(PQTY),1,4) AS PQTY, SUBSTR(STORNAME,1,8) AS STORNAME, SUBSTR(VCATNAME,1,8) AS VCATNAME, SUBSTR(LIMITKEY,1,6) AS LIMITKEY, FREEPAGE, PCTFREE FROM SYSIBM.SYSINDEXPART IP WHERE IXCREATOR = USER AND IXNAME NOT IN ('IXLAB3') ORDER BY IXNAME, PARTITION WITH UR ; ---------+---------+---------+---------+---------+---------+---------+---------+IXNAME PARTITION PQTY STORNAME VCATNAME LIMITKEY FREEPAGE PCTFREE ---------+---------+---------+---------+---------+---------+---------+---------+IXACTY1 0 -1 WWV8301S DBDSNB ...... 0 10 IXACTY2 0 -1 WWV8301S DBDSNB ...... 0 10 IXDEPT1 0 -1 WWV8301S DBDSNB ...... 0 10 IXDEPT2 0 -1 WWV8301S DBDSNB ...... 0 10 IXDEPT3 0 -1 WWV8301S DBDSNB ...... 0 10 IXEMPL1 1 -1 WWV8301S DBDSNB ...... 0 10 IXEMPL1 2 -1 WWV8301S DBDSNB ...... 0 10 IXEMPL1 3 -1 WWV8301S DBDSNB ...... 0 10 IXEMPL2 0 -1 WWV8301S DBDSNB ...... 0 10 IXEMPL3 0 -1 WWV8301S DBDSNB ...... 0 10 IXLOCN1 0 -1 WWV8301S DBDSNB ...... 0 10 IXONPR1 0 -1 WWV8301S DBDSNB ...... 0 10 IXONPR2 0 -1 WWV8301S DBDSNB ...... 0 10 IXPROJ1 0 -1 WWV8301S DBDSNB ...... 0 10 IXPROJ2 0 -1 WWV8301S DBDSNB ...... 0 10 IXPROJ3 0 -1 WWV8301S DBDSNB ...... 0 10 DSNE610I NUMBER OF ROWS DISPLAYED IS 16 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Remarks:

LIMITKEY is x’20’, a Unicode blank; the column is defined as varchar(512) for bit data. Therefore the correct expression would be: “SUBSTR(CAST(CAST(LIMITKEY AS VARCHAR(512) CCSID 1208) AS VARCHAR(512) CCSID EBCDIC),1,4) AS LIMITKEY”, which would eliminate the dotted output column. Similarly, other columns, like IXNAME, should be retrieved via “SUBSTRING(IXNAME,1,8,CODEUNITS16) AS IXNAME”.

PQTY = -1 indicates that no value has been specified for the primary quantity.

The actual amount of space allocated depends on the IXQTY DSNZPARM value (one cylinder if IXQTY=0.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-31

Page 99: CV8317XSTUD

Student Exercises

.

SELECT SUBSTR(IXNAME,1,7) AS IXNAME, SUBSTR(COLNAME,1,18) AS COLNAME, COLSEQ, COLNO, ORDERING FROM SYSIBM.SYSKEYS WHERE IXCREATOR = USER AND IXNAME NOT IN ('IXLAB3') ORDER BY IXNAME, COLSEQ WITH UR ; ---------+---------+---------+---------+---------+---------+---------+---------+ IXNAME COLNAME COLSEQ COLNO ORDERING ---------+---------+---------+---------+---------+---------+---------+---------+ IXACTY1 PROJNO 1 1 A IXACTY1 EMPNO 2 2 A IXACTY1 SEQNO 3 3 A IXACTY2 EMPNO 1 2 A IXDEPT1 DEPTNO 1 1 A IXDEPT2 MGRNO 1 3 A IXDEPT3 SUPERIOR_DEPTNO 1 2 A IXEMPL1 EMPNO 1 1 A IXEMPL2 DEPTNO 1 13 A IXEMPL3 LOCID 1 14 A IXLOCN1 LOCID 1 1 A IXONPR1 PROJNO 1 1 A IXONPR1 EMPNO 2 2 A IXONPR2 EMPNO 1 2 A IXPROJ1 PROJNO 1 1 A IXPROJ2 DEPTNO 1 2 A IXPROJ3 EMPNO 1 3 A DSNE610I NUMBER OF ROWS DISPLAYED IS 17 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-32 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 100: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 6: -DISPLAY DATABASE

DB2 COMMANDS SSID: DSNB ===> Position cursor on the command line you want to execute and press ENTER Cmd 1 ===> -DISPLAY DB(WWV8301D) Cmd 2 ===> Cmd 3 ===> ...> Cmd 4 ===> ...> Cmd 5 ===> ...> ...> Cmd 6 ===> ...> ...> Cmd 7 ===> DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 16142 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSDEPT TS 0001 RW TSDEPT TS RW TSEMPL TS 0001 RW -THRU 0003 TSEMPL TS RW TSLOCN TS RW TSPROJ TS RW IXACTY1 IX RW IXACTY2 IX RW IXDEPT1 IX L0001 RW IXDEPT1 IX L* RW IXDEPT2 IX L0001 RW IXDEPT2 IX L* RW IXDEPT3 IX L0001 RW IXDEPT3 IX L* RW IXEMPL1 IX 0001 RW -THRU 0003 IXEMPL1 IX RW IXEMPL2 IX L0001 RW -THRU 0003 IXEMPL2 IX L* RW IXEMPL3 IX L0001 RW -THRU 0003 IXEMPL3 IX L* RW IXLOCN1 IX RW IXONPR1 IX RW

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-33

Page 101: CV8317XSTUD

Student Exercises

.

IXONPR2 IX RW IXPROJ1 IX RW IXPROJ2 IX RW IXPROJ3 IX RW ******* DISPLAY OF DATABASE WWV8301D ENDED **********************DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-34 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 102: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 7: VSAM clusters

DSLIST - Data Sets Matching DBDSNB.DSNDB*.WWV8301D.** Row 1 of 44 Command ===> Scroll ===> PAGE Command - Enter "/" to select action Message Volume ------------------------------------------------------------------------------- DBDSNB.DSNBBC.WWV8301D.IXACTY1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXACTY2.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXDEPT1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXDEPT2.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXDEPT3.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXEMPL1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXEMPL1.I0001.A002 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXEMPL1.I0001.A003 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXEMPL2.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXEMPL3.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXLOCN1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXONPR1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXONPR2.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXPROJ1.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXPROJ2.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.IXPROJ3.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSDEPT.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A002 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSEMPL.I0001.A003 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSLOCN.I0001.A001 *VSAM* DBDSNB.DSNBBC.WWV8301D.TSPROJ.I0001.A001 *VSAM* DBDSNB.DSNBBD.WWV8301D.IXACTY1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXACTY2.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXDEPT1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXDEPT2.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXDEPT3.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXEMPL1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXEMPL1.I0001.A002 SMS012 DBDSNB.DSNBBD.WWV8301D.IXEMPL1.I0001.A003 SMS012 DBDSNB.DSNBBD.WWV8301D.IXEMPL2.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXEMPL3.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXLOCN1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXONPR1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXONPR2.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXPROJ1.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXPROJ2.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.IXPROJ3.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.TSDEPT.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A002 SMS012 DBDSNB.DSNBBD.WWV8301D.TSEMPL.I0001.A003 SMS012 DBDSNB.DSNBBD.WWV8301D.TSLOCN.I0001.A001 SMS012 DBDSNB.DSNBBD.WWV8301D.TSPROJ.I0001.A001 SMS012 ***************************** End of Data Set list ****************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-35

Page 103: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-36 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 104: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 5: Creating referential structures

Step 1: Defining primary keys

ALTER TABLE LOCATION ADD CONSTRAINT LOCID PRIMARY KEY (LOCID); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE DEPARTMENT ADD CONSTRAINT DEPTNO PRIMARY KEY (DEPTNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE EMPLOYEE ADD CONSTRAINT EMPNO PRIMARY KEY (EMPNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE PROJECT ADD CONSTRAINT PROJNO PRIMARY KEY (PROJNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE ON_PROJECT ADD CONSTRAINT PROJNO_EMPNO PRIMARY KEY (PROJNO,EMPNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE ACTIVITY ADD CONSTRAINT PROJNO_EMPNO_SEQNO PRIMARY KEY (PROJNO,EMPNO,SEQNO); ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-37

Page 105: CV8317XSTUD

Student Exercises

.

Step 2: Defining foreign keys and delete rules on DEPARTMENT

ALTER TABLE DEPARTMENT ADD CONSTRAINT DD FOREIGN KEY (SUPERIOR_DEPTNO) REFERENCES DEPARTMENT ON DELETE NO ACTION; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE DEPARTMENT ADD CONSTRAINT ED FOREIGN KEY (MGRNO) REFERENCES EMPLOYEE ON DELETE SET NULL; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 3: Defining foreign keys on the remaining tables ALTER TABLE EMPLOYEE ADD CONSTRAINT LE FOREIGN KEY (LOCID) REFERENCES LOCATION ON DELETE NO ACTION; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE EMPLOYEE ADD CONSTRAINT DE FOREIGN KEY (DEPTNO) REFERENCES DEPARTMENT ON DELETE SET NULL; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-38 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 106: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

ALTER TABLE PROJECT ADD CONSTRAINT DP FOREIGN KEY (DEPTNO) REFERENCES DEPARTMENT ON DELETE NO ACTION; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE PROJECT ADD CONSTRAINT EP FOREIGN KEY (EMPNO) REFERENCES EMPLOYEE ON DELETE NO ACTION; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE ON_PROJECT ADD CONSTRAINT EO FOREIGN KEY (EMPNO) REFERENCES EMPLOYEE ON DELETE CASCADE; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE ON_PROJECT ADD CONSTRAINT PO FOREIGN KEY (PROJNO) REFERENCES PROJECT ON DELETE CASCADE; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ ALTER TABLE ACTIVITY ADD CONSTRAINT OA FOREIGN KEY (PROJNO,EMPNO) REFERENCES ON_PROJECT ON DELETE CASCADE; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-39

Page 107: CV8317XSTUD

Student Exercises

.

Step 4: Querying the DB2 catalog tablesSELECT SUBSTR(CONSTNAME,1,20) AS CONSTNAME, SUBSTR(TBNAME,1,10) AS TBNAME, TYPE, SUBSTR(IXNAME,1,7) AS IXAME, COLCOUNT

FROM SYSIBM.SYSTABCONST WHERE TBCREATOR = USER ORDER BY CREATEDTS WITH UR ; ---------+---------+---------+---------+---------+---------+---------+---------+ CONSTNAME TBNAME TYPE IXNAME COLCOUNT ---------+---------+---------+---------+---------+---------+---------+---------+ LOCID LOCATION P IXLOCN1 1 DEPTNO DEPARTMENT P IXDEPT1 1 EMPNO EMPLOYEE P IXEMPL1 1 PROJNO PROJECT P IXPROJ1 1 PROJNO_EMPNO ON_PROJECT P IXONPR1 2 PROJNO_EMPNO_SEQNO ACTIVITY P IXACTY1 3 DSNE610I NUMBER OF ROWS DISPLAYED IS 6 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

SELECT SUBSTR(CONSTNAME,1,20) AS CONSTNAME, SUBSTR(TBNAME,1,10) AS TBNAME, SUBSTR(COLNAME,1,10) AS COLNAME, COLSEQ, COLNO

FROM SYSIBM.SYSKEYCOLUSE WHERE TBCREATOR = USER ORDER BY CONSTNAME, COLSEQ WITH UR ; ---------+---------+---------+---------+---------+---------+---------+---------+ CONSTNAME TBNAME COLNAME COLSEQ COLNO ---------+---------+---------+---------+---------+---------+---------+---------+ DEPTNO DEPARTMENT DEPTNO 1 1 EMPNO EMPLOYEE EMPNO 1 1 LOCID LOCATION LOCID 1 1 PROJNO PROJECT PROJNO 1 1 PROJNO_EMPNO ON_PROJECT PROJNO 1 1 PROJNO_EMPNO ON_PROJECT EMPNO 2 2 PROJNO_EMPNO_SEQNO ACTIVITY PROJNO 1 1 PROJNO_EMPNO_SEQNO ACTIVITY EMPNO 2 2 PROJNO_EMPNO_SEQNO ACTIVITY SEQNO 3 3 DSNE610I NUMBER OF ROWS DISPLAYED IS 9 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-40 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 108: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

SELECT SUBSTR(REFTBNAME,1,10) AS REFTBNAME, SUBSTR(TBNAME,1,10) AS TBNAME, SUBSTR(RELNAME,1,20) AS RELNAME, COLCOUNT, DELETERULE FROM SYSIBM.SYSRELS WHERE CREATOR = USER ORDER BY REFTBNAME, TBNAME WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+ REFTBNAME TBNAME RELNAME COLCOUNT DELETERULE ---------+---------+---------+---------+---------+---------+---------+---------+ DEPARTMENT DEPARTMENT DD 1 A DEPARTMENT EMPLOYEE DE 1 N DEPARTMENT PROJECT DP 1 A EMPLOYEE DEPARTMENT ED 1 N EMPLOYEE ON_PROJECT EO 1 C EMPLOYEE PROJECT EP 1 A LOCATION EMPLOYEE LE 1 A ON_PROJECT ACTIVITY OA 2 C PROJECT ON_PROJECT PO 1 C DSNE610I NUMBER OF ROWS DISPLAYED IS 9 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 5 (optional): Querying catalog table SYSIBM.SYSFOREIGNKEYS

---------+---------+---------+---------+---------+---------+---------+---------+ SELECT * FROM SYSIBM.SYSFOREIGNKEYS WHERE CREATOR = USER WITH UR ; ; ---------+---------+---------+---------+---------+---------+---------+---------+---------+CREATOR TBNAME RELNAME COLNAME COLNO COLSEQ IBMREQD---------+---------+---------+---------+---------+---------+---------+---------+---------+TSOUB01 DEPARTMENT DD SUPERIOR_DEPTN 2 1 NTSOUB01 DEPARTMENT ED MGRNO 3 1 NTSOUB01 EMPLOYEE LE LOCID 14 1 NTSOUB01 EMPLOYEE DE DEPTNO 13 1 NTSOUB01 PROJECT DP DEPTNO 2 1 NTSOUB01 PROJECT EP EMPNO 3 1 NTSOUB01 ON_PROJECT EO EMPNO 2 1 NTSOUB01 ON_PROJECT PO PROJNO 1 1 NTSOUB01 ACTIVITY OA PROJNO 1 1 NTSOUB01 ACTIVITY OA EMPNO 2 2 NDSNE610I NUMBER OF ROWS DISPLAYED IS 10 DSNE612I DATA FOR COLUMN HEADER COLNAME COLUMN NUMBER 4 WAS TRUNCATED DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-41

Page 109: CV8317XSTUD

Student Exercises

.

10 rows for 9 relationships, because the foreign key on ACTIVITY is defined on 2 columns.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-42 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 110: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 6: Loading and unloading tables

Overall remark on this lab:

Some input records are deliberately not correct so that you see the resulting error messages and learn how you can technically react. In reality, you may react differently: neither ignore that some records could not be loaded, nor delete loaded records because of orphaned foreign key values, if you were not told to do exactly that. Instead, you would, for example:

1. Determine the reasons2. Reset the database objects to the previous state3. Ask for revised, error-free input.

Step 1 - Prolog: The LOCATION data you load: TSOUB01.CV83.TSLOCN.DATA ===> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+--- ...***************************** Top of Data ************************************ ...US95141-B4555 BAILEY AVENUE SAN JOSE CA 95141 ...US95141-C2555 BAILEY AVENUE SAN JOSE CA 95141 ...US95193-505600 COTTLE ROAD SAN JOSE CA 95193 ...DE71083-01AM FICHTENBERG 1 HERRENBERG D-71083 ...**************************** Bottom of Data ********************************** ...

Step 1a: Utility control statement for loading the LOCATION table TSOUB01.CV83.CNTL(L6TSLOCN)

***************************** Top of Data ********* LOAD DATA INTO TABLE LOCATION ( LOCID POSITION ( 1: 10) CHAR(10), ADDRESS POSITION (11: 40) CHAR(30), CITY POSITION (41: 70) CHAR(30), POSTAL_CODE POSITION (71: 85) CHAR(15), COUNTRY POSITION (86:115) CHAR(30) ) **************************** Bottom of Data *******xc

lusivo

form

ación

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-43

Page 111: CV8317XSTUD

Student Exercises

.

Step 1b: Job for loading the LOCATION table, generated via DB2I TSOUB01.DSNULOA.CNTL

//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1),// CLASS=A,MSGCLASS=Q,NOTIFY=TSOUB01,REGION=0M //* //* //UTIL EXEC DSNBUPRC,SYSTEM=DSNB,UID='TSOUB01',UTPROC=''//* //********************************************** //* //* GENERATING JCL FOR THE LOAD UTILITY //* DATE: 08/26/11 TIME: 07:52:39 //* //********************************************** //* //DSNUPROC.SORTWK01 DD DSN=TSOUB01.SORTWK01, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK02 DD DSN=TSOUB01.SORTWK02, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK03 DD DSN=TSOUB01.SORTWK03, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK04 DD DSN=TSOUB01.SORTWK04, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSREC DD DSN=TSOUB01.CV83.TSLOCN.DATA, // DISP=OLD //DSNUPROC.SYSDISC DD DSN=TSOUB01.CV83.TSLOCN.DISCARD,// DISP=(MOD,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSUT1 DD DSN=TSOUB01.SYSUT1, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTOUT DD DSN=TSOUB01.SORTOUT, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSERR DD DSN=TSOUB01.SYSERR, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSMAP DD DSN=TSOUB01.SYSMAP, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSIN DD *

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-44 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 112: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

LOAD DATA INTO TABLE LOCATION ( LOCID POSITION ( 1: 10) CHAR(10), ADDRESS POSITION (11: 40) CHAR(30), CITY POSITION (41: 70) CHAR(30), POSTAL_CODE POSITION (71: 85) CHAR(15), COUNTRY POSITION (86:115) CHAR(30) ) // **************************** Bottom of Data *****************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-45

Page 113: CV8317XSTUD

Student Exercises

.

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 1

of 6

1 J E S 2 J O B L O G -- S Y S T E M D I 1 1 -- N O D E M V S D I 1 1

0 07.52.56 JOB00456 ---- FRIDAY, 26 AUG 2011 ----

07.52.56 JOB00456 IRR010I USERID TSOUB01 IS ASSIGNED TO THIS JOB.

07.52.56 JOB00456 ICH70001I TSOUB01 LAST ACCESS AT 05:55:07 ON FRIDAY, AUGUST 26, 2011

07.52.56 JOB00456 $HASP373 TSOUB011 STARTED - INIT 1 - CLASS A - SYS DI11

07.52.57 JOB00456 - -----TIMINGS (MINS.)------ -----PAGING COUNTS----

07.52.57 JOB00456 -STEPNAME PROCSTEP RC EXCP CONN TCB SRB CLOCK SERV WORKLOAD PAGE SWAP VIO

SWAPS

07.52.57 JOB00456 -UTIL DSNUPROC 00 764 65 .00 .00 .0 309 BATCH 0 0 0 0

07.52.57 JOB00456 -TSOUB011 ENDED. NAME-TSOUB01 JOB TOTAL TCB CPU TIME= .00 TOTAL ELAPSED TIME= .0

07.52.57 JOB00456 $HASP395 TSOUB011 ENDED

0------ JES2 JOB STATISTICS ------

- 26 AUG 2011 JOB EXECUTION DATE

- 59 CARDS READ

- 273 SYSOUT PRINT RECORDS

- 0 SYSOUT PUNCH RECORDS

- 17 SYSOUT SPOOL KBYTES

- 0.01 MINUTES EXECUTION TIME

1 1 //TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), JOB00456

// CLASS=A,MSGCLASS=Q,NOTIFY=TSOUB01,REGION=0M

//*

//*

2 //UTIL EXEC DSNBUPRC,SYSTEM=DSNB,UID='TSOUB01',UTPROC=''

3 XXDSNUPROC PROC LIB='DBDSNB.DB2A10.SDSNLOAD',

XX SYSTEM=DSNB,

XX SIZE=0K,UID='',UTPROC=''

XX*

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-46 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 114: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 2

of 6

XX**********************************************************************

XX* *

XX* PROCEDURE-NAME: DSNBUPRC *

XX* *

XX* DESCRIPTIVE-NAME: UTILITY PROCEDURE *

XX* *

XX* FUNCTION: THIS PROCEDURE INVOKES THE ADMF UTILITIES IN THE *

XX* BATCH ENVIRONMENT *

XX* *

XX* PROCEDURE-OWNER: UTILITY COMPONENT *

XX* *

XX* COMPONENT-INVOKED: ADMF UTILITIES (ENTRY POINT DSNUTILB). *

XX* *

XX* ENVIRONMENT: BATCH *

XX* *

XX* INPUT: *

XX* PARAMETERS: *

XX* LIB = THE DATA SET NAME OF THE DB2 PROGRAM LIBRARY. *

XX* THE DEFAULT LIBRARY NAME IS PREFIX.SDSNLOAD, *

XX* WITH PREFIX SET DURING INSTALLATION. *

XX* SIZE = THE REGION SIZE OF THE UTILITIES EXECUTION AREA.*

XX* THE DEFAULT REGION SIZE IS 2048K. *

XX* SYSTEM = THE SUBSYSTEM NAME USED TO IDENTIFY THIS JOB *

XX* TO DB2 . THE DEFAULT IS "DSNB". *

XX* UID = THE IDENTIFIER WHICH WILL DEFINE THIS UTILITY *

XX* JOB TO DB2. IF THE PARAMETER IS DEFAULTED OR *

XX* SET TO A NULL STRING, THE UTILITY FUNCTION WILL *

XX* USE ITS DEFAULT, USERID.JOBNAME. EACH UTILITY *

XX* WHICH HAS STARTED AND IS NOT YET TERMINATED *

XX* (MAY NOT BE RUNNING) MUST HAVE A UNIQUE UID. *

XX* UTPROC = AN OPTIONAL INDICATOR USED TO DETERMINE WHETHER *

XX* THE USER WISHES TO INITIALLY START THE REQUESTED*

XX* UTILITY OR TO RESTART A PREVIOUS EXECUTION OF *

XX* THE UTILITY. IF OMITTED, THE UTILITY WILL *

XX* BE INITIALLY STARTED. OTHERWISE, THE UTILITY *

XX* WILL BE RESTARTED BY ENTERING THE FOLLOWING *

XX* VALUES: *

XX* RESTART(PHASE) = RESTART THE UTILITY AT THE *

XX* BEGINNING OF THE PHASE EXECUTED *

XX* LAST. *

XX* RESTART = RESTART THE UTILITY AT THE LAST *

XX* OR CURRENT COMMIT POINT. *

XX* *

XX* OUTPUT: NONE. *

XX* *

XX* EXTERNAL-REFERENCES: NONE. *

XX* *

XX* CHANGE-ACTIVITY: *

XX* *

XX* *

XX**********************************************************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-47

Page 115: CV8317XSTUD

Student Exercises

.

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 3

of 6

XX*

4 XXDSNUPROC EXEC PGM=DSNUTILB,REGION=&SIZE,

XX PARM='&SYSTEM,&UID,&UTPROC'

IEFC653I SUBSTITUTION JCL - PGM=DSNUTILB,REGION=0K,PARM='DSNB,TSOUB01,'

5 XXSTEPLIB DD DSN=&LIB,DISP=SHR

XX*

XX**********************************************************************

XX* *

XX* THE FOLLOWING DEFINE THE UTILITIES' PRINT DATA SETS *

XX* *

XX**********************************************************************

XX*

IEFC653I SUBSTITUTION JCL - DSN=DBDSNB.DB2A10.SDSNLOAD,DISP=SHR

6 XXSYSPRINT DD SYSOUT=*

7 XXUTPRINT DD SYSOUT=*

8 XXSYSUDUMP DD SYSOUT=*

XX*DSNBUPRC PEND REMOVE * FOR USE AS INSTREAM PROCEDURE

//*

//**********************************************

//*

//* GENERATING JCL FOR THE LOAD UTILITY

//* DATE: 08/26/11 TIME: 07:52:39

//*

//**********************************************

//*

9 //DSNUPROC.SORTWK01 DD DSN=TSOUB01.SORTWK01,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

10 //DSNUPROC.SORTWK02 DD DSN=TSOUB01.SORTWK02,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

11 //DSNUPROC.SORTWK03 DD DSN=TSOUB01.SORTWK03,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

12 //DSNUPROC.SORTWK04 DD DSN=TSOUB01.SORTWK04,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

13 //DSNUPROC.SYSREC DD DSN=TSOUB01.CV83.TSLOCN.DATA,

// DISP=OLD

14 //DSNUPROC.SYSDISC DD DSN=TSOUB01.CV83.TSLOCN.DISCARD,

// DISP=(MOD,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

15 //DSNUPROC.SYSUT1 DD DSN=TSOUB01.SYSUT1,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

16 //DSNUPROC.SORTOUT DD DSN=TSOUB01.SORTOUT,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

17 //DSNUPROC.SYSERR DD DSN=TSOUB01.SYSERR,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-48 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 116: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 4

of 6

18 //DSNUPROC.SYSMAP DD DSN=TSOUB01.SYSMAP,

// DISP=(MOD,DELETE,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

19 //DSNUPROC.SYSIN DD *

1 STMT NO. MESSAGE

2 IEFC001I PROCEDURE DSNBUPRC WAS EXPANDED USING SYSTEM LIBRARY SYS2.DB2.PROCLIB

ICH70001I TSOUB01 LAST ACCESS AT 05:55:07 ON FRIDAY, AUGUST 26, 2011

IEF236I ALLOC. FOR TSOUB011 DSNUPROC UTIL

IGD103I SMS ALLOCATED TO DDNAME STEPLIB

IEF237I JES2 ALLOCATED TO SYSPRINT

IEF237I JES2 ALLOCATED TO UTPRINT

IEF237I JES2 ALLOCATED TO SYSUDUMP

IGD101I SMS ALLOCATED TO DDNAME (SORTWK01)

DSN (TSOUB01.SORTWK01 )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS004

IGD101I SMS ALLOCATED TO DDNAME (SORTWK02)

DSN (TSOUB01.SORTWK02 )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS002

IGD101I SMS ALLOCATED TO DDNAME (SORTWK03)

DSN (TSOUB01.SORTWK03 )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS001

IGD101I SMS ALLOCATED TO DDNAME (SORTWK04)

DSN (TSOUB01.SORTWK04 )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS002

IGD103I SMS ALLOCATED TO DDNAME SYSREC

IGD101I SMS ALLOCATED TO DDNAME (SYSDISC )

DSN (TSOUB01.CV83.TSLOCN.DISCARD )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS004

IGD101I SMS ALLOCATED TO DDNAME (SYSUT1 )

DSN (TSOUB01.SYSUT1 )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS001

IGD101I SMS ALLOCATED TO DDNAME (SORTOUT )

DSN (TSOUB01.SORTOUT )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS002

IGD101I SMS ALLOCATED TO DDNAME (SYSERR )

DSN (TSOUB01.SYSERR )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS001

IGD101I SMS ALLOCATED TO DDNAME (SYSMAP )

DSN (TSOUB01.SYSMAP )

STORCLAS (BASE) MGMTCLAS (STANDARD) DATACLAS ( )

VOL SER NOS= SMS004

IEF237I JES2 ALLOCATED TO SYSIN

IEF142I TSOUB011 DSNUPROC UTIL - STEP WAS EXECUTED - COND CODE 0000

IGD104I DBDSNB.DB2A10.SDSNLOAD RETAINED, DDNAME=STEPLIB

IEF285I TSOUB01.TSOUB011.JOB00456.D0000102.? SYSOUT

IEF285I TSOUB01.TSOUB011.JOB00456.D0000103.? SYSOUT

IEF285I TSOUB01.TSOUB011.JOB00456.D0000104.? SYSOUT

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-49

Page 117: CV8317XSTUD

Student Exercises

.

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 5

of 6

IGD105I TSOUB01.SORTWK01 DELETED, DDNAME=SORTWK01

IGD105I TSOUB01.SORTWK02 DELETED, DDNAME=SORTWK02

IGD105I TSOUB01.SORTWK03 DELETED, DDNAME=SORTWK03

IGD105I TSOUB01.SORTWK04 DELETED, DDNAME=SORTWK04

IGD104I TSOUB01.CV83.TSLOCN.DATA RETAINED, DDNAME=SYSREC

IGD104I TSOUB01.CV83.TSLOCN.DISCARD RETAINED, DDNAME=SYSDISC

IGD105I TSOUB01.SYSUT1 DELETED, DDNAME=SYSUT1

IGD105I TSOUB01.SORTOUT DELETED, DDNAME=SORTOUT

IGD105I TSOUB01.SYSERR DELETED, DDNAME=SYSERR

IGD105I TSOUB01.SYSMAP DELETED, DDNAME=SYSMAP

IEF285I TSOUB01.TSOUB011.JOB00456.D0000101.? SYSIN

IEF373I STEP/DSNUPROC/START 2011238.0752

IEF032I STEP/DSNUPROC/STOP 2011238.0752

CPU: 0 HR 00 MIN 00.06 SEC SRB: 0 HR 00 MIN 00.00 SEC

VIRT: 1232K SYS: 292K EXT: 1575816K SYS: 11616K

IEF375I JOB/TSOUB011/START 2011238.0752

IEF033I JOB/TSOUB011/STOP 2011238.0752

CPU: 0 HR 00 MIN 00.06 SEC SRB: 0 HR 00 MIN 00.00 SEC

1DSNU000I 238 07:52:56.36 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 238 07:52:56.42 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 238 07:52:56.53 DSNUGUTC - LOAD DATA

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - INTO TABLE LOCATION

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - (LOCID POSITION(1:10) CHAR(10),

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - ADDRESS POSITION(11:40) CHAR(30),

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - CITY POSITION(41:70) CHAR(30),

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - POSTAL_CODE POSITION(71:85) CHAR(15),

DSNU650I -DSNB 238 07:52:56.56 DSNURWI - COUNTRY POSITION(86:115) CHAR(30))

DSNU304I -DSNB 238 07:52:56.77 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=4 FOR TABLE TSOUB01.LOCATION

DSNU1147I -DSNB 238 07:52:56.77 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=4 FOR TABLESPACE

WWV8301D.TSLOCN

DSNU302I 238 07:52:56.77 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=4

DSNU300I 238 07:52:56.77 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 238 07:52:56.96 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=4

ELAPSED TIME=00:00:00

DSNU349I -DSNB 238 07:52:57.01 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=4 FOR INDEX TSOUB01.IXLOCN1

DSNU258I 238 07:52:57.02 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=1

DSNU259I 238 07:52:57.02 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 238 07:52:57.03 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-50 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 118: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 1c

: LO

AD

util

ity o

utpu

t for

LO

CA

TIO

N ta

ble

- pa

rt 6

of 6

1ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0000

ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1

ICE751I 0 C5-K59562 C6-BASE C7-K58148 C8-K58148 E4-K58148 C9-BASE E5-K59517 E7-K58148

ICE143I 0 BLOCKSET SORT TECHNIQUE SELECTED

ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE

ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 07:52 ON FRI AUG 26, 2011 -

0 SORT FIELDS=(00006.0,00000.4,A,00012.0,00012.0,A,00001.0,00005.0,A),FOR*

MAT=BI,FILSZ=U000000000000004

RECORD TYPE=F,LENGTH=(00023,00023,00023)

OPTION MSGPRT=ALL,MSGDDN=UTPRINT,MAINSIZE=MAX

ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1

ICE751I 0 C5-K59562 C6-BASE C7-K58148 C8-K58148 E4-K58148 C9-BASE E5-K59517 E7-K58148

ICE193I 0 ICEAM2 INVOCATION ENVIRONMENT IN EFFECT - ICEAM2 ENVIRONMENT SELECTED

ICE089I 1 TSOUB011.UTIL .DSNUPROC, INPUT LRECL = 23, TYPE = F

ICE093I 0 MAIN STORAGE = (MAX,6291456,6291456)

ICE156I 0 MAIN STORAGE ABOVE 16MB = (6234096,6234096)

ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=256

ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=RC16 ,MSGDDN=UTPRINT

ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N ,ABCODE=MSG

ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=N,OUTREL=Y,CKPT=N,COBEXIT=COB2

ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=16384,CINV=Y,CFW=Y,DSA=0

ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N

ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=MAX

ICE235I 0 OPTIONS: NULLOUT=RC0

ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=Y

ICE750I 0 DC 0 TC 0 CS DSVVV KSZ 18 VSZ 18

ICE752I 0 FSZ=4 RU IGN=0 C AVG=24 0 WSP=1 U DYN=0 0

ICE751I 1 DE-K58148 D5-K58148 D9-K58148 E8-K58148

ICE091I 0 OUTPUT LRECL = 23, TYPE = F

ICE080I 0 IN MAIN STORAGE SORT

ICE055I 0 INSERT 4, DELETE 4

ICE054I 0 RECORDS - IN: 0, OUT: 0

ICE134I 0 NUMBER OF BYTES SORTED: 92

ICE253I 0 RECORDS SORTED - PROCESSED: 4, EXPECTED: 4

ICE191I 0 DFSORT SVC NOT AVAILABLE - PERFORMANCE MAY BE DEGRADED

ICE165I 0 TOTAL WORK DATA SET TRACKS ALLOCATED: 60 , TRACKS USED: 0

ICE199I 0 MEMORY OBJECT USED AS MAIN STORAGE = 0M BYTES

ICE299I 0 MEMORY OBJECT USED AS WORK STORAGE = 0M BYTES

ICE180I 0 HIPERSPACE STORAGE USED = 0K BYTES

ICE188I 0 DATA SPACE STORAGE USED = 0K BYTES

ICE052I 0 END OF DFSORTxc

lusivo

form

ación

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-51

Page 119: CV8317XSTUD

Student Exercises

.

Load the tables DEPARTMENT and EMPLOYEE (a cycle)

Step 2: Utility control statement for loading DEPARTMENT TSOUB01.CV83.CNTL(L6TSDEPT) - 01.00 Columns 0 ===> Scroll***************************** Top of Data ******************* LOAD DATA ENFORCE NO INTO TABLE DEPARTMENT (DEPTNO POSITION(01:03) CHAR(03) , SUPERIOR_DEPTNO POSITION(05:07) CHAR(03) NULLIF(04)=X'FF', MGRNO POSITION(09:14) CHAR(06) NULLIF(08)=X'FF', NAME POSITION(15) VARCHAR ) **************************** Bottom of Data *****************

The above control statement loads the following input data (length of column NAME stored in (15:16), for example X’001C’ = 28 = length of “SPIFFY COMPUTER SERVICE DIV.”).

TSOUB01.CV83.TSDEPT.DATA ===> ***************************** Top of Data *****----+----1----+----2----+----3----+----4----+--A00 000010 SPIFFY COMPUTER SERVICE DIV. CFFF0000FFFFFF01EDCCCE4CDDDEECD4ECDECCC4CCE4444100F00000000100C279668036474359025959350495B000-----------------------------------------------

Step 3: How does the LOAD utility know when to set MGRNO column value for a row to NULL?

The utility control statement specifies that the MGRNO column value for a row should be set to NULL when byte 8 of the input record contains X'FF'.

Step 4: How does the LOAD utility know the length of the input data for column NAME?

The LOAD utility assumes that the first 2 bytes (15-16) of the input data for column NAME contain the length of the input data.

Step 5: Should the control statement specify ENFORCE CONSTRAINTS or ENFORCE NO?

The control statement should specify ENFORCE NO, because one of the parent tables (EMPLOYEE) has not been loaded yet. Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-52 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 120: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 6

to 8

: LO

AD

util

ity o

utpu

t for

DE

PA

RT

ME

NT

tabl

e -

just

the

DB

2 m

essa

ges

1DSNU000I 239 12:54:03.14 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 239 12:54:03.17 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 239 12:54:03.18 DSNUGUTC - LOAD DATA ENFORCE NO

DSNU650I -DSNB 239 12:54:03.18 DSNURWI - INTO TABLE DEPARTMENT

DSNU650I -DSNB 239 12:54:03.18 DSNURWI - (DEPTNO POSITION(1:3) CHAR(3),

DSNU650I -DSNB 239 12:54:03.18 DSNURWI - SUPERIOR_DEPTNO POSITION(5:7) CHAR(3) NULLIF(4)=X'FF',

DSNU650I -DSNB 239 12:54:03.18 DSNURWI - MGRNO POSITION(9:14) CHAR(6) NULLIF(8)=X'FF',

DSNU650I -DSNB 239 12:54:03.18 DSNURWI - NAME POSITION(15) VARCHAR)

DSNU304I -DSNB 239 12:54:03.32 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=13 FOR TABLE TSOUB01.DEPARTMENT

DSNU1147I -DSNB 239 12:54:03.32 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=13 FOR TABLESPACE

WWV8301D.TSDEPT

DSNU302I 239 12:54:03.32 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=13

DSNU300I 239 12:54:03.32 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 239 12:54:03.33 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=39

ELAPSED TIME=00:00:00

DSNU345I 239 12:54:03.33 DSNURBXD - UNIQUE INDEX KEY DUPLICATES KEY FROM INPUT RECORD

'12' LOADED AT RID X'000000020C',

INDEX = TSOUB01.IXDEPT1,

TABLE = TSOUB01.DEPARTMENT,

RECNO = 13,

RID = X'000000020D'

DSNU349I -DSNB 239 12:54:03.35 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=11 FOR INDEX TSOUB01.IXDEPT1

DSNU349I -DSNB 239 12:54:03.39 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=13 FOR INDEX TSOUB01.IXDEPT2

DSNU349I -DSNB 239 12:54:03.42 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=13 FOR INDEX TSOUB01.IXDEPT3

DSNU258I 239 12:54:03.42 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=3

DSNU343I 239 12:54:03.42 DSNURBXD - BUILD PHASE STATISTICS - 2 DUPLICATE KEY ERRORS ENCOUNTERED

DSNU259I 239 12:54:03.42 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU355I 239 12:54:03.52 DSNURVIX - INDEXVAL PHASE STATISTICS - 2 DUPLICATE KEY ERRORS, KEY EVALUATION ERRORS, XML

ERRORS, OR LOB ERRORS WERE CORRECTED BY DELETING 2 DATA ROWS

DSNU356I 239 12:54:03.52 DSNURVIX - INDEXVAL PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU375I 239 12:54:03.65 DSNURDNP - DISCARD PHASE STATISTICS - 2 INPUT DATA SET RECORDS DISCARDED

DSNU376I 239 12:54:03.66 DSNURDIS - DISCARD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU399I 239 12:54:03.69 DSNURRIS - LOAD UTILITY ERROR SUMMARY REPORT

ERROR SEVERITY :1

INPUT RECORD : 12

DISCARD RECORD : 1

ERROR TYPE : DUP. KEY

RELATED ERROR : 0

TABLE NAME : TSOUB01.DEPARTMENT

FIELD/FANSET NAME: TSOUB01.IXDEPT1

ERROR SEVERITY :1

INPUT RECORD : 13

DISCARD RECORD : 2

ERROR TYPE : DUP. KEY

RELATED ERROR : 12

TABLE NAME : TSOUB01.DEPARTMENT

FIELD/FANSET NAME: TSOUB01.IXDEPT1

DSNU396I 239 12:54:03.69 DSNURREP - REPORT PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU561I -DSNB 239 12:54:03.70 DSNUGSRX - TABLESPACE WWV8301D.TSDEPT PARTITION 1 IS IN CHECK PENDING

DSNU010I 239 12:54:03.72 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-53

Page 121: CV8317XSTUD

Student Exercises

.

Step 8: Questions relating to load of DEPARTMENT table

1. Why were two rows deleted from the INDEXVAL phase?

Input records 12 and 13 are duplicates, since both the records have the same DEPTNO value, causing unique index violation. Therefore, both rows which were inserted before the validation phase are removed.

2. Has table space TSDEPT been placed in a pending state?

Yes, table space TSDEPT is placed in check pending state, as can be seen from the output of the LOAD utility, and also from the DISPLAY DATABASE command:

Steps 9 to 10: -DISPLAY DATABASE command output

-DIS DB(WWV8301D) SPACE(TS*) DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 16142 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSDEPT TS 0001 RW,CHKP TSDEPT TS RW,CHKP TSEMPL TS 0001 RW -THRU 0003 TSEMPL TS RW TSLOCN TS RW TSPROJ TS RW ******* DISPLAY OF DATABASE WWV8301D ENDED ********************** DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-54 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 122: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 11: Utility control card to load table EMPLOYEE

TSOUB01.CV83.CNTL(L6TSEMPL) - 01.00 Columns 00 ===> Scroll ***************************** Top of Data ******************** LOAD DATA INTO TABLE EMPLOYEE (EMPNO POSITION(001:006) CHAR(06) , FIRST_NAME POSITION(007:026) CHAR(20) , MIDDLE_INITIAL POSITION(028:028) CHAR(01) NULLIF(027)=X'FF', SEX POSITION(029:029) CHAR(01) , BIRTHDATE POSITION(031:040) DATE EXTERNAL NULLIF(030)=X'FF', PHONE POSITION(042:045) CHAR(04) NULLIF(041)=X'FF', HIRING_DATE POSITION(047:056) DATE EXTERNAL NULLIF(046)=X'FF', JOB POSITION(058:077) CHAR(20) NULLIF(057)=X'FF', EDUCATION POSITION(078:079) SMALLINT , SALARY POSITION(081:085) DECIMAL NULLIF(080)=X'FF', BONUS POSITION(087:091) DECIMAL NULLIF(086)=X'FF', COMMISSION POSITION(093:097) DECIMAL NULLIF(092)=X'FF', DEPTNO POSITION(099:101) CHAR(003) NULLIF(098)=X'FF', LOCID POSITION(103:112) CHAR(010) NULLIF(102)=X'FF', LAST_NAME POSITION(113) VARCHAR ) **************************** Bottom of Data *******************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-55

Page 123: CV8317XSTUD

Student Exercises

.

Input data for EMPLOYEE

TSOUB01.CV83.TSEMPL.DATA ***************************** Top of Data *********-----------------------------------------------------+----8----+----9----+----0----+----1----+----2-----+----F----+----F----+----F----+----F----+----F-----+----8----+----9----+----0----+----1----+----2------------------------------------------------------ êÍ A00 DE71083-01 HAAS 44444010057000000000002000CFF0CCFFFFF6FF00CCCE44444000000200250C00100C00420C01000457108300104811200000--------------------------------------------------- Ø B01 DE71083-01 THOMPSON 44444010042000008000003000CFF0CCFFFFF6FF00ECDDDEDD4000000200150C00000C00300C02010457108300108386472650

Salary is stored in (81:85), for example for HAAS: X’005275000C’, thus 52750.00

Why can the control statement specify (by default) ENFORCE CONSTRAINTS?

The control statement can specify ENFORCE CONSTRAINTS, because both of EMPLOYEE’s parent tables, LOCATION and DEPARTMENT, have been loaded and the LOAD utility can test for the existence of the primary key values in spite of CHKP on TSDEPT.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-56 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 124: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 1

2 to

14:

LO

AD

util

ity o

utpu

t for

EM

PLO

YE

E ta

ble

- ju

st th

e D

B2

mes

sage

s, p

art 1

of 2

1DSNU000I 239 13:01:37.72 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 239 13:01:37.75 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 239 13:01:37.76 DSNUGUTC - LOAD DATA

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - INTO TABLE EMPLOYEE

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - (EMPNO POSITION(1:6) CHAR(6),

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - FIRST_NAME POSITION(7:26) CHAR(20),

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - MIDDLE_INITIAL POSITION(28:28) CHAR(1) NULLIF(27)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - SEX POSITION(29:29) CHAR(1),

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - BIRTHDATE POSITION(31:40) DATE EXTERNAL NULLIF(30)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - PHONE POSITION(42:45) CHAR(4) NULLIF(41)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - HIRING_DATE POSITION(47:56) DATE EXTERNAL NULLIF(46)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - JOB POSITION(58:77) CHAR(20) NULLIF(57)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - EDUCATION POSITION(78:79) SMALLINT,

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - SALARY POSITION(81:85) DECIMAL NULLIF(80)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - BONUS POSITION(87:91) DECIMAL NULLIF(86)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - COMMISSION POSITION(93:97) DECIMAL NULLIF(92)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - DEPTNO POSITION(99:101) CHAR(3) NULLIF(98)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - LOCID POSITION(103:112) CHAR(10) NULLIF(102)=X'FF',

DSNU650I -DSNB 239 13:01:37.76 DSNURWI - LAST_NAME POSITION(113) VARCHAR)

DSNU310I -DSNB 239 13:01:37.93 DSNURCON - RECORD (8) WILL BE DISCARDED DUE TO 'BIRTHDATE'

CONVERSION ERROR FOR TSOUB01.EMPLOYEE

ERROR CODE '14 - INPUT IS INVALID FOR DATE/TIME'

DSNU353I -DSNB 239 13:01:37.93 DSNURWBF - RECORD (10) WILL BE DISCARDED DUE TO CHECK CONSTRAINT SEX VIOLATION ON TABLE

TSOUB01.EMPLOYEE

DSNU310I -DSNB 239 13:01:37.94 DSNURCON - RECORD (20) WILL BE DISCARDED DUE TO 'SALARY'

CONVERSION ERROR FOR TSOUB01.EMPLOYEE

ERROR CODE '04 - INPUT PACKED DECIMAL IS IN ERROR'

DSNU304I -DSNB 239 13:01:38.00 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=39 FOR TABLE TSOUB01.EMPLOYEE

DSNU1147I -DSNB 239 13:01:38.00 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=39 FOR TABLESPACE

WWV8301D.TSEMPL

DSNU1150I -DSNB 239 13:01:38.00 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS NOT LOADED=3

DSNU302I 239 13:01:38.00 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=42

DSNU300I 239 13:01:38.00 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 239 13:01:38.00 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=117

ELAPSED TIME=00:00:00

DSNU348I -DSNB 239 13:01:38.04 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=16 FOR INDEX TSOUB01.IXEMPL1 PART 1

DSNU348I -DSNB 239 13:01:38.07 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=11 FOR INDEX TSOUB01.IXEMPL1 PART 2

DSNU348I -DSNB 239 13:01:38.10 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=12 FOR INDEX TSOUB01.IXEMPL1 PART 3

DSNU349I -DSNB 239 13:01:38.13 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXEMPL2

DSNU349I -DSNB 239 13:01:38.16 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXEMPL3

DSNU258I 239 13:01:38.17 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=3

DSNU259I 239 13:01:38.17 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU361I -DSNB 239 13:01:38.18 DSNURCRI - FOREIGN KEY HAS NO PRIMARY KEY FOR RELATIONSHIP TSOUB01.EMPLOYEE.DE

INPUT RECORD NUMBER=12, RID=X'000000020A'

DSNU361I -DSNB 239 13:01:38.19 DSNURCRI - FOREIGN KEY HAS NO PRIMARY KEY FOR RELATIONSHIP TSOUB01.EMPLOYEE.DE

INPUT RECORD NUMBER=13, RID=X'000000020B'

DSNU363I -DSNB 239 13:01:38.19 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.EMPLOYEE.DE

FOREIGN KEYS CHECKED=39

CONSTRAINT VIOLATIONS ENCOUNTERED=2

DSNU361I -DSNB 239 13:01:38.19 DSNURCRI - FOREIGN KEY HAS NO PRIMARY KEY FOR RELATIONSHIP TSOUB01.EMPLOYEE.LE

INPUT RECORD NUMBER=34, RID=X'0020000204'

DSNU363I -DSNB 239 13:01:38.19 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.EMPLOYEE.LE

FOREIGN KEYS CHECKED=39

CONSTRAINT VIOLATIONS ENCOUNTERED=1

DSNU367I -DSNB 239 13:01:38.31 DSNURRRI - ENFORCE PHASE STATISTICS - 3 ROWS DELETED FROM TABLE TSOUB01.EMPLOYEE

DSNU369I 239 13:01:38.32 DSNURENF - ENFORCE PHASE COMPLETE, ELAPSED TIME=00:00:00

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-57

Page 125: CV8317XSTUD

Student Exercises

.

Ste

ps 1

2 to

14:

LO

AD

util

ity o

utpu

t for

EM

PLO

YE

E ta

ble

- ju

st th

e D

B2

mes

sage

s, p

art 2

of 2

DSNU375I 239 13:01:38.45 DSNURDNP - DISCARD PHASE STATISTICS - 6 INPUT DATA SET RECORDS DISCARDED

DSNU376I 239 13:01:38.45 DSNURDIS - DISCARD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU399I 239 13:01:38.48 DSNURRIS - LOAD UTILITY ERROR SUMMARY REPORT

ERROR SEVERITY :1

INPUT RECORD : 8

DISCARD RECORD : 1

ERROR TYPE : CONVERSION

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: BIRTHDATE

ERROR SEVERITY :1

INPUT RECORD : 10

DISCARD RECORD : 2

ERROR TYPE : CHK. CONSTR.

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: SEX.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

ERROR SEVERITY :1

INPUT RECORD : 12

DISCARD RECORD : 3

ERROR TYPE : REF. INTEG.

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: DE

ERROR SEVERITY :1

INPUT RECORD : 13

DISCARD RECORD : 4

ERROR TYPE : REF. INTEG.

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: DE

ERROR SEVERITY :1

INPUT RECORD : 20

DISCARD RECORD : 5

ERROR TYPE : CONVERSION

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: SALARY

ERROR SEVERITY :1

INPUT RECORD : 34

DISCARD RECORD : 6

ERROR TYPE : REF. INTEG.

RELATED ERROR : 0

TABLE NAME : TSOUB01.EMPLOYEE

FIELD/FANSET NAME: LE

DSNU396I 239 13:01:38.51 DSNURREP - REPORT PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 239 13:01:38.55 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-58 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 126: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 14: Questions relating to load of EMPLOYEE table

1. Why were three rows discarded during the RELOAD phase?

a. Record number 8 has a value for BIRTHDATE which causes a conversion error.

b. Record number 10 has a value for column SEX which violates the check constraint on the column.

c. Record number 20 has a value for SALARY which causes a conversion error.

2. Why were three rows discarded during the ENFORCE phase?

a. Record number 12 has a value for DEPTNO which does not exist in the DEPARTMENT table and causes an RI violation (relationship DE; see FIELD/FANSET NAME in the job output).

b. Record number 13 has a value for DEPTNO which does not exist in the DEPARTMENT table and causes an RI violation (relationship DE; see FIELD/FANSET NAME in the job output).

c. Record number 34 has a value for LOCID which does not exist in the LOCATION table and causes an RI violation (relationship LE; see FIELD/FANSET NAME in the job output).

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-59

Page 127: CV8317XSTUD

Student Exercises

.

Checking a cycle via CHECK DATA

Step 15: Create exception tables---------+---------+---------+---------+---------+---------+

CREATE TABLESPACE TSEXCEPT IN WWV8301D;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

CREATE TABLE EX_DEPARTMENT

LIKE DEPARTMENT

IN WWV8301D.TSEXCEPT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

COMMIT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_DEPARTMENT

ADD RID CHAR(5);

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_DEPARTMENT

ADD TIME TIMESTAMP NOT NULL WITH DEFAULT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

CREATE TABLE EX_EMPLOYEE

LIKE EMPLOYEE

IN WWV8301D.TSEXCEPT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

COMMIT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-60 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 128: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

ALTER TABLE EX_EMPLOYEE

ADD RID CHAR(5);

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_EMPLOYEE

ADD TIME TIMESTAMP NOT NULL WITH DEFAULT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

CREATE TABLE EX_PROJECT

LIKE PROJECT

IN WWV8301D.TSEXCEPT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

COMMIT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_PROJECT

ADD RID CHAR(5);

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_PROJECT

ADD TIME TIMESTAMP NOT NULL WITH DEFAULT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

CREATE TABLE EX_ON_PROJECT

LIKE ON_PROJECT

IN WWV8301D.TSEXCEPT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

COMMIT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-61

Page 129: CV8317XSTUD

Student Exercises

.

ALTER TABLE EX_ON_PROJECT

ADD RID CHAR(5);

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_ON_PROJECT

ADD TIME TIMESTAMP NOT NULL WITH DEFAULT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

CREATE TABLE EX_ACTIVITY

LIKE ACTIVITY

IN WWV8301D.TSEXCEPT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

COMMIT;

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+

ALTER TABLE EX_ACTIVITY

ADD RID CHAR(5);

---------+---------+---------+---------+---------+---------+

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+----

ALTER TABLE EX_ACTIVITY

ADD TIME TIMESTAMP NOT NULL WITH DEFAULT;

---------+---------+---------+---------+---------+---------+----

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+----

DSNE617I COMMIT PERFORMED, SQLCODE IS 0

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+----

DSNE601I SQL STATEMENTS ASSUMED TO BE BETWEEN COLUMNS 1 AND 72

DSNE620I NUMBER OF SQL STATEMENTS PROCESSED IS 21

DSNE621I NUMBER OF INPUT RECORDS READ IS 62

DSNE622I NUMBER OF OUTPUT RECORDS WRITTEN IS 133

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-62 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 130: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 1

6 to

18:

CH

EC

K D

ATA

util

ity o

utpu

t (D

ELE

TE

NO

) -

just

the

DB

2 m

essa

ges

1DSNU000I 241 01:59:07.22 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 01:59:07.25 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 01:59:07.25 DSNUGUTC - CHECK DATA TABLESPACE WWV8301D.TSDEPT FOR EXCEPTION IN DEPARTMENT USE

EX_DEPARTMENT DELETE NO

DSNU726I -DSNB 241 01:59:07.26 DSNUKINP - SCOPE PENDING IS ACTIVE, BUT THE ENTIRE

TABLE SPACE 'WWV8301D.TSDEPT' MUST BE CHECKED

DSNU730I 241 01:59:07.36 DSNUKDST - CHECKING TABLE TSOUB01.DEPARTMENT

DSNU042I 241 01:59:07.48 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=2

ELAPSED TIME=00:00:00

DSNU733I 241 01:59:07.48 DSNUKERK - ROW (RID=X'000000020A') HAS NO PARENT FOR TSOUB01.DEPARTMENT.ED

DSNU733I 241 01:59:07.48 DSNUKERK - ROW (RID=X'000000020B') HAS NO PARENT FOR TSOUB01.DEPARTMENT.DD

DSNU739I 241 01:59:07.48 DSNUKDAT - CHECK TABLE TSOUB01.DEPARTMENT COMPLETE, ELAPSED TIME=00:00:00

DSNU561I -DSNB 241 01:59:07.49 DSNUGSRX - TABLESPACE WWV8301D.TSDEPT PARTITION 1 IS IN CHECK PENDING

DSNU749I 241 01:59:07.49 DSNUK001 - CHECK DATA COMPLETE,ELAPSED TIME=00:00:00

DSNU010I 241 01:59:07.50 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-63

Page 131: CV8317XSTUD

Student Exercises

.

Step 18: Questions relating to the CHECK DATA utility

1. Has table space TSDEPT remained in check pending status?

Yes, table space TSDEPT has remained in check pending status, as revealed by the output of the CHECK DATA utility. As long as any rows exist in the table which violate either check constraints or RI constraints, the table space remains in check pending status.

2. How many rows has CHECK DATA found to be invalid, and why?

CHECK DATA found two rows to be invalid.

• A row has a value for MGRNO, and EMPNO with this value does not exist in the EMPLOYEE table, causing an RI constraint violation (ROW (RID=X'000000020A') HAS NO PARENT FOR TSOUB01.DEPARTMENT.ED, that is, relationship ED).

• A row has a value for SUPERIOR_DEPTNO, and DEPTNO with this value does not exist in the DEPARTMENT table, causing an RI constraint violation (ROW (RID=X'000000020B') HAS NO PARENT FOR TSOUB01.DEPARTMENT.DD, that is, relationship DD).

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-64 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 132: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 19: Read exception tables---------+---------+---------+---------+---------+---------+---------+ SELECT TIME(TIME) AS TIME, DEPTNO, SUPERIOR_DEPTNO, MGRNO, SUBSTR(NAME, 1, 16) AS NAME, HEX(RID) AS RID FROM EX_DEPARTMENT; ---------+---------+---------+---------+---------+---------+---------+TIME DEPTNO SUPERIOR_DEPTNO MGRNO NAME RID ---------+---------+---------+---------+---------+---------+---------+01.59.07 E31 E01 000101 SOFTWARE SUPP-31 000000020A 01.59.07 E41 X01 000102 SOFTWARE SUPP-41 000000020B DSNE610I NUMBER OF ROWS DISPLAYED IS 2 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+

Remember: Columns RID [CHAR(5)] and TIME [TIMESTAMP] are additional columns.

CHECK DATA job output (see above) indicates that:

1. Row with RID ’...020A’ has no parent for relation ED. Hence, we can conclude that MGRNO value ’000101’ has no parent value in column EMPNO of table EMPLOYEE.

2. Row with RID ’...020B’ has no parent for relation DD. Hence, we can conclude that SUPERIOR_DEPTNO value ’X01’ has no parent value in column DEPTNO of table DEPARTMENT.

---------+---------+---------+---------+---------+---------+---------+ SELECT TIME(TIME) AS TIME, EMPNO, DEPTNO, SUBSTR(FIRST_NAME, 1, 10) AS FIRST_NAME, SUBSTR(LAST_NAME, 1, 10) AS LAST_NAME, SUBSTR(JOB, 1, 10) AS JOB, HEX(RID) AS RID FROM EX_EMPLOYEE; ---------+---------+---------+---------+---------+---------+---------+TIME EMPNO DEPTNO FIRST_NAME LAST_NAME JOB RID ---------+---------+---------+---------+---------+---------+---------+DSNE610I NUMBER OF ROWS DISPLAYED IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+

Step 20: CHECK DATA utility control card (DELETE YES)***************************** Top of Data ******CHECK DATA TABLESPACE WWV8301D.TSDEPT FOR EXCEPTION IN DEPARTMENT USE EX_DEPARTMENT IN EMPLOYEE USE EX_EMPLOYEE IN PROJECT USE EX_PROJECT IN ON_PROJECT USE EX_ON_PROJECT IN ACTIVITY USE EX_ACTIVITY DELETE YES **************************** Bottom of Data ****

Remark: Table LOCATION is not involved, as LOCATION is neither dependent on nor descendent from DEPARTMENT.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-65

Page 133: CV8317XSTUD

Student Exercises

.

Ste

p 21

: CH

EC

K D

ATA

util

ity o

utpu

t (D

ELE

TE

YE

S)

1DSNU000I 241 02:11:44.27 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 02:11:44.29 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 02:11:44.30 DSNUGUTC - CHECK DATA TABLESPACE WWV8301D.TSDEPT FOR EXCEPTION IN DEPARTMENT USE

EX_DEPARTMENT IN EMPLOYEE USE EX_EMPLOYEE IN PROJECT USE EX_PROJECT IN ON_PROJECT USE EX_ON_PROJECT IN ACTIVITY USE

EX_ACTIVITY DELETE YES

DSNU726I -DSNB 241 02:11:44.30 DSNUKINP - SCOPE PENDING IS ACTIVE, BUT THE ENTIRE

TABLE SPACE 'WWV8301D.TSDEPT' MUST BE CHECKED

DSNU730I 241 02:11:44.51 DSNUKDST - CHECKING TABLE TSOUB01.DEPARTMENT

DSNU042I 241 02:11:44.56 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=2

ELAPSED TIME=00:00:00

DSNU733I 241 02:11:44.56 DSNUKERK - ROW (RID=X'000000020A') HAS NO PARENT FOR TSOUB01.DEPARTMENT.ED

DSNU733I 241 02:11:44.56 DSNUKERK - ROW (RID=X'000000020B') HAS NO PARENT FOR TSOUB01.DEPARTMENT.DD

DSNU739I 241 02:11:44.56 DSNUKDAT - CHECK TABLE TSOUB01.DEPARTMENT COMPLETE, ELAPSED TIME=00:00:00

DSNU741I -DSNB 241 02:11:44.60 DSNUKRDY - 2 ROWS DELETED FROM TABLE TSOUB01.DEPARTMENT

DSNU741I -DSNB 241 02:11:44.60 DSNUKRDY - 4 ROWS DELETED FROM TABLE TSOUB01.EMPLOYEE

DSNU749I 241 02:11:44.61 DSNUK001 - CHECK DATA COMPLETE,ELAPSED TIME=00:00:00

DSNU010I 241 02:11:44.61 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-66 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 134: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 22: Verify table space TSDEPT is no longer in check pending-DIS DB(WWV8301D) SPACE(TS*) DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 20180 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSDEPT TS 0001 RW TSDEPT TS RW TSEMPL TS 0001 RW -THRU 0003 TSEMPL TS RW TSEXCEPT TS RW,AREO* TSLOCN TS RW TSPROJ TS RW ******* DISPLAY OF DATABASE WWV8301D ENDED ********************** DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

As can be seen from the DISPLAY DATABASE command output, table space TSDEPT is no longer in check pending state.

Table space TSEXCEPT is in advisory REORG-pending (AREO*) state. This means there are no restrictions to access the data in this table space. However, there may be an impact on performance until this table space is reorganized. For now, you can ignore this.

Question relating to the CHECK DATA utility:

How many rows has CHECK DATA deleted from table DEPARTMENT, and why?

Two rows have been deleted by the CHECK DATA utility:

• The DEPARTMENT row with a DEPTNO column value of E31 has been deleted because it had an invalid MGRNO column value (000101), that is, the foreign key value violated referential constraint 'ED'.

• The DEPARTMENT row with a DEPTNO column value of E41 has been deleted because it had an invalid SUPERIOR_DEPTNO column value (X01), that is, the foreign key value violated referential constraint 'DD'.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-67

Page 135: CV8317XSTUD

Student Exercises

.

Step 23: Read exception tables

---------+---------+---------+---------+---------+---------+---------+ SELECT TIME(TIME) AS TIME, DEPTNO, SUPERIOR_DEPTNO, MGRNO, SUBSTR(NAME, 1, 16) AS NAME, HEX(RID) AS RID FROM EX_DEPARTMENT; ---------+---------+---------+---------+---------+---------+---------+TIME DEPTNO SUPERIOR_DEPTNO MGRNO NAME RID ---------+---------+---------+---------+---------+---------+---------+01.59.07 E31 E01 000101 SOFTWARE SUPP-31 000000020A 01.59.07 E41 X01 000102 SOFTWARE SUPP-41 000000020B 02.11.44 E31 E01 000101 SOFTWARE SUPP-31 000000020A 02.11.44 E41 X01 000102 SOFTWARE SUPP-41 000000020B DSNE610I NUMBER OF ROWS DISPLAYED IS 4 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+ The first two rows were inserted when the optional steps 16 and 17 were executed (CHECK DATA utility with DELETE NO) and the last two rows were inserted because of executing CHECK DATA utility with DELETE YES. ---------+---------+---------+---------+---------+---------+---------+- SELECT TIME(TIME) AS TIME, EMPNO, DEPTNO, SUBSTR(FIRST_NAME, 1, 10) AS FIRST_NAME, SUBSTR(LAST_NAME, 1, 10) AS LAST_NAME, SUBSTR(JOB, 1, 10) AS JOB, HEX(RID) AS RID FROM EX_EMPLOYEE; ---------+---------+---------+---------+---------+---------+---------+-TIME EMPNO DEPTNO FIRST_NAME LAST_NAME JOB RID ---------+---------+---------+---------+---------+---------+---------+-02.11.44 000221 E31 BEN JONES DESIGNER 0010000208 02.11.44 000222 E31 KATE JONES DESIGNER 0010000209 02.11.44 000223 E31 GRACE JONES DESIGNER 001000020A 02.11.44 000102 E41 SALLY JONES MANAGER 0000000209 DSNE610I NUMBER OF ROWS DISPLAYED IS 4 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+-

All the four rows were inserted because of executing CHECK DATA utility with DELETE YES.

The deletion of the parent row with a DEPTNO column value of E31 from DEPARTMENT table caused three dependent rows in the EMPLOYEE table to be deleted.

The deletion of the parent row with a DEPTNO column value of E41 from DEPARTMENT table caused one dependent row in the EMPLOYEE table to be deleted. Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-68 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 136: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 2

4 to

27:

LO

AD

util

ity o

utpu

t for

PR

OJE

CT

tabl

e

1DSNU000I 241 02:33:44.34 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 02:33:44.36 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 02:33:44.37 DSNUGUTC - LOAD DATA REPLACE STATISTICS

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - INTO TABLE PROJECT

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - (PROJNO POSITION(1:6) CHAR(6),

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - DEPTNO POSITION(7:9) CHAR(3),

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - EMPNO POSITION(10:15) CHAR(6),

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - STAFFING POSITION(17:19) DECIMAL NULLIF(16)=X'FF',

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - START_DATE POSITION(21:30) DATE EXTERNAL NULLIF(20)=X'FF',

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - END_DATE POSITION(32:41) DATE EXTERNAL NULLIF(31)=X'FF',

DSNU650I -DSNB 241 02:33:44.37 DSNURWI - NAME POSITION(42) VARCHAR)

DSNU350I -DSNB 241 02:33:45.30 DSNURRST - EXISTING RECORDS DELETED FROM TABLESPACE

DSNU304I -DSNB 241 02:33:45.35 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=290 FOR TABLE TSOUB01.PROJECT

DSNU1147I -DSNB 241 02:33:45.35 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=290 FOR TABLESPACE

WWV8301D.TSPROJ

DSNU302I 241 02:33:45.36 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=290

DSNU300I 241 02:33:45.36 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 241 02:33:45.36 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=870

ELAPSED TIME=00:00:00

DSNU349I -DSNB 241 02:33:45.40 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ1

DSNU349I -DSNB 241 02:33:45.43 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ2

DSNU349I -DSNB 241 02:33:45.46 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ3

DSNU258I 241 02:33:45.47 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=3

DSNU259I 241 02:33:45.47 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU610I -DSNB 241 02:33:45.50 DSNUSUTP - SYSTABLEPART CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

DSNU610I -DSNB 241 02:33:45.50 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.PROJECT SUCCESSFUL

DSNU610I -DSNB 241 02:33:45.50 DSNUSUTS - SYSTABLESPACE CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

DSNU620I -DSNB 241 02:33:45.50 DSNUSEF2 - RUNSTATS CATALOG TIMESTAMP = 2011-08-29-02.33.45.306533

DSNU363I -DSNB 241 02:33:45.51 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.PROJECT.DP

FOREIGN KEYS CHECKED=290

CONSTRAINT VIOLATIONS ENCOUNTERED=0

DSNU363I -DSNB 241 02:33:45.51 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.PROJECT.EP

FOREIGN KEYS CHECKED=290

CONSTRAINT VIOLATIONS ENCOUNTERED=0

DSNU369I 241 02:33:45.52 DSNURENF - ENFORCE PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 241 02:33:45.52 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Question: What is the purpose of using the keyword STATISTICS in the LOAD utility control statement when loading the PROJECT

table?

Answer - To gather inline statistics. This eliminates the need for RUNSTATS after LOAD

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-69

Page 137: CV8317XSTUD

Student Exercises

.

Ste

ps 2

8 to

30:

LO

AD

util

ity o

utpu

t for

ON

_PR

OJE

CT

and

AC

TIV

ITY

tabl

es (

RE

SU

ME

NO

by

defa

ult)

1DSNU000I 241 02:38:44.01 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 02:38:44.04 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 02:38:44.04 DSNUGUTC - LOAD DATA

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - INTO TABLE ON_PROJECT WHEN(1:1='O')

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - (PROJNO POSITION(2:7) CHAR(6),

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - EMPNO POSITION(8:13) CHAR(6))

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - INTO TABLE ACTIVITY WHEN(1:1='A')

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - (PROJNO POSITION(2:7) CHAR(6),

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - EMPNO POSITION(8:13) CHAR(6),

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - SEQNO POSITION(14:15) SMALLINT,

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - CODE POSITION(16:17) SMALLINT,

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - TIME_SPENT POSITION(19:21) DECIMAL NULLIF(18)=X'FF',

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - START_DATE POSITION(23:32) DATE EXTERNAL NULLIF(22)=X'FF',

DSNU650I -DSNB 241 02:38:44.05 DSNURWI - END_DATE POSITION(34:43) DATE EXTERNAL NULLIF(33)=X'FF')

DSNU330I -DSNB 241 02:38:44.09 DSNURWI - TABLESPACE IS NOT EMPTY

DSNU012I 241 02:38:44.10 DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-70 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 138: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 31: Why did the load of ON_PROJECT and ACTIVITY fail?

The utility control statement specified (by default) RESUME NO, which means that the utility assumes that the table space is empty. If the table space is not empty and the control statement does not specify REPLACE, the utility terminates with return code 8.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-71

Page 139: CV8317XSTUD

Student Exercises

.

Ste

ps 3

1 to

33:

LO

AD

util

ity o

utpu

t for

ON

_PR

OJE

CT

and

AC

TIV

ITY

tabl

es (

RE

SU

ME

YE

S)

1DSNU000I 241 02:42:32.53 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 02:42:32.55 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 02:42:32.56 DSNUGUTC - LOAD DATA RESUME YES

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - INTO TABLE ON_PROJECT WHEN(1:1='O')

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - (PROJNO POSITION(2:7) CHAR(6),

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - EMPNO POSITION(8:13) CHAR(6))

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - INTO TABLE ACTIVITY WHEN(1:1='A')

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - (PROJNO POSITION(2:7) CHAR(6),

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - EMPNO POSITION(8:13) CHAR(6),

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - SEQNO POSITION(14:15) SMALLINT,

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - CODE POSITION(16:17) SMALLINT,

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - TIME_SPENT POSITION(19:21) DECIMAL NULLIF(18)=X'FF',

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - START_DATE POSITION(23:32) DATE EXTERNAL NULLIF(22)=X'FF',

DSNU650I -DSNB 241 02:42:32.56 DSNURWI - END_DATE POSITION(34:43) DATE EXTERNAL NULLIF(33)=X'FF')

DSNU304I -DSNB 241 02:42:32.66 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=39 FOR TABLE TSOUB01.ON_PROJECT

DSNU304I -DSNB 241 02:42:32.66 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=74 FOR TABLE TSOUB01.ACTIVITY

DSNU1147I -DSNB 241 02:42:32.66 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=113 FOR TABLESPACE

WWV8301D.TSPROJ

DSNU302I 241 02:42:32.66 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=113

DSNU300I 241 02:42:32.66 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 241 02:42:32.67 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=339

ELAPSED TIME=00:00:00

DSNU349I -DSNB 241 02:42:32.70 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXONPR1

DSNU349I -DSNB 241 02:42:32.74 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=74 FOR INDEX TSOUB01.IXACTY1

DSNU349I -DSNB 241 02:42:32.77 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=74 FOR INDEX TSOUB01.IXACTY2

DSNU349I -DSNB 241 02:42:32.80 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXONPR2

DSNU258I 241 02:42:32.80 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=4

DSNU259I 241 02:42:32.80 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU363I -DSNB 241 02:42:32.84 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.ON_PROJECT.EO

FOREIGN KEYS CHECKED=39

CONSTRAINT VIOLATIONS ENCOUNTERED=0

DSNU363I -DSNB 241 02:42:32.84 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.ON_PROJECT.PO

FOREIGN KEYS CHECKED=39

CONSTRAINT VIOLATIONS ENCOUNTERED=0

DSNU363I -DSNB 241 02:42:32.84 DSNURCRI - ENFORCE PHASE STATISTICS -

RELATIONSHIP TSOUB01.ACTIVITY.OA

FOREIGN KEYS CHECKED=74

CONSTRAINT VIOLATIONS ENCOUNTERED=0

DSNU369I 241 02:42:32.85 DSNURENF - ENFORCE PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 241 02:42:32.86 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-72 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 140: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 33: Questions relating to load of ON_PROJECT and ACTIVITY tables

a. Can the REPLACE option of the LOAD utility be used to replace the existing data for the ON_PROJECT and ACTIVITY tables while preserving the data for the PROJECT table?

No, the REPLACE option applies to all data in a table space or partition.

b. How was the use of REPLACE option appropriate when the PROJECT table data was loaded?

The REPLACE option was appropriate because the table space was empty. The reason for using the REPLACE option is that, in conjunction with STATISTICS, statistics are gathered in the catalog tables, including the real-time statistics tables.

c. Assuming you have reset the ACTIVITY table, can you repeat steps 28 to 30 to load the ON_PROJECT and ACTIVITY tables?

You cannot do this unless you get rid of the data from ON_PROJECT table first by issuing a mass DELETE statement DELETE FROM ON_PROJECT. Of course you can do a LOAD RESUME YES of only the ACTIVITY table and there is no need to get rid of the data from ON_PROJECT table.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-73

Page 141: CV8317XSTUD

Student Exercises

.

Step 34: Create partition by growth universal table space CREATE TABLESPACE TSNEWDEP IN WWV8301D DSSIZE 1 G MAXPARTITIONS 5 FREEPAGE 1 PCTFREE 99; ---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+CREATE TABLE NEWDEPT LIKE DEPARTMENT IN WWV8301D.TSNEWDEP; ---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

Step 35: Gather information from catalog tablesSELECT SUBSTR(NAME,1,10) AS NAME, SUBSTR(CREATOR,1,15) AS CREATOR, SUBSTR(DBNAME,1,15) AS DBNAME, TYPE,MAXPARTITIONS FROM SYSIBM.SYSTABLESPACE WHERE NAME = 'TSNEWDEP' AND CREATOR=USER WITH UR ;---------+---------+---------+---------+---------+---------+------NAME CREATOR DBNAME TYPE MAXPARTITIONS ---------+---------+---------+---------+---------+---------+------TSNEWDEP TSOUB01 WWV8301D G 5 DSNE610I NUMBER OF ROWS DISPLAYED IS 1 SELECT PARTITION, SUBSTR(TSNAME,1,15) AS TSNAME, SUBSTR(DBNAME,1,15) AS DBNAME FROM SYSIBM.SYSTABLEPART WHERE TSNAME = 'TSNEWDEP' AND DBNAME='WWV8301D'WITH UR ;---------+---------+---------+---------+---------+----PARTITION TSNAME DBNAME ---------+---------+---------+---------+---------+---- 1 TSNEWDEP WWV8301D DSNE610I NUMBER OF ROWS DISPLAYED IS 1

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-74 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 142: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 36: How many partitions are created?

Notice TYPE is ‘G’ in SYSIBM.SYSTABLESPACE and PARTITION is 1 in SYSIBM.SYSTABLEPART indicating a partition by growth universal table space with one partition has been created.

ISPF 3.4 confirms this:

DBDSNB.DSNBBC.WWV8301D.TSNEWDEP.I0001.A001 DBDSNB.DSNBBD.WWV8301D.TSNEWDEP.I0001.A001

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-75

Page 143: CV8317XSTUD

Student Exercises

.

Ste

p 37

: LO

AD

tabl

e sp

ace

TS

NE

WD

EP

1DSNU000I 241 03:00:17.95 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 03:00:17.98 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 03:00:17.98 DSNUGUTC - LOAD DATA LOG NO

DSNU650I -DSNB 241 03:00:17.98 DSNURWI - INTO TABLE NEWDEPT

DSNU650I -DSNB 241 03:00:17.98 DSNURWI - (DEPTNO POSITION(1:3) CHAR(3),

DSNU650I -DSNB 241 03:00:17.98 DSNURWI - SUPERIOR_DEPTNO POSITION(5:7) CHAR(3) NULLIF(4)=X'FF',

DSNU650I -DSNB 241 03:00:17.98 DSNURWI - MGRNO POSITION(9:14) CHAR(6) NULLIF(8)=X'FF',

DSNU650I -DSNB 241 03:00:17.98 DSNURWI - NAME POSITION(15) VARCHAR)

DSNU304I -DSNB 241 03:00:38.06 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=150003 FOR TABLE

TSOUB01.NEWDEPT

DSNU1147I -DSNB 241 03:00:38.06 DSNURWT - (RE)LOAD PHASE STATISTICS - TOTAL NUMBER OF RECORDS LOADED=150003 FOR

TABLESPACE WWV8301D.TSNEWDEP

DSNU302I 241 03:00:38.06 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=150003

DSNU300I 241 03:00:38.06 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:20

DSNU380I -DSNB 241 03:00:38.06 DSNUGSRX - TABLESPACE WWV8301D.TSNEWDEP PARTITION 1 IS IN COPY PENDING

DSNU380I -DSNB 241 03:00:38.06 DSNUGSRX - TABLESPACE WWV8301D.TSNEWDEP PARTITION 2 IS IN COPY PENDING

DSNU010I 241 03:00:38.06 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-76 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 144: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 38: How many partitions do you see after the LOAD utility completes?

Note we started with one partition and after successful completion of LOAD utility, two partitions are placed in copy pending (because of LOG NO).

ISPF 3.4 confirms the partition by growth universal table space has now grown to 2 partitions:

DBDSNB.DSNBBC.WWV8301D.TSNEWDEP.I0001.A001 DBDSNB.DSNBBC.WWV8301D.TSNEWDEP.I0001.A002 DBDSNB.DSNBBD.WWV8301D.TSNEWDEP.I0001.A001 DBDSNB.DSNBBD.WWV8301D.TSNEWDEP.I0001.A002

Step 39: Drop the partition by growth universal table spaceDROP TABLESPACE WWV8301D.TSNEWDEP; DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-77

Page 145: CV8317XSTUD

Student Exercises

.

Step 40: UNLOAD table space TSPROJ TSOUB01.DSNUUNL.CNTL Columns 00001 00072

//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=TSOUB01,REGION=0M //* //* //UTIL EXEC DSNBUPRC,SYSTEM=DSNB,UID='TSOUB01',UTPROC='' //* //********************************************** //* //* GENERATING JCL FOR THE UNLOAD UTILITY //* DATE: 08/29/11 TIME: 03:26:31 //* //********************************************** //* //DSNUPROC.SYSREC DD DSN=TSOUB01.CV83.TSPROJ.UNLOAD.DATA, // DISP=(MOD,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSPUNCH DD DSN=TSOUB01.CV83.TSPROJ.UNLOAD.PUNCH,// DISP=(MOD,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSIN DD * UNLOAD TABLESPACE WWV8301D.TSPROJ //

Job output: 1DSNU000I 241 03:26:38.92 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01 DSNU1044I 241 03:26:38.95 DSNUGTIS - PROCESSING SYSIN AS EBCDIC0DSNU050I 241 03:26:38.95 DSNUGUTC - UNLOAD TABLESPACE WWV8301D.TSPROJ DSNU253I 241 03:26:38.99 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=290 FOR TABLE TSOUB01.PROJECT DSNU253I 241 03:26:38.99 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=39 FOR TABLE TSOUB01.ON_PROJECT DSNU253I 241 03:26:38.99 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=74 FOR TABLE TSOUB01.ACTIVITY DSNU252I 241 03:26:38.99 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=403 FOR TABLESPACE WWV8301D.TSPROJ DSNU250I 241 03:26:38.99 DSNUUNLD - UNLOAD PHASE COMPLETE, ELAPSED TIME=00:00:00 DSNU010I 241 03:26:39.00 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-78 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 146: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Generated LOAD statement:

TSOUB01.CV83.TSPROJ.UNLOAD.PUNCH Columns 00001 00072 ===> Scroll ===> CSR LOAD DATA INDDN SYSREC LOG NO RESUME YES EBCDIC CCSID(00037,00000,00000) INTO TABLE "TSOUB01"."PROJECT" WHEN(00001:00002) = X'000B' NUMRECS 290 ( "PROJNO" POSITION( 00003:00008) CHAR(00006) , "DEPTNO" POSITION( 00009:00011) CHAR(00003) , "EMPNO" POSITION( 00012:00017) CHAR(00006) , "STAFFING" POSITION( 00019:00021) DECIMAL NULLIF(00018)=X'FF' , "START_DATE" POSITION( 00023:00032) DATE EXTERNAL NULLIF(00022)=X'FF' , "END_DATE" POSITION( 00034:00043) DATE EXTERNAL NULLIF(00033)=X'FF' , "NAME" POSITION( 00044:00095) VARCHAR ) INTO TABLE "TSOUB01"."ON_PROJECT" WHEN(00001:00002) = X'000C' NUMRECS 39 ( "PROJNO" POSITION( 00003:00008) CHAR(00006) , "EMPNO" POSITION( 00009:00014) CHAR(00006) ) INTO TABLE "TSOUB01"."ACTIVITY" WHEN(00001:00002) = X'000D' NUMRECS 74 ( "PROJNO" POSITION( 00003:00008) CHAR(00006) , "EMPNO" POSITION( 00009:00014) CHAR(00006) , "SEQNO" POSITION( 00015:00016) SMALLINT , "CODE" POSITION( 00017:00018) SMALLINT , "TIME_SPENT" POSITION( 00020:00022) DECIMAL NULLIF(00019)=X'FF', "START_DATE" POSITION( 00024:00033) DATE EXTERNAL NULLIF(00023)=X'FF' , "END_DATE" POSITION( 00035:00044) DATE EXTERNAL NULLIF(00034)=X'FF' )

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-79

Page 147: CV8317XSTUD

Student Exercises

.

Ste

p 40

: UN

LOA

Ded

dat

a (t

able

spa

ce T

SP

RO

J w

ith 3

tabl

es)

BROWSE TSOUB01.CV83.TSPROJ.UNLOAD.DATA Line 00000000 Col 001 080

Command ===> Scroll ===> CSR

******************************** Top of Data **********************************

..AD3100D01000010..Á..1982-01-01.1983-02-01..ADMIN SERVICES

..MA2100D01000010.....1982-01-01.1983-02-01..WELD LINE AUTOMATION

..PL2100B01000020.....1982-01-01.1982-09-15..WELD LINE PLANNING ...

...etc

...

..AD3100000010

..MA2100000010

..MA2110000010

..PL2100000020

...

...etc

...

..AD3100000010.........1982-01-01.1982-07-01

..AD3110000070.........1982-01-01.1983-02-01

..AD3111000230.........1982-01-01.1982-03-15

..AD3111000230.........1982-03-15.1982-04-15

...

...etc

...

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-80 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 148: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 40

: UN

LOA

Ded

dat

a in

hex

EDIT TSOUB01.CV83.TSPROJ.UNLOAD.DATA Columns 00001 00072

Command ===> hex on Scroll ===> CSR

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--

****** ***************************** Top of Data ******************************

------------------------------------------------------------------------------

000001 AD3100D01000010 Á 01/01/1982 02/01/1983 ADMIN SERVICES

00CCFFFFCFFFFFFFF00600FF4FF4FFFF0FF4FF4FFFF00CCDCD4ECDECCCE4444444444444

0B143100401000010005C001B01B1982001B02B19830E144950259593520000000000000

------------------------------------------------------------------------------

000002 MA2100D01000010 01/01/1982 02/01/1983 WELD LINE AUTOMATION

00DCFFFFCFFFFFFFF00200FF4FF4FFFF0FF4FF4FFFF01ECDC4DCDC4CEEDDCECDD4444444

0B412100401000010010C001B01B1982001B02B198304653403955014364139650000000

------------------------------------------------------------------------------

000003 PL2100B01000020 01/01/1982 09/15/1982 WELD LINE PLANNING

00DDFFFFCFFFFFFFF00100FF4FF4FFFF0FF4FF4FFFF01ECDC4DCDC4DDCDDCDC444444444

0B732100201000020000C001B01B1982015B09B198202653403955073155957000000000

------------------------------------------------------------------------------

Remark:

If you set hex on, you see the that OBID of the table is unloaded first:

here 000B for PROJECT

(similar: 000C for ON_PROJECT, 000D for ACTIVITY)

This explains the WHEN options in the previous control statement.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-81

Page 149: CV8317XSTUD

Student Exercises

.

Step 41: UNLOAD DELIMITED

If you try to unload the whole tablespace, the UNLOAD fails with the message:

********************************* TOP OF DATA **********************************1DSNU000I 241 05:16:28.97 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUDB01 DSNU1044I 241 05:16:29.00 DSNUGTIS - PROCESSING SYSIN AS EBCDIC0DSNU050I 241 05:16:29.00 DSNUGUTC - UNLOAD TABLESPACE WWV8301D.TSPROJ DELIMITED DSNU1254I -DSNB 241 05:16:29.00 DSNUULIA - FORMAT DELIMITED REQUIRES ONE AND ONLY ONE FROM TABLE DSNU012I 241 05:16:29.01 DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8******************************** BOTTOM OF DATA ********************************

Therefore, unload table PROJECT only.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-82 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 150: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 41

: Unl

oad

PR

OJE

CT

tabl

e in

del

imite

d fo

rmat

(jo

b ou

tput

)

1DSNU000I 241 05:27:12.92 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUDB01

DSNU1044I 241 05:27:12.95 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 05:27:12.95 DSNUGUTC - UNLOAD TABLESPACE WWV8301D.TSPROJ DELIMITED

DSNU650I -DSNB 241 05:27:12.95 DSNUUGMS - FROM TABLE PROJECT

DSNU253I 241 05:27:12.97 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=290 FOR TABLE

TSOUB01.PROJECT

DSNU252I 241 05:27:12.97 DSNUUNLD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=290 FOR TABLESPACE

WWV8301D.TSPROJ

DSNU250I 241 05:27:12.97 DSNUUNLD - UNLOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 241 05:27:12.98 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-83

Page 151: CV8317XSTUD

Student Exercises

.

Ste

p 41

: PR

OJE

CT

tabl

e da

ta u

nloa

ded

in d

elim

ited

form

at b

y U

NLO

AD

util

ity

"AD3100","D01","000010",6.50,1982-01-01,1983-02-01,"ADMIN SERVICES"

"MA2100","D01","000010",12.00,1982-01-01,1983-02-01,"WELD LINE AUTOMATION"

"PL2100","B01","000020",1.00,1982-01-01,1982-09-15,"WELD LINE PLANNING"

..........................................................................

..........................................................................

..........................................................................

"PL2240","B01","000020",1.00,1982-01-01,1982-09-15,"WELD LINE PLANNING"

"IF1000","C01","000030",2.00,1982-01-01,1983-02-01,"QUERY SERVICES"

"IF2000","C01","000030",1.00,1982-01-01,1983-02-01,"USER EDUCATION"

"OP1000","E01","000050",6.00,1982-01-01,1983-02-01,"OPERATION SUPPORT"

"OP2000","E01","000050",5.00,1982-01-01,1983-02-01,"GEN SYSTEMS SERVICES"

"MA2110","D11","000060",9.00,1982-01-01,1983-02-01,"W L PROGRAMMING"

..........................................................................

..........................................................................

..........................................................................

"MA2163","D11","000060",9.00,1982-01-01,1983-02-01,"W L PROGRAMMING"

"AD3110","D21","000070",6.00,1982-01-01,1983-02-01,"GENERAL AD SYSTEMS"

"OP1010","E11","000090",5.00,1982-01-01,1983-02-01,"OPERATION"

"OP2010","E21","000100",4.00,1982-01-01,1983-02-01,"SYSTEMS SUPPORT"

..........................................................................

..........................................................................

..........................................................................

"OP2063","E21","000100",4.00,1982-01-01,1983-02-01,"SYSTEMS SUPPORT"

"MA2112","D11","000150",3.00,1982-01-01,1982-12-01,"W L ROBOT DESIGN"

"MA2113","D11","000160",3.00,1982-02-15,1982-12-01,"W L PROD CONT PROGS"

"MA2111","D11","000220",2.00,1982-01-01,1982-12-01,"W L PROGRAM DESIGN"

"AD3111","D21","000230",2.00,1982-01-01,1983-02-01,"PAYROLL PROGRAMMING"

"AD3112","D21","000250",1.00,1982-01-01,1983-02-01,"PERSONNEL PROGRAMMG"

"AD3113","D21","000270",2.00,1982-01-01,1983-02-01,"ACCOUNT.PROGRAMMING"

..........................................................................

..........................................................................

..........................................................................

"AD3230","D21","000270",2.00,1982-01-01,1983-02-01,"ACCOUNT.PROGRAMMING"

"OP2011","E21","000320",1.00,1982-01-01,1983-02-01,"SCP SYSTEMS SUPPORT"

"OP2012","E21","000330",1.00,1982-01-01,1983-02-01,"APPLICATIONS SUPPORT"

"OP2013","E21","000340",1.00,1982-01-01,1983-02-01,"DB/DC SUPPORT"

Note: With delimited, the OBID is not unloaded at the beginning of the record.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-84 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 152: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 41

: LO

AD

util

ity c

ontr

ol s

tate

men

t gen

erat

ed b

y U

NLO

AD

util

ity

LOAD DATA INDDN SYSREC LOG NO RESUME YES

EBCDIC CCSID(00037,00000,00000)

FORMAT DELIMITED COLDEL X'6B' CHARDEL X'7F' DECPT X'4B'

INTO TABLE

"TSOUB01".

"PROJECT"

NUMRECS 290

( "PROJNO"

POSITION(*) CHAR(00006)

, "DEPTNO"

POSITION(*) CHAR(00003)

, "EMPNO"

POSITION(*) CHAR(00006)

, "STAFFING"

POSITION(*) DECIMAL

, "START_DATE"

POSITION(*) DATE EXTERNAL

, "END_DATE"

POSITION(*) DATE EXTERNAL

, "NAME"

POSITION(*) VARCHAR

)

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-85

Page 153: CV8317XSTUD

Student Exercises

.

Step 42: Unloading from a view via DSNTIAUL

Step 42a: Creating a view to unload from:---------+---------+---------+---------+---------+---------+ CREATE VIEW VDEPMGR AS (SELECT E1.EMPNO, SUBSTR(E1.LAST_NAME,1,10) AS LAST_NAME, E1.DEPTNO, D.MGRNO, SUBSTR(E2.LAST_NAME,1,10) AS MGRNAME FROM EMPLOYEE E1 INNER JOIN DEPARTMENT D ON E1.DEPTNO = D.DEPTNO INNER JOIN EMPLOYEE E2 ON D.MGRNO = E2.EMPNO) ; ---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+

View result:

---------+---------+---------+---------+----- SELECT * FROM VDEPMGR ; ---------+---------+---------+---------+-----EMPNO LAST_NAME DEPTNO MGRNO MGRNAME ---------+---------+---------+---------+-----000010 HAAS A00 000010 HAAS 000110 LUCCHESI A00 000010 HAAS 000120 O'CONNELL A00 000010 HAAS 000020 THOMPSON B01 000020 THOMPSON 000130 QUINTANA C01 000030 KWAN 000140 NICHOLLS C01 000030 KWAN

... and so on.

000320 MEHTA E21 000100 SPENSER000330 LEE E21 000100 SPENSER000340 GOUNOT E21 000100 SPENSER DSNE610I NUMBER OF ROWS DISPLAYED IS 32 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+Exc

lusivo

form

ación

proy

ecto

C.F.T.I.C

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

A-86 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 154: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 42b: DSNTIAUL job

TSOUB01.CV83.CNTL(L6TIAUL) - 01.02 ===> ***************************** Top of Data ***********************//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID,REGION=0M //*******************************************************************//* *//*******************************************************************//DSNTIAUL EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DSN=DBDSNB.DB2A10.SDSNEXIT,DISP=SHR // DD DSN=DBDSNB.DB2A10.SDSNLOAD,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DSNB) RUN PROGRAM(DSNTIAUL) PLAN(DSNTIB10) PARMS('SQL,10') - LIB('DBDSNB.DB2A10.RUNLIB.LOAD') //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSREC00 DD DSN=&SYSUID..CV83.DSNTIAUL.SELECT00, // UNIT=SYSDA,SPACE=(32760,(20,20)),DISP=(,CATLG)//SYSREC01 DD DSN=&SYSUID..CV83.DSNTIAUL.SELECT01, // UNIT=SYSDA,SPACE=(32760,(20,20)),DISP=(,CATLG)//SYSPUNCH DD DSN=&SYSUID..CV83.DSNTIAUL.PUNCH, // UNIT=SYSDA,SPACE=(800,(15,15)),DISP=(,CATLG), // RECFM=FB,LRECL=120,BLKSIZE=1200 //SYSIN DD * SELECT * FROM TSOUB01.VDEPMGR ; SELECT * FROM TSOUB01.LOCATION L, TSOUB01.EMPLOYEE E WHERE E.LOCID = L.LOCID ORDER BY L.LOCID ;**************************** Bottom of Data *********************

Job output:

********************************* TOP OF DATA **************************DSNT490I SAMPLE DATA UNLOAD PROGRAM DSNT505I DSNTIAUL OPTIONS USED: SQL,10 DSNT503I UNLOAD DATA SET SYSREC00 RECORD LENGTH SET TO 37 DSNT504I UNLOAD DATA SET SYSREC00 BLOCK SIZE SET TO 27972 DSNT495I SUCCESSFUL UNLOAD 32 ROWS OF TABLE TSOUB01.VDEPMGR DSNT503I UNLOAD DATA SET SYSREC01 RECORD LENGTH SET TO 279 DSNT504I UNLOAD DATA SET SYSREC01 BLOCK SIZE SET TO 27900 DSNT495I SUCCESSFUL UNLOAD 29 ROWS OF TABLE TSOUB01.LOCATION ******************************** BOTTOM OF DATA ************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-87

Page 155: CV8317XSTUD

Student Exercises

.

Step 42c: Inspect the output

Output of the first query:

TSOUB01.CV83.DSNTIAUL.SELECT00 ===> ***************************** Top of Data *****000010HAAS A00 000010 HAAS 000110LUCCHESI A00 000010 HAAS 000120O'CONNELL A00 000010 HAAS 000020THOMPSON B01 000020 THOMPSON 000130QUINTANA C01 000030 KWAN 000140NICHOLLS C01 000030 KWAN ........ **************************** Bottom of Data ***

Output of the second query:

TSOUB01.CV83.DSNTIAUL.SELECT01 ... ===> ...***************************** Top of Data **********...DE71083-01AM FICHTENBERG 1 HERRENBERG ...DE71083-01AM FICHTENBERG 1 HERRENBERG ...DE71083-01AM FICHTENBERG 1 HERRENBERG ...DE71083-01AM FICHTENBERG 1 HERRENBERG ...US95141-B4555 BAILEY AVENUE SAN JOSE ...US95141-B4555 BAILEY AVENUE SAN JOSE ...US95141-B4555 BAILEY AVENUE SAN JOSE ...US95141-B4555 BAILEY AVENUE SAN JOSE ............. ...**************************** Bottom of Data ********...

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-88 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 156: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Punch data set output

TSOUB01.CV83.DSNTIAUL.PUNCH ===> ***************************** Top of Data **************************** LOAD DATA LOG NO INDDN SYSREC00 INTO TABLE TSOUB01.VDEPMGR ( EMPNO POSITION( 1 ) CHAR( 6) , LAST_NAME POSITION( 7 ) CHAR( 10) , DEPTNO POSITION( 17 ) CHAR( 3) NULLIF( 20)='?', MGRNO POSITION( 21 ) CHAR( 6) NULLIF( 27)='?', MGRNAME POSITION( 28 ) CHAR( 10) ) LOAD DATA LOG NO INDDN SYSREC01 INTO TABLE TSOUB01.LOCATION ( LOCID POSITION( 1 ) CHAR( 10) , ADDRESS POSITION( 11 ) CHAR( 30) , CITY POSITION( 41 ) CHAR( 30) , POSTAL_CODE POSITION( 71 ) CHAR( 15) , COUNTRY POSITION( 86 ) CHAR( 30) , EMPNO POSITION( 116 ) CHAR( 6) , FIRST_NAME POSITION( 122 ) CHAR( 20) , MIDDLE_INITIAL POSITION( 142 ) CHAR( 1) NULLIF( 143)='?', SEX POSITION( 144 ) CHAR( 1) , BIRTHDATE POSITION( 145 ) DATE EXTERNAL( 10) NULLIF( 155)='?', ......... **************************** Bottom of Data **************************

The generated LOAD statements need modifications: Loading into a R/O view or loading employee fields into the LOCATION table are not possible.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-89

Page 157: CV8317XSTUD

Student Exercises

.

Step 43: DSN1PRNT

As can be derived from the following DSN1PRNT job and output:

a. //SYSUT1 DD DSN=DBDSNB.DSNDBC.WWV8301D.TSDEPT.I0001.A001,DISP=SHR

b. PARM='PRINT(0,2),EBCDIC,FORMAT’ is ok;

but solution with PARM='PRINT(0,F),EBCDIC,FORMAT’ - to demonstrate hex number

c. 3 pages are printed: Header page, spacemap page, and one data page.

d. ID MAP has 11 entries.

e. 4 holes

f. 2 holes derive from LOAD department; 2 rows deleted because of unique index violation.

2 holes derived from CHECK DATA; 2 rows deleted because of RI violations.

Note

For universal table spaces, prior to Version 10 NFM, holes consist of free space in a data page and occur when a record is deleted. In Version 10 NFM, DB2 does not mark and chain the pseudo deleted row as a hole, so that the content remains available to read transactions with currently committed semantic. The four PD-REC records you see in Page 2 of DSN1PRNT output are for the 4 rows deleted.

g. There is only one table in TSDEPT: SELECT COUNT(*) FROM DEPARTMENT yields 9.

h. OBID of the table: PGSOBD='000A'X. This equals the information in the DB2 catalog:

---------+---------+---------+---------+---------+---------+---------+------SELECT OBID, NAME, CREATOR, TYPE, DBNAME FROM SYSIBM.SYSTABLES WHERE CREATOR = USER AND TSNAME = 'TSDEPT' WITH UR ;---------+---------+---------+---------+---------+---------+ OBID NAME CREATOR TYPE DBNAME ---------+---------+---------+---------+---------+---------+ 10 DEPARTMENT TSOUB01 T WWV8301D DSNE610I NUMBER OF ROWS DISPLAYED IS 1 ---------+---------+---------+---------+---------+---------+---------+------

i. Length of first row: PGSLTH=50, length of second row: PGSLTH=30. Different, as one column is defined as VARCHAR(50).

j. Insert of a row with maximal length, which is 66 according to the DB2 catalog, table SYSIBM.SYSCOLUMNS (taking into account a 2-byte length field and 2 Null Indicators). After stop and start TSDEPT, the new DSN1PRNT output (not depicted) for this new row is 72. Reason: Each record has a 6-byte header.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-90 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 158: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

DSN1PRNT job TSOUB01.CV83.CNTL(L6PRINT) - 01.00 Columns 00001 00072 ===> Scroll ===> CSR //TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID,REGION=0M //******************************************************************* //* * //******************************************************************* //STEP1 EXEC PGM=DSN1PRNT,PARM='PRINT(0,2),EBCDIC,FORMAT' //STEPLIB DD DSN=DBDSNB.DB2A10.SDSNEXIT,DISP=SHR // DD DSN=DBDSNB.DB2A10.SDSNLOAD,DISP=SHR //SYSUT1 DD DSN=DBDSNB.DSNDBC.WWV8301D.TSDEPT.I0001.A001,DISP=SHR //SYSPRINT DD SYSOUT=* **************************** Bottom of Data ****************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-91

Page 159: CV8317XSTUD

Student Exercises

.

Ste

p 43

: DS

N1P

RN

T o

utpu

t, pa

rt 1

of 2

1DSN1999I START OF DSN1PRNT FOR JOB TSOUB011 STEP1

DSN1989I DSN1PRNT IS PROCESSED WITH THE FOLLOWING OPTIONS:

4K/NO IMAGECOPY/NUMPARTS = 0/ FORMAT/NO EXPAND/ PRINT/NO VALUE/ / /

DSSIZE= /PIECESIZ= /EBCDIC /

DSN1998I INPUT DSNAME = DBDSNB.DSNDBC.WWV8301D.TSDEPT.I0001.A001 , VSAM

PAGE: # 00000000

----------------------------------------------------------------------------------------------------------------

HEADER PAGE: PGCOMB='00'X PGLOGRBA='0000059A6BD0'X PGNUM='00000000'X PGFLAGS='38'X

HPGOBID='011A0004'X HPGHPREF='000000B4'X HPGCATRL='00'X HPGREL='D6'X HPGZLD='00'X

HPGCATV='00'X HPGTORBA='000000000000'X HPGTSTMP='20110826021818230026'X

HPGSSNM='DSNB' HPGFOID='0003'X HPGPGSZ='1000'X HPGSGSZ='0020'X HPGPARTN='0001'X

HPGZ3PNO='000000'X HPGZNUMP='00'X HPGTBLC='0001'X HPGROID='000A'X

HPGZ4PNO='00000000'X HPGMAXL='0042'X HPGNUMCO='0004'X HPGFLAGS='010A'X

HPGFLAGS2='00'X HPGCONTM='20110826021840973762'X HPGSGNAM='WWV8301S'

HPGVCATN='DBDSNB ' HPGRBRBA='0000060B3D96'X HPGLEVEL='0000060B3D96'X

HPGPLEVL='0000059D4000'X HPGCLRSN='0000054A0C2C'X HPGSCCSI='0025'X HPGDCCSI='0000'X

HPGMCCSI='0000'X HPGDSSZ='00400000'X HPGFLAG2='00'X HPGEPOCH='0000'X

HPGRBLP='000000000000'X HPGMASSDELETETIMESTAMP='000000000000'X HPGDNUMB='01'X

HPGDNUMC='0100'X HPGDFSG='00000000'X HPGDLSG='00000000'X HPGSISP='00000000'X

FOEND='E'

SI HASH BUCKET: HPGDBKT#='01'X HPGS1BEYE='E2'X HPGS1OBI='000A'X HPGS1FSG='00000001'X

HPGS1CSG='00000001'X HPGS1LSG='00000001'X

PAGE: # 00000001

----------------------------------------------------------------------------------------------------------------

SEGMENTED SPACEMAP PAGE: PGCOMB='10'X PGLOGRBA='0000059A7752'X PGNUM='00000001'X PGFLAGS='30'X

SEGNUM='0096'X SEGFREE='0095'X SEGENT='0002'X SEGSIZE='0020'X

SEGLENT='00000001'X FOEND='N'

FIRST PART OF SEGMENTED SPACE MAP:

SEG 0001 00000000000AC0 30000000000000000000000000000000

SECOND PART OF SEGMENTED SPACE MAP:

RELPG 00 20 40 60 80 A0 C0 E0

0000 C0000000

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-92 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 160: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 43

: DS

1PR

NT

out

put,

part

2 o

f 2

PAGE: # 00000002

----------------------------------------------------------------------------------------------------------------

DATA PAGE: PGCOMB='00'X PGLOGRBA='00000609E517'X PGNUM='00000002'X PGFLAGS='00'X PGFREE=3693

PGFREE='0E6D'X PGFREEP=527 PGFREEP='020F'X PGHOLE1='0000'X PGMAXID='0D'X PGNANCH=8

PGTAIL: PGIDFREE='00'X PGEND='E'

ID-MAP FOLLOWS:

01 0014 0046 0064 008C 00B4 00DA 0105 0131

09 0151 8177 819D 81C3 81E9

RECORD: XOFFSET='0014'X PGSFLAGS='00'X PGSLTH=50 PGSLTH='0032'X PGSOBD='0000'X PGSBID='01'X

C1F0F0FF 00000000 F0F0F0F0 F1F00010 E2D7C9C6 C6E840C3 D6D4D7E4 E3C5D940 A00.....000010..SPIFFY COMPUTER

E2C5D9E5 C9C3C540 C4C9E54B SERVICE DIV.

RECORD: XOFFSET='0046'X PGSFLAGS='00'X PGSLTH=30 PGSLTH='001E'X PGSOBD='0000'X PGSBID='02'X

C2F0F100 C1F0F000 F0F0F0F0 F2F00010 D7D3C1D5 D5C9D5C7 B01.A00.000020..PLANNING

RECORD: XOFFSET='0064'X PGSFLAGS='00'X PGSLTH=40 PGSLTH='0028'X PGSOBD='0000'X PGSBID='03'X

C3F0F100 C1F0F000 F0F0F0F0 F3F00010 C9D5C6D6 D9D4C1E3 C9D6D540 C3C5D5E3 C01.A00.000030..INFORMATION CENT

1C5D9 ER

RECORD: XOFFSET='008C'X PGSFLAGS='00'X PGSLTH=40 PGSLTH='0028'X PGSOBD='0000'X PGSBID='04'X

C4F0F100 C1F0F0FF 00000000 00000010 C4C5E5C5 D3D6D7D4 C5D5E340 C3C5D5E3 D01.A00.........DEVELOPMENT CENT

C5D9 ER

RECORD: XOFFSET='00B4'X PGSFLAGS='00'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='05'X

C5F0F100 C1F0F000 F0F0F0F0 F5F00010 E2E4D7D7 D6D9E340 E2C5D9E5 C9C3C5E2 E01.A00.000050..SUPPORT SERVICES

RECORD: XOFFSET='00DA'X PGSFLAGS='00'X PGSLTH=43 PGSLTH='002B'X PGSOBD='0000'X PGSBID='06'X

C4F1F100 C4F0F100 F0F0F0F0 F6F00010 D4C1D5E4 C6C1C3E3 E4D9C9D5 C740E2E8 D11.D01.000060..MANUFACTURING SY

E2E3C5D4 E2 STEMS

RECORD: XOFFSET='0105'X PGSFLAGS='00'X PGSLTH=44 PGSLTH='002C'X PGSOBD='0000'X PGSBID='07'X

C4F2F100 C4F0F100 F0F0F0F0 F7F00010 C1C4D4C9 D5C9E2E3 D9C1E3C9 D6D540E2 D21.D01.000070..ADMINISTRATION S

E8E2E3C5 D4E2 YSTEMS

RECORD: XOFFSET='0131'X PGSFLAGS='00'X PGSLTH=32 PGSLTH='0020'X PGSOBD='0000'X PGSBID='08'X

C5F1F100 C5F0F100 F0F0F0F0 F9F00010 D6D7C5D9 C1E3C9D6 D5E2 E11.E01.000090..OPERATIONS

RECORD: XOFFSET='0151'X PGSFLAGS='00'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='09'X

C5F2F100 C5F0F100 F0F0F0F1 F0F00010 E2D6C6E3 E6C1D9C5 40E2E4D7 D7D6D9E3 E21.E01.000100..SOFTWARE SUPPORT

PD-REC: XOFFSET='0177'X PGSFLAGS='02'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='0A'X

C5F3F100 C5F0F100 F0F0F0F1 F0F10010 E2D6C6E3 E6C1D9C5 40E2E4D7 D760F3F1 E31.E01.000101..SOFTWARE SUPP-31

PD-REC: XOFFSET='019D'X PGSFLAGS='02'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='0B'X

C5F4F100 E7F0F100 F0F0F0F1 F0F20010 E2D6C6E3 E6C1D9C5 40E2E4D7 D760F4F1 E41.X01.000102..SOFTWARE SUPP-41

PD-REC: XOFFSET='01C3'X PGSFLAGS='02'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='0C'X

C5F5F100 C5F0F100 F0F0F0F1 F0F30010 E2D6C6E3 E6C1D9C5 40E2E4D7 D760F5F1 E51.E01.000103..SOFTWARE SUPP-51

PD-REC: XOFFSET='01E9'X PGSFLAGS='02'X PGSLTH=38 PGSLTH='0026'X PGSOBD='0000'X PGSBID='0D'X

C5F5F100 C5F0F100 F0F0F0F1 F0F40010 E2D6C6E3 E6C1D9C5 40E2E4D7 D760F6F1 E51.E01.000104..SOFTWARE SUPP-61

0DSN1994I DSN1PRNT COMPLETED SUCCESSFULLY, 00000003 PAGES PROCESSED

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-93

Page 161: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-94 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 162: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 7: Running RUNSTATS and REORG

Questions relating to real-time statistics

1. What is L7QUERY1 doing?

***************************** Top of Data ********************SELECT DBNAME,NAME,UPDATESTATSTIME,TOTALROWS,STATSLASTTIME, STATSINSERTS,STATSDELETES,STATSUPDATES,STATSMASSDELETE FROM SYSIBM.SYSTABLESPACESTATS WHERE DBNAME='WWV83??D' AND NAME='TSPROJ' WITH UR ;**************************** Bottom of Data ******************

The query reads the row for table space TSPROJ in your database from the real-time statistics catalog table SYSIBM.SYSTABLESPACESTATS.

2. Is TOTALROWS what you expect?

Yes. There are 290 rows loaded into the PROJECT table, 39 rows loaded into the ON_PROJECT table and 74 rows loaded into the ACTIVITY table, for a total of 403 rows.

3. Explain the STATSINSERTS value.

The LOAD REPLACE of table PROJECT contained the keyword STATISTICS. That is why the counters STATS... have been reset to 0, as they show only what happened since the last RUNSTATS (or inline statistics). The LOAD for tables ON_PROJECT and ACTIVITY was a LOAD RESUME YES. The STATS... counters are not reset and the rows added to the table space are counted as inserts. 39 for table ON_PROJECT and 74 for table ACTIVITY, for a total of 113 inserts since the last RUNSTATS.

4. Would you recommend to run RUNSTATS on table space TSPROJ?

Yes. The number of rows changed (113) is more than 20% of the total number of rows in the table space (403).

Table 9: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJTOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

403 113 0 0 0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-95

Page 163: CV8317XSTUD

Student Exercises

.

5. What type of disorganization might SQL statement L7UPDATE introduce into the table space?

UPDATE PROJECT SET NAME = 'FILLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL' WHERE PROJNO BETWEEN 'PL2101' AND 'PL2220' ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE615I NUMBER OF ROWS AFFECTED IS 120 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Table space TSPROJ was defined with zero free space (see exercise 1) and the update has increased the length of 120 rows. This might require some of the updated rows to overflow to another page.

6. Are there changes in real-time statistics immediately after the updates?

No. DB2 externalizes the real-time statistics only after n minutes, n being a system parameter. As the query of the real-time statistics values immediately followed the update statement, it is extremely unlikely to see the correct values already.

7. After a while, execute member L7QUERY1. Is STATSUPDATES now what you expect?

Yes, after a few minutes, STATSUPDATES should be 120.

Table 10: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJTOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

403 113 0 0 0

Table 11: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJTOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

403 113 0 120 0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-96 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 164: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 1

of 8

1DSNU000I 241 07:35:16.64 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 07:35:16.66 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 07:35:16.67 DSNUGUTC - RUNSTATS TABLESPACE WWV8301D.TSPROJ INDEX(ALL) SHRLEVEL CHANGE REPORT YES

DSNU613I -DSNB 241 07:35:16.71 DSNUSUTP - SYSTABLEPART CATALOG STATISTICS FOR WWV8301D.TSPROJ PARTITION 0

CARD = 403

CARDF = 4.03E+02

NEARINDREF = 0

FARINDREF = 48

PERCACTIVE = 1

PERCDROP = 0

PAGESAVE = 0

SPACE = 2160

SPACEF = 2.16E+03

PQTY = -1

SQTY = -1

DSNUM = 1

EXTENTS = 2

DSNU610I -DSNB 241 07:35:16.72 DSNUSUTP - SYSTABLEPART CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

DSNU614I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.PROJECT

CARD = 290

CARDF = 2.9E+02

NPAGES = 5

NPAGESF = 5.0E+00

PCTPAGES = 62

PCTROWCOMP = 0

AVGROWLEN = 70

SPACEF = 2.0E+01

DSNU610I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.PROJECT SUCCESSFUL

DSNU614I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.ON_PROJECT

CARD = 39

CARDF = 3.9E+01

NPAGES = 1

NPAGESF = 1.0E+00

PCTPAGES = 25

PCTROWCOMP = 0

AVGROWLEN = 20

SPACEF = 4.0E+00

DSNU610I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.ON_PROJECT SUCCESSFUL

DSNU614I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.ACTIVITY

CARD = 74

CARDF = 7.4E+01

NPAGES = 1

NPAGESF = 1.0E+00

PCTPAGES = 25

PCTROWCOMP = 0

AVGROWLEN = 38

SPACEF = 4.0E+00

DSNU610I -DSNB 241 07:35:16.72 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.ACTIVITY SUCCESSFUL

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-97

Page 165: CV8317XSTUD

Student Exercises

.

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 2

of 8

DSNU612I -DSNB 241 07:35:16.72 DSNUSUTS - SYSTABLESPACE CATALOG STATISTICS FOR WWV8301D.TSPROJ

NACTIVE = 540

NACTIVEF = 5.4E+02

DSNU610I -DSNB 241 07:35:16.72 DSNUSUTS - SYSTABLESPACE CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

DSNU618I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ3 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 1

FAROFFPOSF = 1.0E+00

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU618I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ1 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 6

NEAROFFPOSF = 6.0E+00

FAROFFPOS = 2

FAROFFPOSF = 2.0E+00

LEAFDIST = 50

LEAFNEAR = 1

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

DSNU618I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ2 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 4

NEAROFFPOSF = 4.0E+00

FAROFFPOS = 1

FAROFFPOSF = 1.0E+00

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-98 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 166: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 3

of 8

DSNU618I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXONPR2 PARTITION 0

CARD = 39

CARDF = 3.9E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU618I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXONPR1 PARTITION 0

CARD = 39

CARDF = 3.9E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.74 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU618I -DSNB 241 07:35:16.75 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXACTY1 PARTITION 0

CARD = 74

CARDF = 7.4E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.75 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-99

Page 167: CV8317XSTUD

Student Exercises

.

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 4

of 8

DSNU618I -DSNB 241 07:35:16.75 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXACTY2 PARTITION 0

CARD = 74

CARDF = 7.4E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 07:35:16.76 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU615I -DSNB 241 07:35:16.76 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 17

COLCARDF = 1.7E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

DSNU610I -DSNB 241 07:35:16.76 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.76 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ3

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 17

FIRSTKEYCARDF = 1.7E+01

FULLKEYCARD = 17

FULLKEYCARDF = 1.7E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 5.0E+00

DSNU610I -DSNB 241 07:35:16.76 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU615I -DSNB 241 07:35:16.76 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 290

COLCARDF = 2.9E+02

HIGH2KEY = X'D7D3F2F2F3F9'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 07:35:16.76 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.76 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 290

FIRSTKEYCARDF = 2.9E+02

FULLKEYCARD = 290

FULLKEYCARDF = 2.9E+02

NLEAF = 2

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 4.0E+00

DSNU610I -DSNB 241 07:35:16.76 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-100 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 168: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 5

of 8

DSNU615I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR DEPTNO

COLCARD = 8

COLCARDF = 8.0E+00

HIGH2KEY = X'C5F1F1'

LOW2KEY = X'C3F0F1'

DSNU610I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 8

FIRSTKEYCARDF = 8.0E+00

FULLKEYCARD = 8

FULLKEYCARDF = 8.0E+00

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 5.0E+00

DSNU610I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU615I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 30

COLCARDF = 3.0E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

DSNU610I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXONPR2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 30

FIRSTKEYCARDF = 3.0E+01

FULLKEYCARD = 30

FULLKEYCARDF = 3.0E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU615I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 19

COLCARDF = 1.9E+01

HIGH2KEY = X'D6D7F2F0F1F3'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXONPR1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 19

FIRSTKEYCARDF = 1.9E+01

FULLKEYCARD = 39

FULLKEYCARDF = 3.9E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-101

Page 169: CV8317XSTUD

Student Exercises

.

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 6

of 8

DSNU615I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 19

COLCARDF = 1.9E+01

HIGH2KEY = X'D6D7F2F0F1F3'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXACTY1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 19

FIRSTKEYCARDF = 1.9E+01

FULLKEYCARD = 74

FULLKEYCARDF = 7.4E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 07:35:16.77 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU615I -DSNB 241 07:35:16.77 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 30

COLCARDF = 3.0E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

DSNU610I -DSNB 241 07:35:16.78 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU617I -DSNB 241 07:35:16.78 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXACTY2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 30

FIRSTKEYCARDF = 3.0E+01

FULLKEYCARD = 30

FULLKEYCARDF = 3.0E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 07:35:16.78 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU616I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

4.8620689655172E-01 X'F0F0F0F0F2F0'

1.7586206896551E-01 X'F0F0F0F0F6F0'

1.7586206896551E-01 X'F0F0F0F1F0F0'

1.0689655172413E-01 X'F0F0F0F2F7F0'

6.8965517241379E-03 X'F0F0F0F0F1F0'

6.8965517241379E-03 X'F0F0F0F0F3F0'

6.8965517241379E-03 X'F0F0F0F0F5F0'

3.4482758620689E-03 X'F0F0F0F0F7F0'

3.4482758620689E-03 X'F0F0F0F0F9F0'

3.4482758620689E-03 X'F0F0F0F1F5F0'

DSNU610I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-102 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 170: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 7

of 8

DSNU616I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

DEPTNO

FREQUENCY COLVALUE

--------- --------

4.8620689655172E-01 X'C2F0F1'

1.8620689655172E-01 X'C4F1F1'

1.8620689655172E-01 X'C5F2F1'

1.1724137931034E-01 X'C4F2F1'

6.8965517241379E-03 X'C3F0F1'

6.8965517241379E-03 X'C4F0F1'

6.8965517241379E-03 X'C5F0F1'

3.4482758620689E-03 X'C5F1F1'

DSNU610I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU616I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

7.6923076923076E-02 X'F0F0F0F0F1F0'

7.6923076923076E-02 X'F0F0F0F0F3F0'

5.1282051282051E-02 X'F0F0F0F0F5F0'

5.1282051282051E-02 X'F0F0F0F1F3F0'

5.1282051282051E-02 X'F0F0F0F1F4F0'

5.1282051282051E-02 X'F0F0F0F1F7F0'

5.1282051282051E-02 X'F0F0F0F3F0F0'

2.5641025641025E-02 X'F0F0F0F0F2F0'

2.5641025641025E-02 X'F0F0F0F0F7F0'

2.5641025641025E-02 X'F0F0F0F0F9F0'

DSNU610I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU616I -DSNB 241 07:35:16.78 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO

FREQUENCY COLVALUE

--------- --------

1.2820512820512E-01 X'D6D7F1F0F1F0'

1.025641025641E-01 X'D4C1F2F1F1F3'

7.6923076923076E-02 X'C9C6F1F0F0F0'

7.6923076923076E-02 X'D4C1F2F1F1F2'

7.6923076923076E-02 X'D7D3F2F1F0F0'

5.1282051282051E-02 X'C1C4F3F1F0F0'

5.1282051282051E-02 X'C1C4F3F1F1F1'

5.1282051282051E-02 X'C1C4F3F1F1F3'

5.1282051282051E-02 X'C9C6F2F0F0F0'

5.1282051282051E-02 X'D4C1F2F1F0F0'

DSNU610I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU616I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO,EMPNO

CARDINALITY = 3.6E+01

DSNU616I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO,EMPNO,SEQNO

CARDINALITY = 7.4E+01

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-103

Page 171: CV8317XSTUD

Student Exercises

.

Ste

ps 8

to 1

0: R

UN

STA

TS

util

ity o

utpu

t, pa

rt 8

of 8

DSNU616I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO

FREQUENCY COLVALUE

--------- --------

1.8918918918918E-01 X'C1C4F3F1F1F3'

1.3513513513513E-01 X'C1C4F3F1F1F2'

9.4594594594594E-02 X'C1C4F3F1F1F1'

8.1081081081081E-02 X'D4C1F2F1F1F2'

6.7567567567567E-02 X'C9C6F2F0F0F0'

6.7567567567567E-02 X'D4C1F2F1F1F3'

6.7567567567567E-02 X'D6D7F1F0F1F0'

5.4054054054054E-02 X'C9C6F1F0F0F0'

4.054054054054E-02 X'D4C1F2F1F1F1'

2.7027027027027E-02 X'D4C1F2F1F0F0'

DSNU610I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU616I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

1.3513513513513E-01 X'F0F0F0F2F5F0'

9.4594594594594E-02 X'F0F0F0F2F6F0'

9.4594594594594E-02 X'F0F0F0F2F7F0'

6.7567567567567E-02 X'F0F0F0F1F4F0'

6.7567567567567E-02 X'F0F0F0F2F3F0'

4.054054054054E-02 X'F0F0F0F0F1F0'

4.054054054054E-02 X'F0F0F0F1F7F0'

2.7027027027027E-02 X'F0F0F0F0F3F0'

2.7027027027027E-02 X'F0F0F0F0F5F0'

2.7027027027027E-02 X'F0F0F0F1F3F0'

DSNU610I -DSNB 241 07:35:16.79 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU620I -DSNB 241 07:35:16.80 DSNUSEOF - RUNSTATS CATALOG TIMESTAMP = 2011-08-29-07.35.16.678754

DSNU010I 241 07:35:16.80 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-104 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 172: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Questions relating to RUNSTATS report

Step 11: Same values as with real-time statistics? why STATSINSERTS, STATSUPDATES now 0?

Executing L7QUERY1 once again (to get current real-time statistics values) yields:

Same values?

Catalog: CARDF=403 and TOTALROWS = 403.

STATSINSERTS and STATSUPDATES = 0, as previous RUNSTATS with UPDATE ALL has reset RTS’ statistics counters. (Remark: RUNSTATS with UPDATE SPACE does NOT reset the statistics counters.)

Step 12: Have any variable length rows overflowed to another page?

Yes, RUNSTATS output states: FARINDREF is now 48

Table 12: SYSIBM.SYSTABLEPART Catalog StatisticsCARDF NEARINDREF FARINDREF

403 0 48

Table 13: SYSIBM.SYSINDEXPART Catalog StatisticsIndex Name CARDF NEAROFFPOSF FAROFFPOSF LEAFFAR

IXPROJ3 290 0 1 0

IXPROJ1 290 6 2 0

IXPROJ2 290 4 1 0

IXONPR2 39 0 0 0

IXONPR1 39 0 0 0

IXACTY1 74 0 0 0

IXACTY2 74 0 0 0

Table 14: SYSIBM.SYSTABLESPACESTATS Real-Time Statistics for table space TSPROJTOTALROWS STATSINSERTS STATSDELETES STATSUPDATES STATSMASSDELETE

403 0 0 0 0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-105

Page 173: CV8317XSTUD

Student Exercises

.

Step 13: Why is the data for the PROJECT table still reported as being well-clustered even though a number of rows in the PROJECT table have overflowed?

The data for the PROJECT table is reported as well clustered (CLUSTERRATIO for index IXPROJ3 is 100%), because index IXPROJ3 still points to where the rows were originally located.

Conditional REORGs follow:

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-106 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 174: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

ps 1

4 to

16:

RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t

1DSNU000I 241 12:32:40.31 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 12:32:40.34 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 12:32:40.34 DSNUGUTC - REORG TABLESPACE WWV8301D.TSPROJ REPORTONLY OFFPOSLIMIT 15 INDREFLIMIT 15

DSNU286I -DSNB 241 12:32:40.41 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ OFFPOSLIMIT SYSINDEXPART ROWS

CREATOR.IXNAME: TSOUB01.IXPROJ3

CREATOR.TBNAME: TSOUB01.PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 2.9E+02 1.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXONPR2

CREATOR.TBNAME: TSOUB01.ON_PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 3.9E+01 0.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXACTY1

CREATOR.TBNAME: TSOUB01.ACTIVITY

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 -1.0E+00 -1.0E+00 -1.0E+00 0001-01-01-00.00.00

DSNU287I -DSNB 241 12:32:40.41 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ INDREFLIMIT SYSTABLEPART ROWS

DBNAME .TSNAME PART CARD FARINDREF NEARINDREF STATSTIME

WWV8301D.TSPROJ 0 403 48 0 2011-08-29-07.35.16

DSNU289I -DSNB 241 12:32:40.41 DSNURLIM - NO REORG LIMITS HAVE BEEN MET

DSNU010I 241 12:32:40.41 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=1

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-107

Page 175: CV8317XSTUD

Student Exercises

.

Ste

ps 1

7 to

18:

RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t

1DSNU000I 241 12:37:38.06 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 12:37:38.09 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 12:37:38.09 DSNUGUTC - REORG TABLESPACE WWV8301D.TSPROJ REPORTONLY OFFPOSLIMIT 10 INDREFLIMIT 10

DSNU286I -DSNB 241 12:37:38.09 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ OFFPOSLIMIT SYSINDEXPART ROWS

CREATOR.IXNAME: TSOUB01.IXPROJ3

CREATOR.TBNAME: TSOUB01.PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 2.9E+02 1.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXONPR2

CREATOR.TBNAME: TSOUB01.ON_PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 3.9E+01 0.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXACTY1

CREATOR.TBNAME: TSOUB01.ACTIVITY

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 -1.0E+00 -1.0E+00 -1.0E+00 0001-01-01-00.00.00

DSNU287I -DSNB 241 12:37:38.09 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ INDREFLIMIT SYSTABLEPART ROWS

DBNAME .TSNAME PART CARD FARINDREF NEARINDREF STATSTIME

* WWV8301D.TSPROJ 0 403 48 0 2011-08-29-07.35.16

DSNU289I -DSNB 241 12:37:38.09 DSNURLIM - REORG LIMITS HAVE BEEN MET

DSNU010I 241 12:37:38.10 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=2

Row

s w

hich

mee

t the

lim

it cr

iteria

are

pre

face

d w

ith ‘*

’.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-108 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 176: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 19: REORG TABLESPACE statement, third version

REORG TABLESPACE WWV8301D.TSPROJ OFFPOSLIMIT 10 INDREFLIMIT 10 STATISTICS INDEX( ALL ) REPORT YES UPDATE ALL

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-109

Page 177: CV8317XSTUD

Student Exercises

.

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 1

of 8

1DSNU000I 241 12:44:07.43 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 12:44:07.46 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 12:44:07.46 DSNUGUTC - REORG TABLESPACE WWV8301D.TSPROJ OFFPOSLIMIT 10 INDREFLIMIT 10 STATISTICS

INDEX(ALL) REPORT(YES)

DSNU286I -DSNB 241 12:44:07.46 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ OFFPOSLIMIT SYSINDEXPART ROWS

CREATOR.IXNAME: TSOUB01.IXPROJ3

CREATOR.TBNAME: TSOUB01.PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 2.9E+02 1.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXONPR2

CREATOR.TBNAME: TSOUB01.ON_PROJECT

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 3.9E+01 0.0E+00 0.0E+00 2011-08-29-07.35.16

CREATOR.IXNAME: TSOUB01.IXACTY1

CREATOR.TBNAME: TSOUB01.ACTIVITY

PART CARDF FAROFFPOSF NEAROFFPOSF STATSTIME

0 7.4E+01 0.0E+00 0.0E+00 2011-08-29-07.35.16

DSNU287I -DSNB 241 12:44:07.46 DSNURLIM - REORG TABLESPACE WWV8301D.TSPROJ INDREFLIMIT SYSTABLEPART ROWS

DBNAME .TSNAME PART CARD FARINDREF NEARINDREF STATSTIME

* WWV8301D.TSPROJ 0 403 48 0 2011-08-29-07.35.16

DSNU289I -DSNB 241 12:44:07.46 DSNURLIM - REORG LIMITS HAVE BEEN MET

DSNU290I -DSNB 241 12:44:07.46 DSNURLIM - REORG WILL BE PERFORMED

DSNU252I 241 12:44:07.54 DSNURULD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=403 FOR TABLESPACE

WWV8301D.TSPROJ

DSNU250I 241 12:44:07.54 DSNURULD - UNLOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU304I -DSNB 241 12:44:08.48 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=290 FOR TABLE TSOUB01.PROJECT

DSNU304I -DSNB 241 12:44:08.48 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=39 FOR TABLE TSOUB01.ON_PROJECT

DSNU304I -DSNB 241 12:44:08.48 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=74 FOR TABLE TSOUB01.ACTIVITY

DSNU302I 241 12:44:08.49 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=403

DSNU300I 241 12:44:08.49 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 241 12:44:08.49 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=1096

ELAPSED TIME=00:00:00

DSNU349I -DSNB 241 12:44:08.53 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ1

DSNU349I -DSNB 241 12:44:08.56 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ2

DSNU349I -DSNB 241 12:44:08.58 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=290 FOR INDEX TSOUB01.IXPROJ3

DSNU349I -DSNB 241 12:44:08.62 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXONPR1

DSNU349I -DSNB 241 12:44:08.64 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=39 FOR INDEX TSOUB01.IXONPR2

DSNU349I -DSNB 241 12:44:08.67 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=74 FOR INDEX TSOUB01.IXACTY1

DSNU349I -DSNB 241 12:44:08.70 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=74 FOR INDEX TSOUB01.IXACTY2

DSNU258I 241 12:44:08.73 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=7

DSNU259I 241 12:44:08.73 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU613I -DSNB 241 12:44:08.74 DSNUSUTP - SYSTABLEPART CATALOG STATISTICS FOR WWV8301D.TSPROJ PARTITION 0

CARD = 403

CARDF = 4.03E+02

NEARINDREF = 0

FARINDREF = 0

PERCACTIVE = 37

PERCDROP = 0

PAGESAVE = 0

SPACE = 720

SPACEF = 7.2E+02

PQTY = -1

SQTY = -1

DSNUM = 1

EXTENTS = 1

DSNU610I -DSNB 241 12:44:08.74 DSNUSUTP - SYSTABLEPART CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-110 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 178: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 2

of 8

DSNU614I -DSNB 241 12:44:08.74 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.PROJECT

CARD = 290

CARDF = 2.9E+02

NPAGES = 5

NPAGESF = 5.0E+00

PCTPAGES = 62

PCTROWCOMP = 0

AVGROWLEN = 69

SPACEF = 2.0E+01

DSNU610I -DSNB 241 12:44:08.75 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.PROJECT SUCCESSFUL

DSNU614I -DSNB 241 12:44:08.75 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.ON_PROJECT

CARD = 39

CARDF = 3.9E+01

NPAGES = 1

NPAGESF = 1.0E+00

PCTPAGES = 25

PCTROWCOMP = 0

AVGROWLEN = 20

SPACEF = 4.0E+00

DSNU610I -DSNB 241 12:44:08.75 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.ON_PROJECT SUCCESSFUL

DSNU614I -DSNB 241 12:44:08.75 DSNUSUTB - SYSTABLES CATALOG STATISTICS FOR TSOUB01.ACTIVITY

CARD = 74

CARDF = 7.4E+01

NPAGES = 1

NPAGESF = 1.0E+00

PCTPAGES = 25

PCTROWCOMP = 0

AVGROWLEN = 38

SPACEF = 4.0E+00

DSNU610I -DSNB 241 12:44:08.75 DSNUSUTB - SYSTABLES CATALOG UPDATE FOR TSOUB01.ACTIVITY SUCCESSFUL

DSNU612I -DSNB 241 12:44:08.75 DSNUSUTS - SYSTABLESPACE CATALOG STATISTICS FOR WWV8301D.TSPROJ

NACTIVE = 15

NACTIVEF = 1.5E+01

DSNU610I -DSNB 241 12:44:08.75 DSNUSUTS - SYSTABLESPACE CATALOG UPDATE FOR WWV8301D.TSPROJ SUCCESSFUL

DSNU618I -DSNB 241 12:44:08.76 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ3 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 1

FAROFFPOSF = 1.0E+00

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.76 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-111

Page 179: CV8317XSTUD

Student Exercises

.

step

20:

RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 3

of 8

DSNU618I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ1 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 74

NEAROFFPOSF = 7.4E+01

FAROFFPOS = 8

FAROFFPOSF = 8.0E+00

LEAFDIST = 50

LEAFNEAR = 1

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

DSNU618I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXPROJ2 PARTITION 0

CARD = 290

CARDF = 2.9E+02

NEAROFFPOS = 2

NEAROFFPOSF = 2.0E+00

FAROFFPOS = 5

FAROFFPOSF = 5.0E+00

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU618I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXONPR2 PARTITION 0

CARD = 39

CARDF = 3.9E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-112 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 180: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 4

of 8

DSNU618I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXONPR1 PARTITION 0

CARD = 39

CARDF = 3.9E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.77 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU618I -DSNB 241 12:44:08.78 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXACTY1 PARTITION 0

CARD = 74

CARDF = 7.4E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.79 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU618I -DSNB 241 12:44:08.79 DSNUSUIP - SYSINDEXPART CATALOG STATISTICS FOR TSOUB01.IXACTY2 PARTITION 0

CARD = 74

CARDF = 7.4E+01

NEAROFFPOS = 0

NEAROFFPOSF = 0.0E0

FAROFFPOS = 0

FAROFFPOSF = 0.0E0

LEAFDIST = 0

LEAFNEAR = 0

LEAFFAR = 0

SPACE = 720

SPACEF = 7.2E+02

DSNUM = 1

EXTENTS = 1

P_DEL_ENT = 0

PQTY = -1

SQTY = -1

DSNU610I -DSNB 241 12:44:08.79 DSNUSUIP - SYSINDEXPART CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 17

COLCARDF = 1.7E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-113

Page 181: CV8317XSTUD

Student Exercises

.

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 5

of 8

DSNU610I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.79 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ3

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 17

FIRSTKEYCARDF = 1.7E+01

FULLKEYCARD = 17

FULLKEYCARDF = 1.7E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 5.0E+00

DSNU610I -DSNB 241 12:44:08.79 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 290

COLCARDF = 2.9E+02

HIGH2KEY = X'D7D3F2F2F3F9'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.79 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 290

FIRSTKEYCARDF = 2.9E+02

FULLKEYCARD = 290

FULLKEYCARDF = 2.9E+02

NLEAF = 2

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 3.0E+00

DSNU610I -DSNB 241 12:44:08.79 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ1 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR DEPTNO

COLCARD = 8

COLCARDF = 8.0E+00

HIGH2KEY = X'C5F1F1'

LOW2KEY = X'C3F0F1'

DSNU610I -DSNB 241 12:44:08.79 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXPROJ2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 8

FIRSTKEYCARDF = 8.0E+00

FULLKEYCARD = 8

FULLKEYCARDF = 8.0E+00

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 5.0E+00

DSNU610I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 30

COLCARDF = 3.0E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-114 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 182: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 6

of 8

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXONPR2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 30

FIRSTKEYCARDF = 3.0E+01

FULLKEYCARD = 30

FULLKEYCARDF = 3.0E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 19

COLCARDF = 1.9E+01

HIGH2KEY = X'D6D7F2F0F1F3'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXONPR1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 19

FIRSTKEYCARDF = 1.9E+01

FULLKEYCARD = 39

FULLKEYCARDF = 3.9E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR PROJNO

COLCARD = 19

COLCARDF = 1.9E+01

HIGH2KEY = X'D6D7F2F0F1F3'

LOW2KEY = X'C1C4F3F1F1F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXACTY1

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 19

FIRSTKEYCARDF = 1.9E+01

FULLKEYCARD = 74

FULLKEYCARDF = 7.4E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU615I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG STATISTICS FOR EMPNO

COLCARD = 30

COLCARDF = 3.0E+01

HIGH2KEY = X'F0F0F0F3F3F0'

LOW2KEY = X'F0F0F0F0F2F0'

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-115

Page 183: CV8317XSTUD

Student Exercises

.

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 7

of 8

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCO - SYSCOLUMNS CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU617I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG STATISTICS FOR TSOUB01.IXACTY2

CLUSTERED = Y

CLUSTERRATIO = 100

CLUSTERRATIOF = 1.0E+00

FIRSTKEYCARD = 30

FIRSTKEYCARDF = 3.0E+01

FULLKEYCARD = 30

FULLKEYCARDF = 3.0E+01

NLEAF = 1

NLEVELS = 2

SPACEF = 7.2E+02

DATAREPEATFACTORF = 1.0E+00

DSNU610I -DSNB 241 12:44:08.80 DSNUSUIX - SYSINDEXES CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

4.8620689655172E-01 X'F0F0F0F0F2F0'

1.7586206896551E-01 X'F0F0F0F0F6F0'

1.7586206896551E-01 X'F0F0F0F1F0F0'

1.0689655172413E-01 X'F0F0F0F2F7F0'

6.8965517241379E-03 X'F0F0F0F0F1F0'

6.8965517241379E-03 X'F0F0F0F0F3F0'

6.8965517241379E-03 X'F0F0F0F0F5F0'

3.4482758620689E-03 X'F0F0F0F0F7F0'

3.4482758620689E-03 X'F0F0F0F0F9F0'

3.4482758620689E-03 X'F0F0F0F1F5F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXPROJ3 SUCCESSFUL

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

DEPTNO

FREQUENCY COLVALUE

--------- --------

4.8620689655172E-01 X'C2F0F1'

1.8620689655172E-01 X'C4F1F1'

1.8620689655172E-01 X'C5F2F1'

1.1724137931034E-01 X'C4F2F1'

6.8965517241379E-03 X'C3F0F1'

6.8965517241379E-03 X'C4F0F1'

6.8965517241379E-03 X'C5F0F1'

3.4482758620689E-03 X'C5F1F1'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXPROJ2 SUCCESSFUL

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

7.6923076923076E-02 X'F0F0F0F0F1F0'

7.6923076923076E-02 X'F0F0F0F0F3F0'

5.1282051282051E-02 X'F0F0F0F0F5F0'

5.1282051282051E-02 X'F0F0F0F1F3F0'

5.1282051282051E-02 X'F0F0F0F1F4F0'

5.1282051282051E-02 X'F0F0F0F1F7F0'

5.1282051282051E-02 X'F0F0F0F3F0F0'

2.5641025641025E-02 X'F0F0F0F0F2F0'

2.5641025641025E-02 X'F0F0F0F0F7F0'

2.5641025641025E-02 X'F0F0F0F0F9F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXONPR2 SUCCESSFUL

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-116 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 184: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 20

: RE

OR

G T

AB

LES

PA

CE

util

ity o

utpu

t, pa

rt 8

of 8

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO

FREQUENCY COLVALUE

--------- --------

1.2820512820512E-01 X'D6D7F1F0F1F0'

1.025641025641E-01 X'D4C1F2F1F1F3'

7.6923076923076E-02 X'C9C6F1F0F0F0'

7.6923076923076E-02 X'D4C1F2F1F1F2'

7.6923076923076E-02 X'D7D3F2F1F0F0'

5.1282051282051E-02 X'C1C4F3F1F0F0'

5.1282051282051E-02 X'C1C4F3F1F1F1'

5.1282051282051E-02 X'C1C4F3F1F1F3'

5.1282051282051E-02 X'C9C6F2F0F0F0'

5.1282051282051E-02 X'D4C1F2F1F0F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXONPR1 SUCCESSFUL

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO,EMPNO

CARDINALITY = 3.6E+01

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO,EMPNO,SEQNO

CARDINALITY = 7.4E+01

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

PROJNO

FREQUENCY COLVALUE

--------- --------

1.8918918918918E-01 X'C1C4F3F1F1F3'

1.3513513513513E-01 X'C1C4F3F1F1F2'

9.4594594594594E-02 X'C1C4F3F1F1F1'

8.1081081081081E-02 X'D4C1F2F1F1F2'

6.7567567567567E-02 X'C9C6F2F0F0F0'

6.7567567567567E-02 X'D4C1F2F1F1F3'

6.7567567567567E-02 X'D6D7F1F0F1F0'

5.4054054054054E-02 X'C9C6F1F0F0F0'

4.054054054054E-02 X'D4C1F2F1F1F1'

2.7027027027027E-02 X'D4C1F2F1F0F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXACTY1 SUCCESSFUL

DSNU616I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG STATISTICS FOR

EMPNO

FREQUENCY COLVALUE

--------- --------

1.3513513513513E-01 X'F0F0F0F2F5F0'

9.4594594594594E-02 X'F0F0F0F2F6F0'

9.4594594594594E-02 X'F0F0F0F2F7F0'

6.7567567567567E-02 X'F0F0F0F1F4F0'

6.7567567567567E-02 X'F0F0F0F2F3F0'

4.054054054054E-02 X'F0F0F0F0F1F0'

4.054054054054E-02 X'F0F0F0F1F7F0'

2.7027027027027E-02 X'F0F0F0F0F3F0'

2.7027027027027E-02 X'F0F0F0F0F5F0'

2.7027027027027E-02 X'F0F0F0F1F3F0'

DSNU610I -DSNB 241 12:44:08.80 DSNUSUCD - SYSCOLDIST CATALOG UPDATE FOR TSOUB01.IXACTY2 SUCCESSFUL

DSNU620I -DSNB 241 12:44:08.80 DSNUSEOF - RUNSTATS CATALOG TIMESTAMP = 2011-08-29-12.44.08.443115

DSNU010I 241 12:44:08.93 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=2

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-117

Page 185: CV8317XSTUD

Student Exercises

.

Steps 20 to 21: Some results of the REORG report (xxxINDREFs now 0):

Table 15: SYSIBM.SYSTABLEPART Catalog StatisticsCARDF NEARINDREF FARINDREF

403 0 0

Table 16: SYSIBM.SYSINDEXPART Catalog StatisticsIndex Name CARDF NEAROFFPOSF FAROFFPOSF LEAFFAR

IXPROJ3 290 0 1 0

IXPROJ1 290 74 8 0

IXPROJ2 290 2 5 0

IXONPR2 39 0 0 0

IXONPR1 39 0 0 0

IXACTY1 74 0 0 0

IXACTY2 74 0 0 0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-118 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 186: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 22 (optional): Calculating space

At the beginning, an overview graphic for TSPROJ; see below for explanations:

Step 22a: Number of segments

By reviewing the RUNSTATS output or by executing queries on the catalog, we know:

TSPROJ ------ - page size: 4 KB - SEGSIZE: 4 pages - PCTFREE: 10 percent Tables AVG_ROW_LENGTH AVG_RECORD_LENGTH COUNT(*)=CARD ---------- -------------- ----------------- ------------- PROJECT 67 75 290 ON_PROJECT 18 26 39 ACTIVITY 36 44 74 where a) you must provide/estimate AVG_ROW_LENGTH and CARD, if data not yet stored in DB2; b) AVG_RECORD_LENGTH includes 6 bytes for record header plus 2 bytes for id map entry.

© Copyright IBM Corporation 2007

ON_PROJECT• CARDF 39 • NPAGES 1• PCTPAGES 25%

PROJECT• CARDF 290• NPAGES 5• PCTPAGES 62%

IDCAMS• 15 tracks• 1 extent• ALLOCATION

– SPACE TYPE - CYLINDER– SPACE PRI - 1– SPACE SEC - 1

• HI-A-RBA 737280• HI-U-RBA 61440• CISIZE 4096• AVGLRECL 0• MAXLRECL 0

ACTIVITY• CARDF 74• NPAGES 1• PCTPAGES 25%

Segment 4

Segment 1

Segment 2

Segment 3

Header

Space Map

TSPROJ• Table space Statistics• NACTIVE 15:

– Number of pages formatted for rows– Not all pages may contain rows

• PERCACTIVE 37:– Percentage of space

occupied by rows

• CARD 403

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-119

Page 187: CV8317XSTUD

Student Exercises

.

Calculating the segments:

PROJECT: - page size: 4096 bytes - net: about 4050 bytes - minus PCTFREE: about 3600 bytes - rows per page: 3600 : 75 = 48 (max. 255 !) - number of pages needed: 290 : 48 --> 7 - number of segments needed: 7 : 4 ------> 2 ON_PROJECT: 1 ACTIVITY: 1 == Sum 4 Segments Remark: Precise record length for 4 K: 4096 - 20 header - 2 trailer = 4074.But if only one record is stored, the max. length is 4056

Total number of pages needed: ----------------------------- 4 segments with 4 pages each: 16 pages plus HEADER and SPACEMAP PAGE: 18 pages

Step 22b: Calculate the number of tracksNumber of tracks needed: ------------------------ number of 4K pages per 3390 track: 12 pages number of 3390 tracks: 18:12 --> 2 tracks

Step 22c: Space allocatedAllocation typically defaults to 1 cylinder - depending on zparm TSQTY (amount of space in KB, 0 means default of 1 cyl.)

Use the IDCAMS command LISTCAT to retrieve the actual space allocated:

***************************** Top of Data ***********************//TSOUB01 JOB ,'TSOUB01',MSGLEVEL=(0,0),CLASS=A,NOTIFY=&SYSUID //* //* LISTCAT //* //IDCAMS EXEC PGM=IDCAMS,REGION=2500K //SYSPRINT DD SYSOUT=* //SYSIN DD * LISTCAT LEVEL (DBDSNB.*.WWV8301D.TSPROJ) ALL // **************************** Bottom of Data *********************

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-120 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 188: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 22

c: L

IST

CA

T o

utpu

t (1

of 2

)

1IDCAMS SYSTEM SERVICES TIME: 23:25:41 08/29/11 PAGE 1

0 LISTCAT LEVEL (DBDSNB.*.WWV8301D.TSPROJ) ALL

1IDCAMS SYSTEM SERVICES TIME: 23:25:41 08/29/11 PAGE 2

- LISTING FROM CATALOG -- ICFCAT.MVSW20.UCAT

0CLUSTER ------- DBDSNB.DSNDBC.WWV8301D.TSPROJ.I0001.A001

IN-CAT --- ICFCAT.MVSW20.UCAT

HISTORY

DATASET-OWNER----SYSPROG CREATION--------2011.241

RELEASE----------------2 EXPIRATION------0000.000

SMSDATA

STORAGECLASS --------DB2 MANAGEMENTCLASS-STANDARD

DATACLASS --------(NULL) LBACKUP ---0000.000.0000

CA-RECLAIM----------(NO)

EATTR-------------(NULL)

BWO STATUS------00000000 BWO TIMESTAMP---00000 00:00:00.0

BWO---------------(NULL)

RLSDATA

LOG ----------------(NULL) RECOVERY REQUIRED --(NO) FRLOG ------------(NULL)

VSAM QUIESCED -------(NO) RLS IN USE ---------(NO)

0 LOGSTREAMID-----------------------------(NULL)

RECOVERY TIMESTAMP LOCAL-----X'0000000000000000'

RECOVERY TIMESTAMP GMT-------X'0000000000000000'

PROTECTION-PSWD-----(NULL) RACF----------------(NO)

ASSOCIATIONS

DATA-----DBDSNB.DSNDBD.WWV8301D.TSPROJ.I0001.A001

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-121

Page 189: CV8317XSTUD

Student Exercises

.

Ste

p 22

c: L

IST

CA

T o

utpu

t (2

of 2

)

0DATA ---------- DBDSNB.DSNDBD.WWV8301D.TSPROJ.I0001.A001

IN-CAT --- ICFCAT.MVSW20.UCAT

HISTORY

DATASET-OWNER----SYSPROG CREATION--------2011.241

RELEASE----------------2 EXPIRATION------0000.000

ACCOUNT-INFO-----------------------------------(NULL)

PROTECTION-PSWD-----(NULL) RACF----------------(NO)

ASSOCIATIONS

CLUSTER--DBDSNB.DSNDBC.WWV8301D.TSPROJ.I0001.A001

ATTRIBUTES

KEYLEN-----------------0 AVGLRECL---------------0 BUFSPACE------------8192 CISIZE--------------4096

RKP--------------------0 MAXLRECL---------------0 EXCPEXIT----------(NULL) CI/CA----------------180

SHROPTNS(3,3) SPEED UNIQUE NOERASE LINEAR NOWRITECHK NOIMBED NOREPLICAT

UNORDERED REUSE NONSPANNED

STATISTICS

REC-TOTAL--------------0 SPLITS-CI--------------0 EXCPS------------------0

REC-DELETED------------0 SPLITS-CA--------------0 EXTENTS----------------1

REC-INSERTED-----------0 FREESPACE-%CI----------0 SYSTEM-TIMESTAMP:

REC-UPDATED------------0 FREESPACE-%CA----------0 X'0000000000000000'

REC-RETRIEVED----------0 FREESPC----------------0

ALLOCATION

SPACE-TYPE------CYLINDER HI-A-RBA----------737280

SPACE-PRI--------------1 HI-U-RBA-----------61440

SPACE-SEC--------------1

VOLUME

1IDCAMS SYSTEM SERVICES TIME: 23:25:41 08/29/11 PAGE 3

- LISTING FROM CATALOG -- ICFCAT.MVSW20.UCAT

0 VOLSER------------SMS012 PHYREC-SIZE---------4096 HI-A-RBA----------737280 EXTENT-NUMBER----------1

DEVTYPE------X'3010200F' PHYRECS/TRK-----------12 HI-U-RBA-----------61440 EXTENT-TYPE--------X'40'

VOLFLAG------------PRIME TRACKS/CA-------------15

EXTENTS:

LOW-CCHH-----X'041B0000' LOW-RBA----------------0 TRACKS----------------15

HIGH-CCHH----X'041B000E' HIGH-RBA----------737279

1IDCAMS SYSTEM SERVICES TIME: 23:25:41 08/29/11 PAGE 4

- LISTING FROM CATALOG -- ICFCAT.MVSW20.UCAT

0 THE NUMBER OF ENTRIES PROCESSED WAS:

AIX -------------------0

ALIAS -----------------0

CLUSTER ---------------1

DATA ------------------1

GDG -------------------0

INDEX -----------------0

NONVSAM ---------------0

PAGESPACE -------------0

PATH ------------------0

SPACE -----------------0

USERCATALOG -----------0

TAPELIBRARY -----------0

TAPEVOLUME ------------0

TOTAL -----------------2

0 THE NUMBER OF PROTECTED ENTRIES SUPPRESSED WAS 0

0IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0

1IDCAMS SYSTEM SERVICES TIME: 23:25:41 08/29/11 PAGE 5

0 0IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-122 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 190: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 23 (optional): Restart a REORG utility

Step 23a: False primary space specification

---------+---------+---------+---------+---------+---------+ ALTER INDEX TSOUB01.IXLOCN1 PRIQTY 999999999 ; ---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-123

Page 191: CV8317XSTUD

Student Exercises

.

Step 23b: Trial to reorganize TSLOCN

TSOUB01.DSNURGT.CNTL Columns 00 ===> Scroll ***************************** Top of Data ********************//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=TSOUB01,REGION=0M //* //* //UTIL EXEC DSNBUPRC,SYSTEM=DSNB,UID='TSOUB01',UTPROC='' //* //********************************************** //* //* GENERATING JCL FOR THE REORG TABLESPACE UTILITY //* DATE: 08/29/11 TIME: 23:36:29 //* //********************************************** //* //DSNUPROC.SORTWK01 DD DSN=TSOUB01.SORTWK01, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK02 DD DSN=TSOUB01.SORTWK02, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK03 DD DSN=TSOUB01.SORTWK03, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTWK04 DD DSN=TSOUB01.SORTWK04, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSREC DD DSN=TSOUB01.CV83.TSLOCN.REORG.SYSREC1,// DISP=(MOD,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSUT1 DD DSN=TSOUB01.SYSUT1, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SORTOUT DD DSN=TSOUB01.SORTOUT, // DISP=(MOD,DELETE,CATLG), // SPACE=(16384,(20,20),,,ROUND), // UNIT=SYSDA //DSNUPROC.SYSIN DD * REORG TABLESPACE WWV8301D.TSLOCN // **************************** Bottom of Data *******

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-124 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 192: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 23

b: P

artia

l job

out

put o

f the

uns

ucce

ssfu

l RE

OR

G T

AB

LES

PA

CE

util

ity

1 J E S 2 J O B L O G -- S Y S T E M D I 1 1 -- N O D E M V S D I 1 1

0 23.36.45 JOB00492 ---- MONDAY, 29 AUG 2011 ----

23.36.45 JOB00492 IRR010I USERID TSOUB01 IS ASSIGNED TO THIS JOB.

23.36.45 JOB00492 ICH70001I TSOUB01 LAST ACCESS AT 23:25:41 ON MONDAY, AUGUST 29, 2011

23.36.45 JOB00492 $HASP373 TSOUB011 STARTED - INIT 1 - CLASS A - SYS DI11

23.36.48 JOB00492 IEF450I TSOUB011 DSNUPROC UTIL - ABEND=S04E U0000 REASON=00E40305 066

066 TIME=23.36.48

23.36.48 JOB00492 - -----TIMINGS (MINS.)------ -----PAGING COUNTS----

23.36.48 JOB00492 -STEPNAME PROCSTEP RC EXCP CONN TCB SRB CLOCK SERV WORKLOAD PAGE SWAP VIO

SWAPS

23.36.48 JOB00492 -UTIL DSNUPROC *S04E 673 33 .00 .00 .0 147 BATCH 0 0 0 0

23.36.48 JOB00492 -TSOUB011 ENDED. NAME-TSOUB01 JOB TOTAL TCB CPU TIME= .00 TOTAL ELAPSED TIME= .0

23.36.48 JOB00492 $HASP395 TSOUB011 ENDED

0------ JES2 JOB STATISTICS ------

- 29 AUG 2011 JOB EXECUTION DATE

- 43 CARDS READ

- 245 SYSOUT PRINT RECORDS

- 0 SYSOUT PUNCH RECORDS

- 16 SYSOUT SPOOL KBYTES

- 0.04 MINUTES EXECUTION TIME

..........

etc

..........

..........

1DSNU000I 241 23:36:45.78 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 23:36:45.80 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 241 23:36:45.81 DSNUGUTC - REORG TABLESPACE WWV8301D.TSLOCN

DSNU252I 241 23:36:45.86 DSNURULD - UNLOAD PHASE STATISTICS - NUMBER OF RECORDS UNLOADED=4 FOR TABLESPACE

WWV8301D.TSLOCN

DSNU250I 241 23:36:45.86 DSNURULD - UNLOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

-DSNT500I 241 23:36:46.13 DSNUGBAC - RESOURCE UNAVAILABLE

REASON 00D70025

TYPE 00000220

NAME DBDSNB.DSNDBC.WWV8301D.IXLOCN1.I0001.A001

-DSNU017I 241 23:36:46.13 DSNUGBAC - UTILITY DATA BASE SERVICES MEMORY EXECUTION ABENDED, REASON=X'00E40305'

CAUSE=X'00D70025'

On

ly t

he

UN

LO

AD

ph

ase

has

bee

n p

erfo

rmed

.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-125

Page 193: CV8317XSTUD

Student Exercises

.

The result of the stopped utility

---------+---------+---------+---------+---------+---------+---------+---------+SELECT * FROM LOCATION ---------+---------+---------+---------+---------+---------+---------+---------+LOCID ADDRESS CITY POSTAL_CODE COUNTRY---------+---------+---------+---------+---------+---------+---------+---------+DSNE610I NUMBER OF ROWS DISPLAYED IS 0 DSNT408I SQLCODE = -904, ERROR: UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE. REASON 00C90082, TYPE OF RESOURCE 00000200, AND RESOURCE NAME WWV8301D.TSLOCN DSNT418I SQLSTATE = 57011 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXRRC SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 102 13172746 0 13223106 -974970878 12714050 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000066' X'00C9000A' X'00000000' X'00C9C4C2' X'C5E32002' X'00C20042' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+

-DIS DB(WWV8301D) SPACE(*)

DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 20180 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSDEPT TS 0001 RW TSDEPT TS RW TSEMPL TS 0001 RW -THRU 0003 TSEMPL TS RW TSEXCEPT TS RW,AREO* TSLOCN TS RW,RECP,UTUT TSPROJ TS RW IXACTY1 IX RW IXACTY2 IX RW IXDEPT1 IX L0001 RW IXDEPT1 IX L* RW IXDEPT2 IX L0001 RW IXDEPT2 IX L* RW IXDEPT3 IX L0001 RW IXDEPT3 IX L* RW IXEMPL1 IX 0001 RW -THRU 0003 IXEMPL1 IX RW IXEMPL2 IX L0001 RW -THRU 0003 IXEMPL2 IX L* RW IXEMPL3 IX L0001 RW -THRU 0003 IXEMPL3 IX L* RW

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-126 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 194: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

IXLOCN1 IX RW,RBDP,UTUT IXONPR1 IX RW IXONPR2 IX RW IXPROJ1 IX RW IXPROJ2 IX RW IXPROJ3 IX RW ******* DISPLAY OF DATABASE WWV8301D ENDED **********************DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

Display utility:

DSNU100I -DSNB DSNUGDIS - USERID = TSOUB01 MEMBER = UTILID = TSOUB01 PROCESSING UTILITY STATEMENT 1 UTILITY = REORG PHASE = RELOAD COUNT = 0 NUMBER OF OBJECTS IN LIST = 1 LAST OBJECT STARTED = 1 STATUS = STOPPED DSN9022I -DSNB DSNUGCCC '-DISPLAY UTILITY' NORMAL COMPLETION ***

The unload phase was successful:

TSOUB01.CV83.TSLOCN.REORG.SYSREC1 Columns 0 ===> Scroll***************************** Top of Data ******************* ` DE71083-01AM FICHTENBERG 1 HERRENBERG ... ` US95141-B4555 BAILEY AVENUE SAN JOSE ... ` US95141-C2555 BAILEY AVENUE SAN JOSE ... ` US95193-505600 COTTLE ROAD SAN JOSE ... **************************** Bottom of Data *****************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-127

Page 195: CV8317XSTUD

Student Exercises

.

Step 23c: Correct the problem---------+---------+---------+---------+---------+---------+ ALTER INDEX TSOUB01.IXLOCN1 PRIQTY 10 ; ---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+

Generate the restart job:

DB2 UTILITIES SSID: DSNB ===> Select from the following: 1 FUNCTION ===> EDITJCL (SUBMIT job, EDITJCL, DISPLAY, TERMINATE) 2 JOB ID ===> TSOUB01 (A unique job identifier string) 3 UTILITY ===> REORG TABLESPACE (CHECK DATA, CHECK INDEX, CHECK LOB, COPY, DIAGNOSE, LOAD, MERGE, MODIFY, QUIESCE, REBUILD, RECOVER, REORG INDEX, REORG LOB, REORG TABLESPACE, REPORT, REPAIR, RUNSTATS, STOSPACE, UNLOAD) 4 STATEMENT DATA SET ===> CV83.CNTL(REORGCT2) 5 RESTART ===> NO (NO, CURRENT, PHASE or PREVIEW) 6 LISTDEF? (YES|NO) ===> NO TEMPLATE? (YES|NO) ===> NO 7 LIB ==> (BLANK or DB2 Library name).

* The data set names panel will be displayed when required by a utility.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-128 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 196: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

The restart job:

TSOUB01.DSNURGT.CNTL ===> ***************************** Top of Data ******************//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1),// CLASS=A,MSGCLASS=Q,NOTIFY=TSOUB01,REGION=0M //* //* //UTIL EXEC DSNBUPRC,SYSTEM=DSNB,UID='TSOUB01',UTPROC='' //* //********************************************** //* //* GENERATING JCL FOR THE REORG TABLESPACE UTILITY //* DATE: 08/29/11 TIME: 23:57:31 //* //********************************************** //* //DSNUPROC.SORTWK01 DD DSN=TSOUB01.SORTWK01, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SORTWK02 DD DSN=TSOUB01.SORTWK02, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SORTWK03 DD DSN=TSOUB01.SORTWK03, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SORTWK04 DD DSN=TSOUB01.SORTWK04, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SYSREC DD DSN=TSOUB01.CV83.TSLOCN.REORG.SYSREC1,// DISP=(MOD,CATLG) //DSNUPROC.SYSUT1 DD DSN=TSOUB01.SYSUT1, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SORTOUT DD DSN=TSOUB01.SORTOUT, // DISP=(MOD,DELETE,CATLG) //DSNUPROC.SYSIN DD * REORG TABLESPACE WWV8301D.TSLOCN // **************************** Bottom of Data ****************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-129

Page 197: CV8317XSTUD

Student Exercises

.

Ste

p 23

c: P

artia

l job

out

put o

f the

suc

cess

ful R

EO

RG

TA

BLE

SP

AC

E u

tility

1 J E S 2 J O B L O G -- S Y S T E M D I 1 1 -- N O D E M V S D I 1 1

0 23.57.36 JOB00493 ---- MONDAY, 29 AUG 2011 ----

23.57.36 JOB00493 IRR010I USERID TSOUB01 IS ASSIGNED TO THIS JOB.

23.57.36 JOB00493 ICH70001I TSOUB01 LAST ACCESS AT 23:36:45 ON MONDAY, AUGUST 29, 2011

23.57.36 JOB00493 $HASP373 TSOUB011 STARTED - INIT 1 - CLASS A - SYS DI11

23.57.37 JOB00493 - -----TIMINGS (MINS.)------ -----PAGING COUNTS----

23.57.37 JOB00493 -STEPNAME PROCSTEP RC EXCP CONN TCB SRB CLOCK SERV WORKLOAD PAGE SWAP VIO

SWAPS

23.57.37 JOB00493 -UTIL DSNUPROC 00 694 39 .00 .00 .0 116 BATCH 0 0 0 0

23.57.37 JOB00493 -TSOUB011 ENDED. NAME-TSOUB01 JOB TOTAL TCB CPU TIME= .00 TOTAL ELAPSED TIME= .0

23.57.37 JOB00493 $HASP395 TSOUB011 ENDED

0------ JES2 JOB STATISTICS ------

- 29 AUG 2011 JOB EXECUTION DATE

- 29 CARDS READ

- 212 SYSOUT PRINT RECORDS

- 0 SYSOUT PUNCH RECORDS

- 14 SYSOUT SPOOL KBYTES

- 0.00 MINUTES EXECUTION TIME

..............

etc

..............

..............

1DSNU000I 241 23:57:36.92 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 241 23:57:36.95 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

DSNU021I -DSNB 241 23:57:36.95 DSNUGASU - REORG UTILITY WITH UTILID = TSOUB01 ENDED IN PHASE = RELOAD, WILL ATTEMPT TO

RESTART(CURRENT)

0DSNU050I 241 23:57:36.95 DSNUGUTC - REORG TABLESPACE WWV8301D.TSLOCN

DSNU021I -DSNB 241 23:57:36.95 DSNURFIT - REORG UTILITY WITH UTILID = TSOUB01 ENDED IN PHASE = RELOAD, WILL ATTEMPT TO

RESTART(PHASE)

DSNU304I -DSNB 241 23:57:37.21 DSNURWT - (RE)LOAD PHASE STATISTICS - NUMBER OF RECORDS=4 FOR TABLE TSOUB01.LOCATION

DSNU302I 241 23:57:37.22 DSNURILD - (RE)LOAD PHASE STATISTICS - NUMBER OF INPUT RECORDS PROCESSED=4

DSNU300I 241 23:57:37.22 DSNURILD - (RE)LOAD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU042I 241 23:57:37.22 DSNUGSOR - SORT PHASE STATISTICS -

NUMBER OF RECORDS=4

ELAPSED TIME=00:00:00

DSNU349I -DSNB 241 23:57:37.36 DSNURBXA - BUILD PHASE STATISTICS - NUMBER OF KEYS=4 FOR INDEX TSOUB01.IXLOCN1

DSNU258I 241 23:57:37.36 DSNURBXD - BUILD PHASE STATISTICS - NUMBER OF INDEXES=1

DSNU259I 241 23:57:37.36 DSNURBXD - BUILD PHASE COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 241 23:57:37.38 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-130 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 198: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

The second job has performed the RELOAD, SORT, and BUILD phases.

The data in the table space is available again:

DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 20180 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSDEPT TS 0001 RW TSDEPT TS RW TSEMPL TS 0001 RW -THRU 0003 TSEMPL TS RW TSEXCEPT TS RW,AREO* TSLOCN TS RW ...... IXLOCN1 IX RW ...... ******* DISPLAY OF DATABASE WWV8301D ENDED ********************** DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

---------+---------+---------+---------+---------+---------+---------...SELECT * FROM LOCATION ...---------+---------+---------+---------+---------+---------+---------...LOCID ADDRESS CITY POSTAL_CODE ...---------+---------+---------+---------+---------+---------+---------...DE71083-01 AM FICHTENBERG 1 HERRENBERG D-71083 ...US95141-B4 555 BAILEY AVENUE SAN JOSE CA 95141 ...US95141-C2 555 BAILEY AVENUE SAN JOSE CA 95141 ...US95193-50 5600 COTTLE ROAD SAN JOSE CA 95193 ...DSNE610I NUMBER OF ROWS DISPLAYED IS 4

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-131

Page 199: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-132 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 200: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 8: Running COPY and RECOVER

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-133

Page 201: CV8317XSTUD

Student Exercises

.

Ste

p 1:

CO

PY

sta

tem

ent (

full

copi

es)

COPY TABLESPACE WWV8301D.TSEMPL FULL YES

COPYDDN(,SYSCOPY2)

Ste

p 2:

DB

2I D

ata

Set

Nam

es P

anel

for

CO

PY

DATA SET NAMES SSID:

===>

Enter data set name for LOAD, REORG TABLESPACE, or UNLOAD:

1 RECDSN ===>

Enter data set name for LOAD or REORG TABLESPACE:

2 DISCDSN ===>

Enter output data sets for local/current site for COPY, MERGECOPY,

LOAD, or REORG TABLESPACE:

3 COPYDSN ===> CV83.TSEMPL.FIC1A

4 COPYDSN2 ===> CV83.TSEMPL.FIC1B

Enter output data sets for recovery site for COPY, LOAD, or REORG

TABLESPACE:

5 RCPYDSN1 ===>

6 RCPYDSN2 ===>

Enter output data sets for REORG or UNLOAD

7 PUNCHDSN ===>

Ste

p 2:

Par

tial C

OP

Y jo

b

//DSNUPROC.SYSCOPY DD DSN=TSOUB01.CV83.TSEMPL.FIC1A,

// DISP=(MOD,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

//DSNUPROC.SYSCOPY2 DD DSN=TSOUB01.CV83.TSEMPL.FIC1B,

// DISP=(MOD,CATLG),

// SPACE=(16384,(20,20),,,ROUND),

// UNIT=SYSDA

//DSNUPROC.SYSIN DD *

COPY TABLESPACE WWV8301D.TSEMPL FULL YES

COPYDDN(,SYSCOPY2)

//

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-134 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 202: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 3:

CO

PY

util

ity o

utpu

t (fu

ll co

pies

)

1DSNU000I 242 02:34:37.33 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 02:34:37.36 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 02:34:37.36 DSNUGUTC - COPY TABLESPACE WWV8301D.TSEMPL FULL YES COPYDDN(, SYSCOPY2)

DSNU400I 242 02:34:37.44 DSNUBBID - COPY PROCESSED FOR TABLESPACE WWV8301D.TSEMPL

NUMBER OF PAGES=9

AVERAGE PERCENT FREE SPACE PER PAGE = 22.88

PERCENT OF CHANGED PAGES = 1.66

ELAPSED TIME=00:00:00

DSNU428I -DSNB 242 02:34:37.45 DSNUBAFI - DB2 IMAGE COPY SUCCESSFUL FOR TABLESPACE WWV8301D.TSEMPL

DSNU010I 242 02:34:37.46 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Ste

p 4:

Upd

ate

EM

PLO

YE

E ta

ble

UPDATE EMPLOYEE

SET SALARY = SALARY+10000

WHERE EMPNO IN ('000030','000280')

---------+---------+---------+---------+---------+---------+---------+---------+

DSNE615I NUMBER OF ROWS AFFECTED IS 2

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

---------+---------+---------+---------+---------+---------+---------+---------+

Ste

ps 5

- 7

: CO

PY

util

ity o

utpu

t (in

crem

enta

l cop

ies)

1DSNU000I 242 02:43:21.93 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 02:43:21.95 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 02:43:21.96 DSNUGUTC - COPY TABLESPACE WWV8301D.TSEMPL FULL NO COPYDDN(, SYSCOPY2)

DSNU400I 242 02:43:22.01 DSNUBBID - COPY PROCESSED FOR TABLESPACE WWV8301D.TSEMPL

NUMBER OF PAGES=6

AVERAGE PERCENT FREE SPACE PER PAGE = 21.66

PERCENT OF CHANGED PAGES = 0.74

ELAPSED TIME=00:00:00

DSNU428I -DSNB 242 02:43:22.03 DSNUBAFI - DB2 IMAGE COPY SUCCESSFUL FOR TABLESPACE WWV8301D.TSEMPL

DSNU010I 242 02:43:22.04 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Ste

p 8:

Exe

cute

sam

e U

PD

AT

E s

tate

men

t as

in s

tep

4 ab

ove

(out

put n

ot d

epic

ted)

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-135

Page 203: CV8317XSTUD

Student Exercises

.

Ste

ps 9

to 1

0: Q

uery

SY

SC

OP

Y c

atal

og ta

ble

---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-----

SELECT DBNAME,TSNAME,DSNUM,ICTYPE,SHRLEVEL,ICBACKUP,

HEX(START_RBA) AS HEX_START_RBA,TIMESTAMP,

SUBSTR(DSNAME,1,25) AS DATA_SET_NAME

FROM SYSIBM.SYSCOPY

WHERE DBNAME = 'WWV8301D'

AND TSNAME = 'TSEMPL'

ORDER BY TIMESTAMP,ICBACKUP,DSNUM

WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-----

DBNAME TSNAME DSNUM ICTYPE SHRLEVEL ICBACKUP HEX_START_RBA TIMESTAMP DATA_SET_NAME

---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+-----

WWV8301D TSEMPL 0 C 000005424454 2011-08-26-02.18.40.986776 WWV8301D.TSEMPL

WWV8301D TSEMPL 1 Z 0000059E01B6 2011-08-27-13.01.37.927432 WWV8301D.TSEMPL

WWV8301D TSEMPL 2 Z 0000059E01B6 2011-08-27-13.01.37.927432 WWV8301D.TSEMPL

WWV8301D TSEMPL 3 Z 0000059E01B6 2011-08-27-13.01.37.927432 WWV8301D.TSEMPL

WWV8301D TSEMPL 0 F R 00000667AD5A 2011-08-30-02.34.37.449155 TSOUB01.CV83.TSEMPL.FIC1A

WWV8301D TSEMPL 0 F R LB 00000667AD5A 2011-08-30-02.34.37.449448 TSOUB01.CV83.TSEMPL.FIC1B

WWV8301D TSEMPL 0 I R 0000066D6F47 2011-08-30-02.43.22.027921 TSOUB01.CV83.TSEMPL.IIC1A

WWV8301D TSEMPL 0 I R LB 0000066D6F47 2011-08-30-02.43.22.028189 TSOUB01.CV83.TSEMPL.IIC1B

DSNE610I NUMBER OF ROWS DISPLAYED IS 8

DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100

Ste

ps 1

1 to

13:

RE

CO

VE

R u

tility

out

put

1DSNU000I 242 03:07:49.03 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 03:07:49.06 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 03:07:49.06 DSNUGUTC - RECOVER TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:07:49.07 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.FIC1A WITH DATE=20110830 AND

TIME=023437

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:07:49.08 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.IIC1A WITH DATE=20110830 AND

TIME=024322

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU504I 242 03:07:49.47 DSNUCBMD - MERGE STATISTICS FOR TABLESPACE WWV8301D.TSEMPL -

NUMBER OF COPIES=2

NUMBER OF PAGES MERGED=9

ELAPSED TIME=00:00:00

DSNU513I -DSNB 242 03:07:49.48 DSNUCALA - RECOVER UTILITY LOG APPLY RANGE IS RBA 0000066E21DA LRSN 0000066E21DA TO

RBA 0000066E2AA5 LRSN 0000066E2AA5

DSNU1510I 242 03:07:49.49 DSNUCBLA - LOG APPLY PHASE COMPLETE, ELAPSED TIME = 00:00:00

DSNU500I 242 03:07:49.52 DSNUCBDR - RECOVERY COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 242 03:07:49.52 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-136 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 204: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Question related to recovery:

Step 14: Which image copies are used by the RECOVER utility?TSOUB01.CV83.TSEMPL.FIC1ATSOUB01.CV83.TSEMPL.IIC1A

Step 15: Why must the RECOVER utility apply log records after restoring the image copies?

The RECOVER utility must apply the log records which represent the update performed after the incremental image copies were taken.

Step 16: Delete the primary incremental image copy TSOUB01.CV83.TSEMPL.IIC1A in 3.4:

TSOUB01.CV83.TSEMPL.FIC1A TSOUB01.CV83.TSEMPL.FIC1B d TSOUB01.CV83.TSEMPL.IIC1A TSOUB01.CV83.TSEMPL.IIC1B TSOUB01.CV83.TSLOCN.DATA

Result:

TSOUB01.CV83.TSEMPL.FIC1A TSOUB01.CV83.TSEMPL.FIC1B TSOUB01.CV83.TSEMPL.IIC1A Deleted TSOUB01.CV83.TSEMPL.IIC1B TSOUB01.CV83.TSLOCN.DATA TSOUB01.CV83.TSLOCN.DISCARD

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-137

Page 205: CV8317XSTUD

Student Exercises

.

Ste

p 17

: Exe

cute

the

sam

e R

EC

OV

ER

job

as in

ste

p 11

-13;

out

put

1DSNU000I 242 03:12:24.20 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 03:12:24.22 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 03:12:24.23 DSNUGUTC - RECOVER TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:12:24.24 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.FIC1A WITH DATE=20110830 AND

TIME=023437

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:12:24.25 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.IIC1A WITH DATE=20110830 AND

TIME=024322

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU030I 242 03:12:24.25 DSNUCBAL - UNABLE TO ALLOCATE TSOUB01.CV83.TSEMPL.IIC1A, RC=4, CODE=X'17080002'

DSNU541I 242 03:12:24.25 DSNUCBAL - UNABLE TO ALLOCATE THE PRIMARY COPY DATASET

TSOUB01.CV83.TSEMPL.IIC1A, BACKUP COPY IS USED

DSNU515I 242 03:12:24.25 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.IIC1B WITH DATE=20110830 AND

TIME=024322

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU504I 242 03:12:24.61 DSNUCBMD - MERGE STATISTICS FOR TABLESPACE WWV8301D.TSEMPL -

NUMBER OF COPIES=2

NUMBER OF PAGES MERGED=9

ELAPSED TIME=00:00:00

DSNU513I -DSNB 242 03:12:24.62 DSNUCALA - RECOVER UTILITY LOG APPLY RANGE IS RBA 0000066E21DA LRSN 0000066E21DA TO

RBA 0000066E2AA5 LRSN 0000066E2AA5

DSNU1510I 242 03:12:24.62 DSNUCBLA - LOG APPLY PHASE COMPLETE, ELAPSED TIME = 00:00:00

DSNU500I 242 03:12:24.65 DSNUCBDR - RECOVERY COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 242 03:12:24.66 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Ste

p 18

: Res

pons

e of

the

RE

CO

VE

R u

tility

The dynamic allocaion of the primary incremental copy fails.

Therefore DB2 allocates the backup incremental copy.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-138 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 206: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 19

: Del

ete

the

back

up in

crem

enta

l cop

y, to

o

Similar to step 16

Ste

p 20

: Exe

cute

the

sam

e R

EC

OV

ER

job

as in

ste

p 11

-13;

out

put

1DSNU000I 242 03:16:24.34 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 03:16:24.36 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 03:16:24.37 DSNUGUTC - RECOVER TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:16:24.38 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.FIC1A WITH DATE=20110830 AND

TIME=023437

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU515I 242 03:16:24.39 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.IIC1A WITH DATE=20110830 AND

TIME=024322

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU030I 242 03:16:24.39 DSNUCBAL - UNABLE TO ALLOCATE TSOUB01.CV83.TSEMPL.IIC1A, RC=4, CODE=X'17080002'

DSNU541I 242 03:16:24.39 DSNUCBAL - UNABLE TO ALLOCATE THE PRIMARY COPY DATASET

TSOUB01.CV83.TSEMPL.IIC1A, BACKUP COPY IS USED

DSNU515I 242 03:16:24.39 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.IIC1B WITH DATE=20110830 AND

TIME=024322

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL

DSNU030I 242 03:16:24.39 DSNUCBAL - UNABLE TO ALLOCATE TSOUB01.CV83.TSEMPL.IIC1B, RC=4, CODE=X'17080002'

DSNU504I 242 03:16:24.75 DSNUCBMD - MERGE STATISTICS FOR TABLESPACE WWV8301D.TSEMPL -

NUMBER OF COPIES=1

NUMBER OF PAGES MERGED=9

ELAPSED TIME=00:00:00

DSNU513I -DSNB 242 03:16:24.76 DSNUCALA - RECOVER UTILITY LOG APPLY RANGE IS RBA 000006688A00 LRSN 000006688A00 TO

RBA 000006689563 LRSN 000006689563

DSNU513I -DSNB 242 03:16:24.76 DSNUCALA - RECOVER UTILITY LOG APPLY RANGE IS RBA 0000066E21DA LRSN 0000066E21DA TO

RBA 0000066E2AA5 LRSN 0000066E2AA5

DSNU1510I 242 03:16:24.77 DSNUCBLA - LOG APPLY PHASE COMPLETE, ELAPSED TIME = 00:00:00

DSNU500I 242 03:16:24.79 DSNUCBDR - RECOVERY COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 242 03:16:24.80 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-139

Page 207: CV8317XSTUD

Student Exercises

.

Question related to recovery after deleting backup incremental copy:

Step 21: Response of the recover utility?

The recovery utility must rely on the full image copies, as no incremental copy exists.

Step 22: Why must the RECOVER utility apply an additional range of log records?

The additional range of log records represent the update performed before the incremental image copies were taken.

Optional lab:

Step 23a: Copy the first partition only of table space TSEMPL********************************* TOP OF DATA **********************************DSNU000I 242 04:22:51.64 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01DSNU1044I 242 04:22:51.67 DSNUGTIS - PROCESSING SYSIN AS EBCDICDSNU050I 242 04:22:51.67 DSNUGUTC - COPY TABLESPACE WWV8301D.TSEMPL DSNUM 1DSNU400I 242 04:22:51.72 DSNUBBID - COPY PROCESSED FOR TABLESPACE WWV8301D.TSEMPL DSNUM 1 NUMBER OF PAGES=3 AVERAGE PERCENT FREE SPACE PER PAGE = 20.66 PERCENT OF CHANGED PAGES = 33.33 ELAPSED TIME=00:00:00DSNU428I -DSNB 242 04:22:51.73 DSNUBAFI - DB2 IMAGE COPY SUCCESSFUL FOR TABLESPACE WWV8301D.TSEMPL DSNUM 1DSNU010I 242 04:22:51.74 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

******************************** BOTTOM OF DATA ********************************

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-140 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 208: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 23b: LISTCAT job

TSOUB01.CV83.CNTL(L8LISTC) - 01.00 ===> ***************************** Top of Data **********************//TSOUB01L JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID,REGION=0M //*******************************************************************//* *//*******************************************************************//* //* LISTCAT //* //IDCAMS EXEC PGM=IDCAMS,REGION=2500K //SYSPRINT DD SYSOUT=* //SYSIN DD * LISTCAT LEVEL (DBDSNB.*.WWV8301D.TSEMPL) ALL // **************************** Bottom of Data ********************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-141

Page 209: CV8317XSTUD

Student Exercises

.

Ste

p 23

b: P

artia

l LIS

TC

AT

out

put f

or T

SE

MP

L, 1

of 2

1IDCAMS SYSTEM SERVICES TIME: 04:28:00 08/30/11 PAGE 1

0 LISTCAT LEVEL (DBDSNB.*.WWV8301D.TSEMPL) ALL

1IDCAMS SYSTEM SERVICES TIME: 04:28:00 08/30/11 PAGE 2

- LISTING FROM CATALOG -- ICFCAT.MVSW20.UCAT

0CLUSTER ------- DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001

IN-CAT --- ICFCAT.MVSW20.UCAT

HISTORY

DATASET-OWNER----SYSPROG CREATION--------2011.242

RELEASE----------------2 EXPIRATION------0000.000

SMSDATA

STORAGECLASS --------DB2 MANAGEMENTCLASS-STANDARD

DATACLASS --------(NULL) LBACKUP ---0000.000.0000

CA-RECLAIM----------(NO)

EATTR-------------(NULL)

BWO STATUS------00000000 BWO TIMESTAMP---00000 00:00:00.0

BWO---------------(NULL)

RLSDATA

LOG ----------------(NULL) RECOVERY REQUIRED --(NO) FRLOG ------------(NULL)

VSAM QUIESCED -------(NO) RLS IN USE ---------(NO)

0 LOGSTREAMID-----------------------------(NULL)

RECOVERY TIMESTAMP LOCAL-----X'0000000000000000'

RECOVERY TIMESTAMP GMT-------X'0000000000000000'

PROTECTION-PSWD-----(NULL) RACF----------------(NO)

ASSOCIATIONS

DATA-----DBDSNB.DSNDBD.WWV8301D.TSEMPL.I0001.A001

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-142 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 210: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 23

b: P

artia

l LIS

TC

AT

out

put f

or T

SE

MP

L, 2

of 2

0DATA ---------- DBDSNB.DSNDBD.WWV8301D.TSEMPL.I0001.A001

IN-CAT --- ICFCAT.MVSW20.UCAT

HISTORY

DATASET-OWNER----SYSPROG CREATION--------2011.242

RELEASE----------------2 EXPIRATION------0000.000

ACCOUNT-INFO-----------------------------------(NULL)

PROTECTION-PSWD-----(NULL) RACF----------------(NO)

ASSOCIATIONS

CLUSTER--DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001

ATTRIBUTES

KEYLEN-----------------0 AVGLRECL---------------0 BUFSPACE------------8192 CISIZE--------------4096

RKP--------------------0 MAXLRECL---------------0 EXCPEXIT----------(NULL) CI/CA----------------180

SHROPTNS(3,3) SPEED UNIQUE NOERASE LINEAR NOWRITECHK NOIMBED NOREPLICAT

UNORDERED REUSE NONSPANNED

STATISTICS

REC-TOTAL--------------0 SPLITS-CI--------------0 EXCPS------------------0

REC-DELETED------------0 SPLITS-CA--------------0 EXTENTS----------------1

REC-INSERTED-----------0 FREESPACE-%CI----------0 SYSTEM-TIMESTAMP:

REC-UPDATED------------0 FREESPACE-%CA----------0 X'0000000000000000'

REC-RETRIEVED----------0 FREESPC----------------0

ALLOCATION

SPACE-TYPE------CYLINDER HI-A-RBA----------737280

SPACE-PRI--------------1 HI-U-RBA-----------12288

SPACE-SEC--------------1

VOLUME

1IDCAMS SYSTEM SERVICES TIME: 04:28:00 08/30/11 PAGE 3

- LISTING FROM CATALOG -- ICFCAT.MVSW20.UCAT

0 VOLSER------------SMS012 PHYREC-SIZE---------4096 HI-A-RBA----------737280 EXTENT-NUMBER----------1

DEVTYPE------X'3010200F' PHYRECS/TRK-----------12 HI-U-RBA-----------12288 EXTENT-TYPE--------X'40'

VOLFLAG------------PRIME TRACKS/CA-------------15

EXTENTS:

LOW-CCHH-----X'04180000' LOW-RBA----------------0 TRACKS----------------15

HIGH-CCHH----X'0418000E' HIGH-RBA----------737279

etc (DATA INFORMATION of other partitions)

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-143

Page 211: CV8317XSTUD

Student Exercises

.

All the partitions are on volume SMS012(the last two partitions are not depicted in the partial output above).

Step 23c: Trial to delete the VSAM cluster

TSOUB01.CV83.CNTL(L8DELC) - 01.00 Columns 0000 ===> Scroll ==***************************** Top of Data **********************//TSOUB01D JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID,REGION=0M //*******************************************************************//* *//*******************************************************************//* //* DELETE VSAM CLUSTER //* //IDCAMS EXEC PGM=IDCAMS,REGION=2500K //SYSPRINT DD SYSOUT=* //SYSIN DD * DEL DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 CL // **************************** Bottom of Data ********************

Result:

********************************* TOP OF DATA **********************************1IDCAMS SYSTEM SERVICES TIME: 04:44:03 08/30/11 PAGE 10 DEL DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 CL0IKJ56225I DATA SET DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 ALREADY IN IKJ56225I USE, TRY LATER IKJ56225I DATA SET IS ALLOCATED TO ANOTHER JOB OR USER IDC0551I ** ENTRY DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 NOT DELETED0IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 800IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 8

******************************** BOTTOM OF DATA ********************************

Data set is in use - by DB2.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-144 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 212: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 23d: Stop partition 1 via job (rather than DB2I)

TSOUB01.CV83.CNTL(L8DB2CMD) - 01.01 Col ===> ***************************** Top of Data *************//TSOUB011 JOB 1CV83G26,'TSOUB01 JOB ',MSGLEVEL=(1,1), // CLASS=A,MSGCLASS=Q,NOTIFY=&SYSUID,REGION=0M //*******************************************************************//* *//*******************************************************************//DB2CMD EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT) //STEPLIB DD DSN=DBDSNB.DB2A10.SDSNEXIT,DISP=SHR // DD DSN=DBDSNB.DB2A10.SDSNLOAD,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DSNB) -STOP DATABASE(WWV8301D) SPACENAM(TSEMPL) PART(1) -DISPLAY DATABASE(WWV8301D) SPACENAM(TSEMPL)END // **************************** Bottom of Data ***********

Result:

********************************* TOP OF DATA **************************1READY DSN SYSTEM(DSNB) DSN -STOP DATABASE(WWV8301D) SPACENAM(TSEMPL) PART(1) DSN9022I -DSNB DSNTDDIS 'STOP DATABASE' NORMAL COMPLETION DSN -DISPLAY DATABASE(WWV8301D) SPACENAM(TSEMPL) DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW DBD LENGTH = 20180 DSNT397I -DSNB NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE -------- ---- ----- ----------------- -------- -------- -------- ----- TSEMPL TS 0001 STOP TSEMPL TS 0002 RW -THRU 0003 TSEMPL TS STOP ******* DISPLAY OF DATABASE WWV8301D ENDED ********************** DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION DSN END READY END

******************************** BOTTOM OF DATA ************************

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-145

Page 213: CV8317XSTUD

Student Exercises

.

Same delete job as above, result:

********************************* TOP OF DATA **********************************IDCAMS SYSTEM SERVICES TIME: 05:12:28 DEL DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 CL IDC0550I ENTRY (D) DBDSNB.DSNDBD.WWV8301D.TSEMPL.I0001.A001 DELETED IDC0550I ENTRY (C) DBDSNB.DSNDBC.WWV8301D.TSEMPL.I0001.A001 DELETED IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0 IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0 ******************************** BOTTOM OF DATA ********************************

This way we have simulated an I/O error for partition 1.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-146 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 214: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 23e: We pretend that the defective volume has been replaced.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-147

Page 215: CV8317XSTUD

Student Exercises

.

Ste

p 23

f: F

irst t

rial t

o R

EC

OV

ER

....D

SN

UM

1

********************************* TOP OF DATA **********************************

1DSNU000I 242 05:15:29.51 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 05:15:29.54 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 05:15:29.54 DSNUGUTC - RECOVER TABLESPACE WWV8301D.TSEMPL DSNUM 1

DSNU590I -DSNB 242 05:15:29.55 DSNUGDTC - RESOURCE NOT AVAILABLE, REASON=X'00C90081', ON WWV8301D.TSEMPL PROHIBITS

PROCESSING

DSNU500I 242 05:15:29.55 DSNUCBDR - RECOVERY COMPLETE, ELAPSED TIME=00:00:00

DSNU012I 242 05:15:29.55 DSNUGBAC - UTILITY EXECUTION TERMINATED, HIGHEST RETURN CODE=8

******************************** BOTTOM OF DATA ********************************

Reason C90081 indicates: Object stopped.

Sta

rt th

e pa

rtiti

on:

1READY

DSN SYSTEM(DSNB)

DSN

-START DATABASE(WWV8301D) SPACENAM(TSEMPL) PART(1)

DSN9022I -DSNB DSNTDDIS 'START DATABASE' NORMAL COMPLETION

DSN

-DISPLAY DATABASE(WWV8301D) SPACENAM(TSEMPL)

DSNT360I -DSNB ***********************************

DSNT361I -DSNB * DISPLAY DATABASE SUMMARY

* GLOBAL

DSNT360I -DSNB ***********************************

DSNT362I -DSNB DATABASE = WWV8301D STATUS = RW

DBD LENGTH = 20180

DSNT397I -DSNB

NAME TYPE PART STATUS PHYERRLO PHYERRHI CATALOG PIECE

-------- ---- ----- ----------------- -------- -------- -------- -----

TSEMPL TS 0001 RW

-THRU 0003

TSEMPL TS RW

******* DISPLAY OF DATABASE WWV8301D ENDED **********************

DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION

DSN

END

READY

END

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-148 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 216: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 23

f: S

econ

d tr

ial t

o R

EC

OV

ER

....D

SN

UM

1

1DSNU000I 242 05:54:56.54 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 05:54:56.57 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 05:54:56.58 DSNUGUTC - RECOVER TABLESPACE WWV8301D.TSEMPL DSNUM 1

DSNU515I 242 05:54:56.59 DSNUCBAL - THE IMAGE COPY DATA SET TSOUB01.CV83.TSEMPL.PART1.FCOPY1 WITH DATE=20110830 AND

TIME=042251

IS PARTICIPATING IN RECOVERY OF TABLESPACE WWV8301D.TSEMPL DSNUM 1

DSNU504I 242 05:54:56.68 DSNUCBMD - MERGE STATISTICS FOR TABLESPACE WWV8301D.TSEMPL DSNUM 1 -

NUMBER OF COPIES=1

NUMBER OF PAGES MERGED=3

ELAPSED TIME=00:00:00

DSNU1511I -DSNB 242 05:54:56.68 DSNUCALA - FAST LOG APPLY WAS NOT USED FOR RECOVERY

DSNU1510I 242 05:54:56.68 DSNUCBLA - LOG APPLY PHASE COMPLETE, ELAPSED TIME = 00:00:00

DSNU500I 242 05:54:56.70 DSNUCBDR - RECOVERY COMPLETE, ELAPSED TIME=00:00:00

DSNU010I 242 05:54:56.70 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Note: The copy data set for the single partition was used.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-149

Page 217: CV8317XSTUD

Student Exercises

.

Step 24: Why stop and restart TSDEPT before second DSN1PRNT?

The data is externalized from buffer pool to disk asynchronously, even if an update is committed. When the table space is stopped, the table space is brought back to currency.

When performing a DSN1PRNT, an INSERT, and a second DSN1PRNT right away, you may observe that the INSERT is not reflected in the output of the second DSN1PRNT job.

Step 25: Clean up the system

1. Execute the REPORT RECOVERY utility.

It displays SYSCOPY entries, SYSLGRNX entries, and archive log information.

2. Execute the MODIFY RECOVERY utility.

Depending on the option and parameter you use, it deletes the requested records from SYSCOPY and some records from SYSLGRNX. If you specified, for example, AGE(*), the tablespace is set in COPY PENDING.

3. Execute the REPORT RECOVERY utility again.

You see fewer SYSCOPY, SYSLGRNX entries and less information about archive logs. It is possible that DB2 has no data at all to report.

See below for sample utility output for the three items in Step 25.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-150 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 218: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Ste

p 25

a: R

EP

OR

T u

tility

out

put

1DSNU000I 242 06:00:41.38 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 06:00:41.41 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 06:00:41.41 DSNUGUTC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN

DSNU581I -DSNB 242 06:00:41.42 DSNUPREC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN

DSNU593I -DSNB 242 06:00:41.42 DSNUPREC - REPORT RECOVERY ENVIRONMENT RECORD:

MINIMUM RBA: 000000000000

MAXIMUM RBA: FFFFFFFFFFFF

MIGRATING RBA: 000000000000

DSNU582I -DSNB 242 06:00:41.42 DSNUPPCP - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SYSCOPY ROWS

AND SYSTEM LEVEL BACKUPS

TIMESTAMP = 2011-08-26-02.18.40.182634, IC TYPE = *C*, SHR LVL = , DSNUM = 0000, START LRSN =00000541C7BC

DEV TYPE = , IC BACK = , STYPE = L, FILE SEQ = 0000, PIT LRSN = 000000000000

LOW DSNUM = 0000, HIGH DSNUM = 0000, OLDEST VERSION = 0000, LOGICAL PART = 0000, LOGGED = Y, TTYPE =

JOBNAME = , AUTHID = , COPYPAGESF = -1.0E+00

NPAGESF = -1.0E+00 , CPAGESF = -1.0E+00

DSNAME = WWV8301D.TSLOCN , MEMBER NAME = , INSTANCE = 01, RELCREATED = O

TIMESTAMP = 2011-08-26-07.52.56.678505, IC TYPE = *Z*, SHR LVL = , DSNUM = 0000, START LRSN =0000055D0F4A

DEV TYPE = , IC BACK = , STYPE = , FILE SEQ = 0000, PIT LRSN = 000000000000

LOW DSNUM = 0000, HIGH DSNUM = 0000, OLDEST VERSION = 0001, LOGICAL PART = 0000, LOGGED = Y, TTYPE =

JOBNAME = TSOUB011, AUTHID = TSOUB01 , COPYPAGESF = -1.0E+00

NPAGESF = -1.0E+00 , CPAGESF = -1.0E+00

DSNAME = WWV8301D.TSLOCN , MEMBER NAME = , INSTANCE = 01, RELCREATED = O

TIMESTAMP = 2011-08-29-23.57.37.198074, IC TYPE = *X*, SHR LVL = , DSNUM = 0000, START LRSN =0000065A967E

DEV TYPE = , IC BACK = , STYPE = , FILE SEQ = 0000, PIT LRSN = 000000000000

LOW DSNUM = 0000, HIGH DSNUM = 0000, OLDEST VERSION = 0000, LOGICAL PART = 0000, LOGGED = Y, TTYPE =

JOBNAME = TSOUB011, AUTHID = TSOUB01 , COPYPAGESF = -1.0E+00

NPAGESF = -1.0E+00 , CPAGESF = -1.0E+00

DSNAME = WWV8301D.TSLOCN , MEMBER NAME = , INSTANCE = 01, RELCREATED = O

DSNU586I -DSNB 242 06:00:41.42 DSNUPSUM - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SUMMARY

DSNU588I -DSNB 242 06:00:41.42 DSNUPSUM - NO DATA TO BE REPORTED

DSNU583I -DSNB 242 06:00:41.42 DSNUPPLR - SYSLGRNX ROWS FROM REPORT RECOVERY FOR TABLESPACE WWV8301D.TSLOCN

UCDATE UCTIME START RBA STOP RBA START LRSN STOP LRSN PARTITION MEMBER ID

082611 02184055 00000541D8FD 00000541EAAF C846F72AAAE2 C846F72AB632 0000 0000

082611 04533119 00000549E000 0000054A0C2C C84719C6E973 C8471C37B2D9 0000 0000

082611 07525672 0000055DBD4B 0000055E41D4 C84741E1B9C8 C84741E1C486 0000 0000

082911 23364598 0000065B1A9B 0000065B3C40 C84BDA6FFB4E C84BDA6FFE6C 0000 0000 *

082911 23573706 0000065D0EFF 0000065D30FB C84BDF191ACA C84BDF191DD3 0000 0000 *

082911 23573717 0000065D45D8 0000065E5522 C84BDF1934C6 C84BDF193D3A 0000 0000 *

DSNU584I -DSNB 242 06:00:41.42 DSNUPPBS - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN ARCHLOG1 BSDS VOLUMES

START TIME END TIME START RBA END RBA UNIT VOLSER DATA SET NAME

20112341848179 20112412111264 000004380000 00000653FFFF SYSDA SMS013 DBDSNB.ARCHLOG1.A0000003

DSNU586I -DSNB 242 06:00:41.42 DSNUPSUM - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SUMMARY

ARCHLOG1 BSDS VOLSER(S) SMS013

DSNU589I -DSNB 242 06:00:41.42 DSNUPREC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN COMPLETE

DSNU598I -DSNB 242 06:00:41.42 DSNUPPBK - REPORT RECOVERY SYSTEM LEVEL BACKUPS

DSNU588I -DSNB 242 06:00:41.42 DSNUPPBK - NO DATA TO BE REPORTED

DSNU580I 242 06:00:41.42 DSNUPORT - REPORT UTILITY COMPLETE - ELAPSED TIME=00:00:00

DSNU010I 242 06:00:41.43 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-151

Page 219: CV8317XSTUD

Student Exercises

.

Ste

p 25

b: M

OD

IFY

util

ity o

utpu

t

1DSNU000I 242 13:25:36.35 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 13:25:36.38 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 13:25:36.38 DSNUGUTC - MODIFY RECOVERY TABLESPACE WWV8301D.TSLOCN DELETE DATE 20110830

DSNU572I -DSNB 242 13:25:36.40 DSNUMDEL - ALL LOCALSITE SYSCOPY RECORDS FOR TABLESPACE= WWV8301D.TSLOCN

HAVE BEEN DELETED

DSNU381I -DSNB 242 13:25:36.40 DSNUGSRX - TABLESPACE WWV8301D.TSLOCN IS IN COPY PENDING

DSNU575I -DSNB 242 13:25:36.40 DSNUMODA - MODIFY COMPLETED SUCCESSFULLY

DSNU010I 242 13:25:36.41 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=4

Ste

p 25

c: R

EP

OR

T u

tility

out

put

1DSNU000I 242 13:29:58.56 DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = TSOUB01

DSNU1044I 242 13:29:58.59 DSNUGTIS - PROCESSING SYSIN AS EBCDIC

0DSNU050I 242 13:29:58.59 DSNUGUTC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN

DSNU581I -DSNB 242 13:29:58.59 DSNUPREC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN

DSNU593I -DSNB 242 13:29:58.60 DSNUPREC - REPORT RECOVERY ENVIRONMENT RECORD:

MINIMUM RBA: 000000000000

MAXIMUM RBA: FFFFFFFFFFFF

MIGRATING RBA: 000000000000

DSNU582I -DSNB 242 13:29:58.60 DSNUPPCP - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SYSCOPY ROWS

AND SYSTEM LEVEL BACKUPS

TIMESTAMP = 2011-08-30-13.25.36.400287, IC TYPE = *M*, SHR LVL = , DSNUM = 0000, START LRSN =0000065E5522

DEV TYPE = , IC BACK = , STYPE = R, FILE SEQ = 0000, PIT LRSN = 0000068D9A7F

LOW DSNUM = 0000, HIGH DSNUM = 0000, OLDEST VERSION = 0001, LOGICAL PART = 0000, LOGGED = Y, TTYPE =

JOBNAME = TSOUB011, AUTHID = TSOUB01 , COPYPAGESF = -1.0E+00

NPAGESF = -1.0E+00 , CPAGESF = -1.0E+00

DSNAME = WWV8301D.TSLOCN , MEMBER NAME = , INSTANCE = 01, RELCREATED = O

DSNU586I -DSNB 242 13:29:58.60 DSNUPSUM - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SUMMARY

DSNU588I -DSNB 242 13:29:58.60 DSNUPSUM - NO DATA TO BE REPORTED

DSNU583I -DSNB 242 13:29:58.60 DSNUPPLR - SYSLGRNX ROWS FROM REPORT RECOVERY FOR TABLESPACE WWV8301D.TSLOCN

DSNU588I -DSNB 242 13:29:58.60 DSNUPPLR - NO DATA TO BE REPORTED

DSNU584I -DSNB 242 13:29:58.60 DSNUPPBS - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN ARCHLOG1 BSDS VOLUMES

DSNU588I -DSNB 242 13:29:58.60 DSNUPPBS - NO DATA TO BE REPORTED

DSNU586I -DSNB 242 13:29:58.60 DSNUPSUM - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN SUMMARY

DSNU588I -DSNB 242 13:29:58.60 DSNUPSUM - NO DATA TO BE REPORTED

DSNU589I -DSNB 242 13:29:58.60 DSNUPREC - REPORT RECOVERY TABLESPACE WWV8301D.TSLOCN COMPLETE

DSNU598I -DSNB 242 13:29:58.60 DSNUPPBK - REPORT RECOVERY SYSTEM LEVEL BACKUPS

DSNU588I -DSNB 242 13:29:58.60 DSNUPPBK - NO DATA TO BE REPORTED

DSNU580I 242 13:29:58.60 DSNUPORT - REPORT UTILITY COMPLETE - ELAPSED TIME=00:00:00

DSNU010I 242 13:29:58.60 DSNUGBAC - UTILITY EXECUTION COMPLETE, HIGHEST RETURN CODE=0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-152 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 220: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 9: Security

Steps 1 to 4: Privileges on tables you do not ownSELECT * FROM TSOUB02.EMPLOYEE ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -551, ERROR: TSOUB01 DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION SELECT ON OBJECT TSOUB02.EMPLOYEE DSNT418I SQLSTATE = 42501 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXOSC SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -100 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFF9C' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Initially, you do not have SELECT privilege on your neighbor’s EMPLOYEE table. After your neighbor grants you SELECT privilege via: GRANT SELECT ON EMPLOYEE TO TSOUB01, you are able to select data from their table. However, you cannot delete data because you do not have DELETE privilege.

RACF groups and current SQLID

Step 5: Determine primary authorization id and current SQLIDSELECT SUBSTR(USER,1,15) AS PRIMARY_AUTHID, SUBSTR(CURRENT SQLID,1,15) AS CURRENT_SQLID FROM SYSIBM.SYSDUMMY1 ---------+---------+---------+---PRIMARY_AUTHID CURRENT_SQLID ---------+---------+---------+---TSOUB01 TSOUB01 DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

It is not possible to determine your Secondary Authids using SQL. xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-153

Page 221: CV8317XSTUD

Student Exercises

.

Step 6: Sample result of: ===> TSO LISTUSER (or TSO LU)USER=TSOUB01 NAME=CV83 STUDENT OWNER=WWCV83ST CREATED=11.235 DEFAULT-GROUP=WWCV83ST PASSDATE=11.236 PASS-INTERVAL=N/A PHRASEDATE=N/A ATTRIBUTES=NONE REVOKE DATE=NONE RESUME DATE=NONE LAST-ACCESS=11.243/00:27:46 CLASS AUTHORIZATIONS=NONE NO-INSTALLATION-DATA NO-MODEL-NAME LOGON ALLOWED (DAYS) (TIME) --------------------------------------------- ANYDAY ANYTIME GROUP=WWCV83ST AUTH=USE CONNECT-OWNER=WWCV83ST CONNECT-DATE=11.235 CONNECTS= 75 UACC=NONE LAST-CONNECT=11.243/00:27:46 CONNECT ATTRIBUTES=NONE REVOKE DATE=NONE RESUME DATE=NONE GROUP=STUDENT AUTH=USE CONNECT-OWNER=SYSPROG CONNECT-DATE=11.235 CONNECTS= 00 UACC=NONE LAST-CONNECT=UNKNOWN CONNECT ATTRIBUTES=NONE REVOKE DATE=NONE RESUME DATE=NONE SECURITY-LEVEL=NONE SPECIFIED CATEGORY-AUTHORIZATION NONE SPECIFIED SECURITY-LABEL=NONE SPECIFIED ***

The default group is: WWCV83ST.

Step 7: Changing your current SQLID

SET CURRENT SQLID = 'WWCV83ST'; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 8: Verify this changeSELECT SUBSTR(USER,1,15) AS PRIMARY_AUTHID, SUBSTR(CURRENT SQLID,1,15) AS CURRENT_SQLID FROM SYSIBM.SYSDUMMY1 ---------+---------+---------+--PRIMARY_AUTHID CURRENT_SQLID ---------+---------+---------+-TSOUB01 WWCV83ST DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-154 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 222: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 9: Determining privileges held by authorization IDs---------+---------+---------+---------+---------+---------+---SELECT SUBSTR(NAME,1,8) AS NAME,SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(CREATEDBY,1,8) AS CREATEDBY FROM SYSIBM.SYSDATABASE WHERE NAME = 'WWV83XXD' WITH UR ;---------+---------+---------+---------+---------+---------+---NAME CREATOR CREATEDBY ---------+---------+---------+---------+---------+---------+---WWV83XXD SYSPROG SYSPROG DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---

SYSPROG is the owner of the database WWV83XXD.

---------+---------+---------+---------+---------+---------+---------+---------+---- SELECT SUBSTR(GRANTOR,1,8) AS GRANTOR, SUBSTR(GRANTEE,1,8) AS GRANTEE, SUBSTR(NAME,1,8) AS NAME, AUTHHOWGOT,CREATETABAUTH,CREATETSAUTH,DISPLAYDBAUTH FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = 'WWCV83ST' WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+----GRANTOR GRANTEE NAME AUTHHOWGOT CREATETABAUTH CREATETSAUTH DISPLAYDBAUTH---------+---------+---------+---------+---------+---------+---------+---------+----SYSPROG WWCV83ST WWV83XXD S Y Y Y DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+----

The Secondary Authid WWCV83ST has the privileges to create table spaces, tables and display the status of the database WWV83XXD. SYSPROG who has SYSADM authority granted the Secondary Authorization id WWV83ST these privileges.

---------+---------+---------+---------+---------+---------+---------+---------+ SELECT SUBSTR(GRANTOR,1,8) AS GRANTOR, SUBSTR(GRANTEE,1,8) AS GRANTEE, SUBSTR(NAME,1,8) AS NAME, AUTHHOWGOT,CREATETABAUTH,CREATETSAUTH,DBADMAUTH FROM SYSIBM.SYSDBAUTH WHERE NAME = 'WWV83XXD' AND GRANTEE = 'SYSPROG' WITH UR ;---------+---------+---------+---------+---------+---------+---------+---------+GRANTOR GRANTEE NAME AUTHHOWGOT CREATETABAUTH CREATETSAUTH DBADMAUTH---------+---------+---------+---------+---------+---------+---------+---------+SYSPROG SYSPROG WWV83XXD S G G G DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-155

Page 223: CV8317XSTUD

Student Exercises

.

The database owner SYSPROG has all these privileges with GRANT option.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-156 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 224: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Privileges required to create a table (for example, with different owner)

Steps 10 to 11: Current SQLID = USER, unqualified table name:---------+---------+---------+---------+---------+---------+---------+---------+ SET CURRENT SQLID = USER; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

CREATE TABLE T1 (COL1 CHAR(1)) IN DATABASE WWV83XXD ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -551, ERROR: TSOUB01 DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION CREATE TABLE ON OBJECT WWV83XXD DSNT418I SQLSTATE = 42501 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXODD2 SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 50 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000032' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

This is because the privileges on database WWCV83XXD have been granted to your Secondary Authorization id and not to your Primary Authid.

Steps 12 to 13: Current SQLID = RACF group, unqualified table name:---------+---------+---------+---------+---------+---------+---------+---------+ SET CURRENT SQLID = 'WWCV83ST'; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

CREATE TABLE T01A (COL1 CHAR(1)) IN DATABASE WWV83XXD ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

The CREATE is successful because WWCV83ST has the authority to create the table (CREATETAB, and for the implicit tablespace creation: USE OF STOGROUP and USE OF BUFFERPOOL).

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-157

Page 225: CV8317XSTUD

Student Exercises

.

Steps 14 to 15: Current SQLID = USER, qualified table name:---------+---------+---------+---------+---------+---------+---------+---------+ SET CURRENT SQLID = USER; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

CREATE TABLE WWCV83ST.T01B (COL1 CHAR(1)) IN DATABASE WWV83XXD ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

The CREATE is successful because WWCV83ST has the authority to create the table (CREATETAB, and for the implicit tablespace creation: USE OF STOGROUP and USE OF BUFFERPOOL).

Steps 16 to 17: Current SQLID = RACF group, qualified table name:---------+---------+---------+---------+---------+---------+---------+---------+ SET CURRENT SQLID = 'WWCV83ST'; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

CREATE TABLE TSOUB01.T2 (COL1 CHAR(1)) IN DATABASE WWV83XXD ---------+---------+---------+---------+---------+---------+---------+---------+ DSNT408I SQLCODE = -551, ERROR: TSOUB01 DOES NOT HAVE THE PRIVILEGE TO PERFORM OPERATION CREATE TABLE ON OBJECT WWV83XXD DSNT418I SQLSTATE = 42501 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXODD2 SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 50 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000032' X'00000000' X'00000000' X'FFFFFFFF' X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

This is because the privileges on database WWCV83XXD have been granted to your Secondary Authorization id and not to your Primary Authid. In this case although WWCV83ST has the privilege to create a table in database WWV83XXD, the table owner has to be your Primary Authid and this is not possible.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-158 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 226: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Privileges needed for DML

Step 18: Current SQLID = USER, selecting from one group’s table---------+---------+---------+---------+---------+---------+---------+---------+ SET CURRENT SQLID = USER; ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+

SELECT * FROM WWCV83ST.T01A ---------+---------+---------+---------+---------+---------+---------+---------+ COL1 ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE610I NUMBER OF ROWS DISPLAYED IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 19: Why is the SELECT successful, even though your Primary Authid does not have SELECT privilege on table sauthid.T??A?

The SELECT is successful because the privilege set is the set of privileges held by all authorization ids associated with the process.

Step 20: Determining owner and schema of tables---------+---------+---------+---------+---------+---------+SELECT SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(DBNAME,1,8) AS DBNAME, SUBSTR(TSNAME,1,8) AS TSNAME, SUBSTR(CREATEDBY,1,8) AS CREATEDBY, SUBSTR(OWNER,1,8) AS OWNER FROM SYSIBM.SYSTABLES WHERE NAME IN ('T01A', 'T01B') AND DBNAME = 'WWV83XXD' WITH UR ;---------+---------+---------+---------+---------+---------+--NAME CREATOR DBNAME TSNAME CREATEDBY OWNER ---------+---------+---------+---------+---------+---------+--T01A WWCV83ST WWV83XXD T01A TSOUB01 WWCV83ST T01B WWCV83ST WWV83XXD T01B TSOUB01 WWCV83ST DSNE610I NUMBER OF ROWS DISPLAYED IS 2 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+--

Note: CREATOR shows schema name and OWNER shows the owner of the table.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-159

Page 227: CV8317XSTUD

Student Exercises

.

Step 21: Which of your auth ids is allowed to query SYSTABLES?---------+---------+---------+---------+---------+---------+---------+SELECT SUBSTR(GRANTOR,1,8) AS GRANTOR, SUBSTR(GRANTEE,1,8) AS GRANTEE, SUBSTR(TCREATOR,1,8) AS TCREATOR, SUBSTR(TTNAME,1,10) AS TTNAME, AUTHHOWGOT,SELECTAUTH FROM SYSIBM.SYSTABAUTH WHERE GRANTEE IN ('TSOUB01', 'WWCV83ST') AND TTNAME = 'SYSTABLES'WITH UR ;---------+---------+---------+---------+---------+---------+---------+GRANTOR GRANTEE TCREATOR TTNAME AUTHHOWGOT SELECTAUTH ---------+---------+---------+---------+---------+---------+---------+INSCV83 TSOUB01 SYSIBM SYSTABLES S Y INSCV83 WWCV83ST SYSIBM SYSTABLES S Y DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-160 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 228: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Exercise 10: Locking

Step 1a: Retrieving locking information from the DB2 catalogSELECT SUBSTR(DBNAME,1,8) AS DBNAME,

SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR,TYPE,LOCKRULE

FROM SYSIBM.SYSTABLESPACE WHERE CREATOR = USER WITH UR ;

---------+---------+---------+---------+---------+---------+---------+---------+ DBNAME NAME CREATOR TYPE LOCKRULE ---------+---------+---------+---------+--------WWV8301D TSLOCN TSOUB01 A WWV8301D TSDEPT TSOUB01 G A WWV8301D TSEMPL TSOUB01 R A WWV8301D TSPROJ TSOUB01 A WWV8301D TSEXCEPT TSOUB01 ADSNE610I NUMBER OF ROWS DISPLAYED IS 5 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 1b. Retrieving RELEASE value for packages:---------+---------+---------+---------+---------+---------+---------+---------+SELECT SUBSTR(NAME,1,8) AS NAME , SUBSTR(CREATOR,1,8) AS CREATOR , SUBSTR(OWNER,1,8) AS OWNER , RELEASE FROM SYSIBM.SYSPACKAGE WHERE RELEASE = 'D' WITH UR ;---------+---------+---------+---------+---------+---------+NAME CREATOR OWNER RELEASE ---------+---------+---------+---------+---------+---------+DSNE610I NUMBER OF ROWS DISPLAYED IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-161

Page 229: CV8317XSTUD

Student Exercises

.

Step 1c. Retrieving ISOLATION RR for packages:---------+---------+---------+---------+---------+---------+---------+---------+SELECT SUBSTR(NAME,1,8) AS NAME, SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(OWNER,1,8) AS OWNER FROM SYSIBM.SYSPACKAGE WHERE ISOLATION = 'R' WITH UR ;---------+---------+---------+---------+---------+---------+NAME CREATOR OWNER ---------+---------+---------+---------+---------+---------+DSNREXX SYSPROG SYSPROG DSNESM68 SYSPROG SYSPROG DSNA6DB2 SYSPROG SYSPROG DSNA6THP SYSPROG SYSPROG DSNAEXPL SYSPROG SYSPROG DSNAHVPM SYSPROG SYSPROG DSNE610I NUMBER OF ROWS DISPLAYED IS 6 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 2: Diagnosing an unsuccessful lock requestSELECT * FROM WWCV831.DEPARTMENT ---------+---------+---------+---------+---------+---------+---------+---------DEPTNO SUPERIOR_DEPTNO MGRNO NAME ---------+---------+---------+---------+---------+---------+---------+---------A00 --------------- 000010 SPIFFY COMPUTER SERVICE DIV. B01 A00 000020 PLANNING C01 A00 000030 INFORMATION CENTER D01 A00 ------ DEVELOPMENT CENTER DSNE610I NUMBER OF ROWS DISPLAYED IS 4 DSNT408I SQLCODE = -911, ERROR: THE CURRENT UNIT OF WORK HAS BEEN ROLLED BACK DUE TO DEADLOCK OR TIMEOUT. REASON 00C9008E, TYPE OF RESOURCE 00000304, AND RESOURCE NAME WWV83YYD.TSDEPT .X'000002' '.X'05' DSNT418I SQLSTATE = 40001 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNXRRC SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = -190 -100 0 -1 -404549622 536870912 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'FFFFFF42' X'FFFFFF9C' X'00000000' X'FFFFFFFF' X'E7E3100A' X'20000000' SQL DIAGNOSTIC INFORMATION ---------+---------+---------+---------+---------+---------+---------+--DSNE618I ROLLBACK PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

Reason code 00C9008E means that a lock request for the resource identified by NAME could not be granted, and the request waited for a period longer than the maximum specified by the installation.

TYPE OF RESOURCE 00000304 refers to a RESOURCE NAME with a format of DB.SP.RID, where DB is the database name, SP is the space name, and RID is the record identifier.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-162 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 230: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Displaying locking information for a segmented table space

Step 3: Getting information about DEPARTMENT table---------+---------+---------+---------+---------+---------+---------+SELECT SUBSTR(CREATOR,1,8) AS CREATOR, SUBSTR(NAME,1,10) AS NAME, SUBSTR(DBNAME,1,8) AS DBNAME, SUBSTR(TSNAME,1,8) AS TSNAME, DBID, OBID FROM SYSIBM.SYSTABLES WHERE CREATOR = 'WWCV831' AND NAME = 'DEPARTMENT'WITH UR ; ---------+---------+---------+---------+---------+---------+---------+CREATOR NAME DBNAME TSNAME DBID OBID ---------+---------+---------+---------+---------+---------+---------+WWCV831 DEPARTMENT WWV83YYD TSDEPT 280 3 DSNE610I NUMBER OF ROWS DISPLAYED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+

Background information for the following DISPLAY outputs: Userid INSCV83 has previously issued (without commit):

---------+---------+---------+---------+---------+---------+ UPDATE WWCV831.DEPARTMENT SET NAME = '*** THIS UPDATE IS UNCOMMITTED ***' WHERE DEPTNO = 'E01'; ---------+---------+---------+---------+---------+---------+DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+DSNE614I AUTOCOMMIT IS NO; NO CHANGES COMMITTED ---------+---------+---------+---------+---------+---------+

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-163

Page 231: CV8317XSTUD

Student Exercises

.

Step 4: DISPLAY DB ... LOCKS

-DIS DB(WWV83YYD) SPACE(TSDEPT) LOCKS DSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL LOCKS DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV83YYD STATUS = RW DBD LENGTH = 4028 DSNT397I -DSNB NAME TYPE PART STATUS CONNID CORRID LOCKINFO -------- ---- ----- ----------------- -------- ------------ --------- TSDEPT TS RW TSO INSCV83 H-IX,S,C - AGENT TOKEN 301 TSDEPT TS RW TSO TSOUB01 H-IS,S,C - AGENT TOKEN 315 TSDEPT TS RW TSO TSOUB02 H-IS,S,C - AGENT TOKEN 316 TSDEPT TS RW TSO TSOUB03 H-IS,S,C - AGENT TOKEN 317 3 TB TSO INSCV83 H-IX,T,C - AGENT TOKEN 301 3 TB TSO TSOUB01 H-IS,T,C - AGENT TOKEN 315 3 TB TSO TSOUB02 H-IS,T,C - AGENT TOKEN 316 3 TB TSO TSOUB03 H-IS,T,C - AGENT TOKEN 317 ******* DISPLAY OF DATABASE WWV83YYD ENDED **********************DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

Remark: Output depends on circumstances.

Step 4a to b

In the example output, TSO userid INSCV83 is holding a lock in IX mode on table space TSDEPT and a lock in X mode on a table with an object ID of 3 (table DEPARTMENT).

Step 4c

The locks will be freed at COMMIT.

Step 4d

TSO userids TSOUB01, TSOUB02 and TSOUB03 are holding lock in IS mode on thetable space WWV83YYD.TSDEPT. TSOUB01 is holding a lock in IX mode on the DEPARTMENT table (OBID 3). TSOUB02 and TSOUB03 are holding lock in IS mode on the DEPARTMENT table.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-164 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 232: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

Step 4e: LOCKSIZE ROW was specifiedSELECT SUBSTR(DBNAME,1,8) AS DBNAME,

SUBSTR(NAME,1,8) AS NAME, SEGSIZE,LOCKRULE

FROM SYSIBM.SYSTABLESPACE WHERE DBNAME = 'WWV83YYD' AND NAME = 'TSDEPT'WITH UR ;

---------+---------+---------+---------+---------+---------+ DBNAME NAME SEGSIZE LOCKRULE ---------+---------+---------+---------+---------+---------+ WWV83YYD TSDEPT 4 R

Step 5 (optional): Locking information for a partitioned table space

Prolog: Your instructor id INSCV83 has previously issued (without commit):

---------+---------+---------+---------+---------+---------+---------+---------+ UPDATE EMPLOYEE SET SALARY = SALARY * 1.1 WHERE EMPNO = '000200' ---------+---------+---------+---------+---------+---------+---------+---------+DSNE615I NUMBER OF ROWS AFFECTED IS 1 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+DSNE614I AUTOCOMMIT IS NO; NO CHANGES COMMITTED ---------+---------+---------+---------+---------+---------+---------+---------+-DISPLAY DATABASE (WWV83YYD) LOCKSDSNT360I -DSNB *********************************** DSNT361I -DSNB * DISPLAY DATABASE SUMMARY * GLOBAL LOCKS DSNT360I -DSNB *********************************** DSNT362I -DSNB DATABASE = WWV83YYD STATUS = RW DBD LENGTH = 4028 DSNT397I -DSNB NAME TYPE PART STATUS CONNID CORRID LOCKINFO -------- ---- ----- ----------------- -------- ------------ --------- TSDEPT TS RW TSO INSCV83 H-IX,S,C - AGENT TOKEN 365 3 TB TSO INSCV83 H-X,T,C - AGENT TOKEN 365 TSEMPL TS 0001 RW TSEMPL TS 0002 RW TSO INSCV83 H-IX,P,C - AGENT TOKEN 365 TSEMPL TS 0003 RW TSEMPL TS RW ******* DISPLAY OF DATABASE WWV83YYD ENDED ********************** DSN9022I -DSNB DSNTDDIS 'DISPLAY DATABASE' NORMAL COMPLETION ***

Note: The current update changes one page in one partition - and only this partition gets an IX lock.

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-165

Page 233: CV8317XSTUD

Student Exercises

.

Step 6: Reading uncommitted data

SELECT * FROM WWCV831.DEPARTMENT WITH UR ---------+---------+---------+---------+---------+---------+---------+---------+ DEPTNO SUPERIOR_DEPTNO MGRNO NAME ---------+---------+---------+---------+---------+---------+---------+---------+ A00 --------------- 000010 SPIFFY COMPUTER SERVICE DIV. B01 A00 000020 PLANNING C01 A00 000030 INFORMATION CENTER D01 A00 ------ DEVELOPMENT CENTER E01 A00 000050 *** THIS UPDATE IS UNCOMMITTED *** D11 D01 000060 MANUFACTURING SYSTEMS D21 D01 000070 ADMINISTRATION SYSTEMS E11 E01 000090 OPERATIONS E21 E01 000100 SOFTWARE SUPPORT DSNE610I NUMBER OF ROWS DISPLAYED IS 9 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+---------+---------+

Step 7: Reason why UR is successful

A SELECT statement that specifies UR ignores any locks and does not acquire any locks on the data being accessed, and therefore the SELECT is successful.

Remark: When you remove the UR option, you find that the SELECT times out again because the table is still locked in X mode by another user.

Step 8: SKIP LOCKED DATASELECT * FROM WWCV831.DEPARTMENT SKIP LOCKED DATA ---------+---------+---------+---------+---------+---------+-DEPTNO SUPERIOR_DEPTNO MGRNO NAME ---------+---------+---------+---------+---------+---------+-A00 --------------- 000010 SPIFFY COMPUTER SERVICE DIV.B01 A00 000020 PLANNING C01 A00 000030 INFORMATION CENTER D01 A00 ------ DEVELOPMENT CENTER D11 D01 000060 MANUFACTURING SYSTEMS D21 D01 000070 ADMINISTRATION SYSTEMS E11 E01 000090 OPERATIONS E21 E01 000100 SOFTWARE SUPPORT DSNE610I NUMBER OF ROWS DISPLAYED IS 8 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100 ---------+---------+---------+---------+---------+---------+-DSNE617I COMMIT PERFORMED, SQLCODE IS 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-166 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 234: CV8317XSTUD

Student ExercisesV5.4.0.3

EXempty

E

SKIP LOCKED DATA skips the row for DEPTNO ‘E01’ as this row is locked. UR retrieves the row for DEPTNO ‘E01’ although this row is not committed. You see only committed rows with SKIP LOCKED DATA.

End of exercise

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

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

© Copyright IBM Corp. 1993, 2011 Appendix A. Exercise solutions A-167

Page 235: CV8317XSTUD

Student Exercises

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

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

A-168 DB2 10 for z/OS DB Admin Workshop Part 1 © Copyright IBM Corp. 1993, 2011

Page 236: CV8317XSTUD

V5.4.0.3

backpg

E

Back page

xclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C.

Page 237: CV8317XSTUD

.

Exclus

ivo fo

rmac

ión

proy

ecto

C.F.T.I.C

Page 238: CV8317XSTUD

CONTACTO

Teléfono91 761 21 78Póngase en contacto con nuestro equipo y le informaremos de cualquier duda o cuestión que pueda surgirle.

[email protected]ándenos un email y le atenderemos enseguida.

Online@Arrow_Edu_ESO bien puede contactarnos a través de nuestro perfil en Twitter.

VisítenosArrow ECS Education ServicesAvenida de Europa 21, Parque Empresarial La Moraleja28108 Alcobendas, Madrid

EDUCATIONS E R V I C E S