129

IBM DB2 for z/OS Administration Basics

Embed Size (px)

Citation preview

Page 1: IBM DB2 for z/OS Administration Basics
Page 2: IBM DB2 for z/OS Administration Basics

Multiple user connectivity

› Allows and manages more than one user connection to

the database and access to data at any given time.

Data integrity

› Internal locking ensures the risk of data corruption is

eliminated.

Recoverability

› The ability to recover data to a previous point in time or to

a current state when needed.

Security

› Controls access to data and resources by allowing only

authorized users access to certain data under specific

circumstances.

Page 3: IBM DB2 for z/OS Administration Basics

DB2 Objects

DB2 Utilities

Restrictive States

Administration

Page 4: IBM DB2 for z/OS Administration Basics
Page 5: IBM DB2 for z/OS Administration Basics

Stogroup

Database

Tablespace

Tables

Indexes

Views

Page 6: IBM DB2 for z/OS Administration Basics

It is a collection of direct access volume all of the same device type

The option is defined as a part of table space definitions

When a given space needs to be extended ,

storage is acquired from the appropriate stogroup.

Page 7: IBM DB2 for z/OS Administration Basics

Example

> For NON SMS Managed:

CREATE STOGROUP DSN8G910 VOLUMES (ABC005,DEF008)

VCAT DSNCAT;

> For SMS Managed:

CREATE STOGROUP DSN8G910 VOLUMES (*) VCAT

DSNCAT;

Page 8: IBM DB2 for z/OS Administration Basics

A collection of logically related objects – like

tablespaces, indexspaces, tables etc.

Not a physical kind of object

A STOGROUP & BUFFER POOL must be defined

for each database.

In a given database, all the spaces need not

have the same STOGROUP.

Page 9: IBM DB2 for z/OS Administration Basics

Table Table

Index

Index

Tablespace

Tablespace

Storage Groups

Table

Page 10: IBM DB2 for z/OS Administration Basics
Page 11: IBM DB2 for z/OS Administration Basics

› Example:

Create database DSN8D91P with storage group as

DSN8G910 and Bufferpool as BP8K1

CREATE DATABASE DSN8D91P STOGROUP DSN8G910

BUFFERPOOL BP8K1;

Page 12: IBM DB2 for z/OS Administration Basics

Logical address space on secondary storage to hold one or more tables.

Three types of table spaces are :

- Simple

- Partitioned

- Segmented

Page 13: IBM DB2 for z/OS Administration Basics

Simple

One or more table per tablespace

Space is composed of pages

Each page can contain rows of many tables

Page 14: IBM DB2 for z/OS Administration Basics

Example:

CREATE TABLESPACE Tablespacename

In Databasename

USING STOGROUP Sgname

PRIQTY mmm SECQTY nn

ERASE NO

LOCKSIZE ANY

BUFFERPOOL BP0

Page 15: IBM DB2 for z/OS Administration Basics

Segment 1 Segment 2 Segment 3

Table 1 Table 2 Table 1

> Segmented table spaces can contain one or more tables

> Space is divided into same-size segments

> Each segment contains rows from only one table

Page 16: IBM DB2 for z/OS Administration Basics

Example: CREATE TABLESPACE Tablespacename

In Databasename

USING STOGROUP Sgname

PRIQTY mmm SECQTY nn

ERASE NO

LOCKSIZE ANY

BUFFERPOOL BP0

SEGSIZE 32

Note: SEGSIZE from 4 to 64(in multiples of 4) indicates the number

of pages per segment.

Page 17: IBM DB2 for z/OS Administration Basics

Partitioned table spaces divide the data into several separate data sets, or partitions.

A partitioned table space can have only one table. Up to 4,096 partitions of up to 64GB each are allowed.

Each partition can have different characteristics, such as volume placement and free space.

Page 18: IBM DB2 for z/OS Administration Basics

Part 1 Part 2 Part 3 Part 4

> Primarily used for very large tables.

> Only one table in a partitioned table space

> Individual partitions can be independently recovered and

reorganized.

> Different partitions can be stored on different storage

groups for efficient access

Page 19: IBM DB2 for z/OS Administration Basics

› Example: CREATE TABLESPACE Tablespacename

In Databasename

NUMPARTS 2

(PART 1

USING STOGROUP Sgname

PRIQTY mmm SECQTY nn

FREEPAGE 5

PCTFREE 10)

(PART 1

USING STOGROUP Sgname

PRIQTY mmm SECQTY nn

FREEPAGE 5

PCTFREE 10)

LOCKSIZE ANY

BUFFERPOOL BP0;

Page 20: IBM DB2 for z/OS Administration Basics

A table is a collection of rows and columns.

The data is stored in form of rows and columns.

Example:

CREATE TABLE DSN8910.DEPT (

DEPTNO CHAR(3) NOT NULL,

DEPTNAME VARCHAR(36) NOT NULL,

MGRNO CHAR(6) ,

ADMRDEPT CHAR(3) NOT NULL,

LOCATION CHAR(16) ,

PRIMARY KEY(DEPTNO) ) IN DSN8D91A.DSN8S91D;

Page 21: IBM DB2 for z/OS Administration Basics

> Indexes are ordered sets of pointers associated

with a table.

> Indexes are based on the values of one or more

columns in the table.

> Each table can have one or more indexes, and

indexes can also be used to enforce uniqueness in

the data values.

> Indexes are used to improve performance when

accessing data.

> If an index is used, large scans of data can be

avoided.

Page 22: IBM DB2 for z/OS Administration Basics

› Example: CREATE UNIQUE INDEX DSN8910.XDEPT1 ON

DSN8910.DEPT (DEPTNO ASC)

USING STOGROUP DSN8G910

PRIQTY 512 SECQTY 64

ERASE NO BUFFERPOOL BP1;

Page 23: IBM DB2 for z/OS Administration Basics

Views can be very practical ways of simplifying queries by reducing the number of different tables.

Views can also hide sensitive data from users who don’t need access to it.

Example:

CREATE VIEW EMP_VIEW AS

SELECT EMPNO,NAME,DEPT,JOB

FROM EMP

Page 24: IBM DB2 for z/OS Administration Basics
Page 25: IBM DB2 for z/OS Administration Basics
Page 26: IBM DB2 for z/OS Administration Basics

Unload

Load

Reorg

Runstats

Copy

Page 27: IBM DB2 for z/OS Administration Basics

Unload rows from an entire table space or select specific partitions or tables to unload.

Can also select columns by using the field specification list.

If a table space is partitioned, you can unload all of the selected partitions into a single data set or you can unload each partition in parallel into physically distinct data sets.

The output records that the UNLOAD utility writes are compatible as input to the LOAD utility

Page 28: IBM DB2 for z/OS Administration Basics

Authorization Required:

› Ownership of the tables

› SELECT privilege on the tables

› DBADM authority for the database.

› SYSADM authority

› SYSCTRL authority (catalog tables only)

Page 29: IBM DB2 for z/OS Administration Basics

Execution Phases:

› UTILINIT Performs initialization.

› UNLOAD Unloads records to sequential data sets. One pass through the

input data set is made. If UNLOAD is processing a table space

or partition, DB2 takes internal commits. These commits

provide commit points at which the utility can be restarted in

case operation should halt in this phase.

› UTILTERM Performs cleanup.

Page 30: IBM DB2 for z/OS Administration Basics

Termination or restart of UNLOAD

› If you terminate UNLOAD by using the TERM UTILITY

command during the unload phase, the output records

are not erased.

› You can restart the UNLOAD job at the partition level or at

the table space level when data is unloaded from multiple

table spaces by using the LIST option.

› When you restart a terminated UNLOAD job, processing

begins with the table spaces or partitions that had not yet

been completed.

Page 31: IBM DB2 for z/OS Administration Basics

Sample Unload Job //STEP1 EXEC DSNUPROC,UID='SMPLUNLD',UTPROC='',SYSTEM='DSN'

//SYSREC DD DSN=USERID.SMPLUNLD.SYSREC,

// DISP=(NEW,CATLG,CATLG),

// UNIT=SYSDA,SPACE=(TRK,(2,1))

//SYSPUNCH DD DSN=USERID.SMPLUNLD.SYSPUNCH,

// DISP=(NEW,CATLG,CATLG),

// UNIT=SYSDA,SPACE=(TRK,(1,1))

//SYSPRINT DD SYSOUT=*

//SYSIN DD *

UNLOAD TABLESPACE DSN8D91A.DSN8S81E

FROM TABLE DSN8910.EMP

WHEN (WORKDEPT = 'D11' AND SALARY > 25000)

Page 32: IBM DB2 for z/OS Administration Basics

The LOAD utility loads records into the tables and builds or extends any indexes that are defined on them.

If the table space already contains data, you can choose whether you want to add the new data to the existing data or replace the existing data.

LOAD DATA generates one or more of the following forms of output: › A loaded table space or partition.

› A discard file of rejected records.

Page 33: IBM DB2 for z/OS Administration Basics

Authorization Required

› Ownership of the table

› LOAD privilege for the database

› SYSCTRL or SYSADM authority

› STATS privilege for the database is required if STATISTICS

keyword is specified

Note -

LOAD operates on a table space level, so you must have

authority for all tables in the table space when you perform LOAD.

Page 34: IBM DB2 for z/OS Administration Basics

Execution Phases

UTILINIT

▪ Performs Initialization

▪ RELOAD

▪ Loads record types and writes temporary file records for

indexes and foreign keys.

▪ RELOAD makes one pass through the sequential input

data set.

▪ Check constraints are checked for each row.

▪ Internal commits provide commit points at which to

restart in case operation should halt in this phase.

Page 35: IBM DB2 for z/OS Administration Basics

› SORT

Sorts temporary file records before creating indexes or

validating referential constraints, if indexes or foreign

keys exist.

SORT passes the sorted keys in memory to the BUILD

phase, which builds the indexes.

BUILD

Creates indexes from temporary file records for all

indexes that are defined on the loaded tables.

Page 36: IBM DB2 for z/OS Administration Basics

▪ SORTBLD ▪ Performs all activities that normally occur in both the

SORT and BUILD phases, if you specify a parallel index build.

INDEXVAL ▪ Corrects unique index violations or index evaluation

errors from the information in SYSERR, if any exist.

▪ ENFORCE • Checks referential constraints

• Information about violations of referential constraints is stored in SYSERR.

Page 37: IBM DB2 for z/OS Administration Basics

DISCARD

▪ Copies records that cause errors from the input data set

to the discard data set.

▪ REPORT

▪ Generates a summary report, if you specified ENFORCE

CONSTRAINT or if load index validation is performed. The

report is sent to SYSPRINT.

▪ UTILTERM

• Performs cleanup.

Page 38: IBM DB2 for z/OS Administration Basics

Replacing Data with LOAD

Use LOAD REPLACE to replace data in a table

space that has one or more tables.

Example : LOAD DATA REPLACE

INTO TABLE DSN8910.DEPT

( DEPTNO POSITION (1) CHAR(3),

DEPTNAME POSITION (5) VARCHAR,

LOCATION POSITION (48) CHAR(16) )

ENFORCE NO

Page 39: IBM DB2 for z/OS Administration Basics

Adding more data to a table or partition

RESUME keyword specifies whether data is to be loaded into an empty or a non-empty table space.

RESUME NO loads records into an empty table space.

RESUME YES loads records into a non-empty table space.

Example: LOAD DATA

RESUME YES INTO TABLE DSN8910.DEPT

(DEPTNO POSITION (1:3) CHAR(3), DEPTNAME POSITION (4:39) CHAR(36), LOCATION POSITION (49:64) CHAR(16))

Page 40: IBM DB2 for z/OS Administration Basics

Termination of LOAD

You can terminate a LOAD utility job using TERM

UTILITY command.

Termination …..

› During the reload phase:

The records are not erased.

The table space remains in RECOVER-pending status,

and indexes remain in the REBUILD-pending status.

Page 41: IBM DB2 for z/OS Administration Basics

Termination during the sort or build phases

▪ Indexes that are not yet built remain in the REBUILD-

pending status.

If the LOAD job terminates during the RELOAD,

SORT, BUILD, or SORTBLD phases

▪ Both RESTART and RESTART(PHASE) phases restart from the

beginning of the RELOAD phase.

Page 42: IBM DB2 for z/OS Administration Basics

Restart of LOAD

› You can restart LOAD at its last commit point

(RESTART(CURRENT))

› Or at the beginning of the phase during which

operation ceased (RESTART(PHASE)).

Page 43: IBM DB2 for z/OS Administration Basics
Page 44: IBM DB2 for z/OS Administration Basics

Reorganizes a table space to improve access

performance and to reclaim fragmented space.

You can determine when to run REORG for non-

LOB table spaces by using the OFFPOSLIMIT or

INDREFLIMIT catalog query options.

If you specify the REPORTONLY option, REORG

produces a report that indicates whether a REORG

is recommended without actually performing the

REORG.

Page 45: IBM DB2 for z/OS Administration Basics

Authorization Required

› REORG privilege for the database

› DBADM or DBCTRL authority for the database. If the object

on which the utility operates is in an implicitly created

database, DBADM authority on the implicitly created

database or DSNDB04 is required.

› SYSCTRL authority

› SYSADM authority

Page 46: IBM DB2 for z/OS Administration Basics

Execution Phases

UTILINIT

▪ Performs initialization and setup.

▪ UNLOAD

▪ Unloads the table space and sorts data if a clustering

index exists and the utility job includes either the

SORTDATA or SHRLEVEL CHANGE options.

▪ RELOAD • Reloads data from the sequential data set into the table

space. The utility also updates table and table space

statistics.

Page 47: IBM DB2 for z/OS Administration Basics

SORT ▪ Sorts index keys. The sorted keys are passed in memory to

the BUILD phase.

BUILD

▪ Builds indexes and updates index statistics.

▪ SORTBLD

▪ If parallel index build occurs, all activities that normally

occur in both the SORT and BUILD phases occur in the

SORTBLD phase instead.

▪ LOG

▪ Processes the log iteratively and appends changed pages

to the full image copies. This phase occurs only if you

specify SHRLEVEL CHANGE or SHRLEVEL REFERENCE PART x.

Page 48: IBM DB2 for z/OS Administration Basics

› SWITCH

Switches access to shadow copy of table space or

partition. This phase occurs only if you specify SHRLEVEL

REFERENCE or CHANGE.

› UTILTERM

Performs cleanup.

Page 49: IBM DB2 for z/OS Administration Basics
Page 50: IBM DB2 for z/OS Administration Basics

Termination of REORG Tablespace › If utility is terminated at UNLOAD Phase, objects have

not been changed, so you can rerun the job.

› If it is terminated at the RELOAD phase,

For SHRLEVEL NONE – the data records are not erased. The table space and indexes remain in RECOVER-pending status. After you recover the table space, rerun the REORG job.

For SHRLEVEL REFERENCE or CHANGE – the data records are reloaded into shadow objects, so the original objects have not been affected by REORG. You can rerun the job.

Page 51: IBM DB2 for z/OS Administration Basics

› Terminated at SORT, BUILD or LOG phases For SHRLEVEL NONE – the indexes that are not yet built

remain in RECOVER-pending status. You can run REORG with the SORTDATA option, or you can run REBUILD INDEX to rebuild those indexes.

For SHRLEVEL REFERENCE or CHANGE – objects have

not been affected by REORG. You can rerun the job.

› If you terminate during the SWITCH phase All data sets that were renamed to their shadow

counterparts are renamed to their original names, you can rerun the job or it goes in recover pending status.

Page 52: IBM DB2 for z/OS Administration Basics

Example //STEP1 EXEC DSNUPROC,UID=’IUJLU101.REORG’,

// UTPROC=’’,

// SYSTEM=’DSN’

//UTPRINT DD SYSOUT=*

//UNLD DD DSN=IUJ.REORG.STEP1.UNLD,DISP=(MOD,DELETE,CATLG),

// UNIT=SYSDA,SPACE=(CYL,(20,20),,,ROUND)

//SORTWK01 DD DSN=IUJ.REORG.STEP1.SORTWK01,DISP=(MOD,DELETE,CATLG),

// UNIT=SYSDA,SPACE=(CYL,(20,20),,,ROUND)

//SORTWK02 DD DSN=IUJ101.REORG.STEP1.SORTWK02,

// DISP=(MOD,DELETE,CATLG),UNIT=SYSDA,SPACE=(CYL,(20,20),,,ROUND)

//SYSIN DD *

REORG TABLESPACE (DSN8D81A.DSN8S81D) UNLDDN (UNLD)

Page 53: IBM DB2 for z/OS Administration Basics

The RUNSTATS utility gathers summary information about the characteristics of data in table spaces, indexes, and partitions.

DB2 records these statistics in the DB2 catalog and uses them to select access paths to data during the bind process.

RUNSTATS TABLESPACE gathers statistics on a table space and, optionally, on tables, indexes or columns

RUNSTATS INDEX gathers statistics only on indexes.

Page 54: IBM DB2 for z/OS Administration Basics

Authorization Required

› STATS privilege for the database

› DBADM, DBCTRL, or DBMAINT authority for the

database

› SYSCTRL or SYSADM authority

Page 55: IBM DB2 for z/OS Administration Basics

Execution Phases

› UTILINIT

Performs initialization

RUNSTATS

Scans table space or index and updates catalog.

UTILTERM

Performs cleanup

Page 56: IBM DB2 for z/OS Administration Basics

Sample RUNSTATS control statements

//STEP1 EXEC DSNUPROC,UID='IUJQU225.RUNSTA',TIME=1440,

// UTPROC='',

// SYSTEM='DSN'

//UTPRINT DD SYSOUT=*

//SYSIN DD *

RUNSTATS TABLESPACE DSN8D91A.DSN8S91E

UPDATE ALL

SHRLEVEL CHANGE

Updating index statistics RUNSTATS INDEX (DSN8910.XEMPL1)

Page 57: IBM DB2 for z/OS Administration Basics

Output from a RUNSTATS job on a

catalog table space and its indexes: DSNU000I DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = DSNTEX

DSNU050I DSNUGUTC - RUNSTATS TABLESPACE DSNDB06.SYSDBASE INDEX(ALL)

DSNU610I # DSNUSUTP - SYSTABLEPART CATALOG UPDATE FOR DSNDB06.SYSDBASE SUCCESSFUL

DSNU610I # DSNUSUTS - SYSTABLESPACE CATALOG UPDATE FOR DSNDB06.SYSDBASE SUCCESSFUL

DSNU610I # DSNUSUTB - SYSTABLES CATALOG UPDATE FOR SYSIBM.SYSTABLESPACE SUCCESSFUL

Page 58: IBM DB2 for z/OS Administration Basics

When to use RUNSTATS › After a table is loaded

› After an index is physically created

› After a table space is reorganized if inline statistics were not collected

› After running extensive updates, deletions, or insertions in a table space

› After running any of the following utilities without collecting inline statistics: RECOVER TABLESPACE, REBUILD INDEX, or REORG INDEX

› After running the ALTER TABLE ROTATE PARTITION statement run RUNSTATS with REORG .

Page 59: IBM DB2 for z/OS Administration Basics

Used for taking Image Copies of –

› table space

› table space partition

› data set of a linear table space

› index space, or index space partition

Page 60: IBM DB2 for z/OS Administration Basics

Types:

› Full image copy,

copy of all pages in a table space, partition,

data set, or index space.

› Incremental image copy

copy only of those data pages that have

been modified since the last use of the COPY

utility and system pages.

Page 61: IBM DB2 for z/OS Administration Basics

Authorization required

› IMAGCOPY privilege for the database

› DBADM, DBCTRL, or DBMAINT authority for the

database

› SYSCTRL or SYSADM authority

Note:

An ID with installation SYSOPR authority can

also execute COPY, but only on a table space

in the DSNDB01 or DSNDB06 database.

Page 62: IBM DB2 for z/OS Administration Basics

Execution phases

› UTILINIT

Performs initialization and setup

› REPORT

Reports for CHANGELIMIT option

› COPY

Copies

› UTILTERM

Performs cleanup

Page 63: IBM DB2 for z/OS Administration Basics

Making a full image copy

//STEP1 EXEC DSNUPROC,UID='IUJMU111.COPYTS',

// UTPROC='',

// SYSTEM='DSN'

//SYSCOPY DD

DSN=COPY001F.IFDY01,UNIT=SYSDA,VOL=SER=CPY01I,

// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)

//SYSIN DD *

COPY TABLESPACE DSN8D91A.DSN8S91E

/*

Page 64: IBM DB2 for z/OS Administration Basics

Making incremental copies

› FULL NO option in the following COPY control

statement specifies that COPY is to make

incremental image copies

Example: COPY TABLESPACE DSN8D91A.DSN8S91E SHRLEVEL

CHANGE FULL NO

Page 65: IBM DB2 for z/OS Administration Basics

REBUILD INDEX

› reconstructs indexes or index partitions from the

table that they reference.

› Authorization:

RECOVERDB privilege for the database

DBADM or DBCTRL

SYSCTRL or SYSADM

Page 66: IBM DB2 for z/OS Administration Basics

› Execution Phases:

UTILINIT

Performs initialization and setup.

UNLOAD

Unloads index entries.

SORT

Sorts unloaded index entries.

BUILD

Builds indexes.

Page 67: IBM DB2 for z/OS Administration Basics

SORTBLD

Sorts and builds a table space for parallel index build

processing.

UTILTERM

Performs cleanup.

Page 68: IBM DB2 for z/OS Administration Basics

› Sample Job: //STEP1 EXEC DSNUPROC,UID=’IUIQU2UT.RBLD1’,TIME=1440,

// UTPROC=’’,

// SYSTEM=’DSN’

//SYSREC DD

DSN=IUIQU2UT.RBLD1.STEP1.SYSREC,DISP=(MOD,DELETE,CATLG),

// UNIT=SYSDA,SPACE=(8000,(20,20),,,ROUND)

//SYSIN DD *

REBUILD INDEX (DSN8910.XDEPT1)

/*

Note: To Rebuild all indexes of a table space we can specify INDEX(ALL)

Ex: REBUILD INDEX (ALL) TABLESPACE DSN8D91A.DSN8S91E

Page 69: IBM DB2 for z/OS Administration Basics

The online RECOVER utility recovers data to the current state

or to a previous point in time by restoring a copy and then

applying log records.

The RECOVER utility recovers an entire table space, index

space, a partition or data set, pages within an error range, or

a single page.

You can recover data from image copies of an object or

from a system-level backup records that contain changes to

the object.

Page 70: IBM DB2 for z/OS Administration Basics

› Authorization Required:

RECOVERDB privilege for the database

DBADM or DBCTRL authority for the database.

SYSCTRL or SYSADM authority

Page 71: IBM DB2 for z/OS Administration Basics

If you make image copies by table space, you can recover

the entire table space, or you can recover a data set or

partition from the table space.

The following RECOVER statement specifies that the utility is to

recover table space IAS9TS in database IAS9DB:

Example:

RECOVER TABLESPACE IAS9DB.IAS9TS

Page 72: IBM DB2 for z/OS Administration Basics
Page 73: IBM DB2 for z/OS Administration Basics

CHECK PENDING STATUS (CHKP)

› indicates that an object might be in an

inconsistent state and must be checked.

› Following utilities set the CHECK-pending status

on a table space if referential integrity

constraints are encountered:

LOAD with ENFORCE NO

RECOVER to a point in time

CHECK LOB

Page 74: IBM DB2 for z/OS Administration Basics

CHECK PENDING STATUS (CHKP)

› Corrective Action:

Check and correct referential integrity constraints using the CHECK DATA utility.

Run CHECK INDEX on the index.

Use the CHECK LOB utility to check the LOB table space.

Page 75: IBM DB2 for z/OS Administration Basics

COPY-pending status (COPY)

› indicates that the affected object must be

copied.

› Corrective Action:

Copy the affected table space.

Copy the affected index.

Page 76: IBM DB2 for z/OS Administration Basics

REBUILD-pending status (RBDP)

› indicates that the affected index or index

partition is broken and must be rebuilt from the

data.

› Corrective Action:

Run the REBUILD utility on the affected index

partition.

Page 77: IBM DB2 for z/OS Administration Basics

RECOVER-pending status (RECP)

› indicates that a table space or table space

partition is broken and must be recovered

› Corrective Action:

Run the RECOVER utility on the affected object.

Recover the partition.

Use LOAD REPLACE for the table space or partition.

Use REPAIR SET TABLESPACE or INDEX with NORCVRPEND on

the table space or partition.

Start the database that contains the table space or

index space with ACCESS FORCE.

Page 78: IBM DB2 for z/OS Administration Basics

REORG-pending status (REORP)

› indicates that a table space partition definition

has changed and the affected partitions must

be reorganized before the data is accessible.

› Corrective Action:

Run the REORG TABLESPACE utility with SHRLEVEL NONE.

Use LOAD REPLACE for the entire table space.

Page 79: IBM DB2 for z/OS Administration Basics
Page 80: IBM DB2 for z/OS Administration Basics

-START DB2

› START DB2 initializes the DB2 subsystem.

› Authorization

None is required. However, the command can be

executed only from a z/OS console with the START

command capability.

› Example:

-DB2P START DB2

Page 81: IBM DB2 for z/OS Administration Basics
Page 82: IBM DB2 for z/OS Administration Basics

-STOP DB2

› stops the DB2 subsystem

› Authorization

STOPALL privilege

SYSOPR authority

SYSCTRL authority

SYSADM authority

› Example:

-DB2P STOP DB2

Page 83: IBM DB2 for z/OS Administration Basics

› -STOP DB2 MODE(QUIESCE)

When you issue the STOP DB2 MODE(QUIESCE)

command, current threads can run to completion, and

new threads can be allocated to an application that is

running.

› -STOP DB2 MODE(FORCE)

no new threads are allocated, and work on existing

threads is rolled back.

Page 84: IBM DB2 for z/OS Administration Basics

-DISPLAY THREAD (DB2)

› displays current status information about DB2

threads.

› Authorization:

DISPLAY privilege

SYSOPR authority

SYSCTRL authority

SYSADM authority

Page 85: IBM DB2 for z/OS Administration Basics

-DB2P DISPLAY THD(*)

Token ID

Page 86: IBM DB2 for z/OS Administration Basics

-CANCEL THREAD (token)

› cancels processing for specific local or

distributed threads.

› Authorization:

SYSOPR authority

SYSCTRL authority

SYSADM authority

Page 87: IBM DB2 for z/OS Administration Basics

-DB2P CAN THD(Token id)

Page 88: IBM DB2 for z/OS Administration Basics

-DISPLAY UTILITY (DB2)

› displays the status of utility jobs

› Authorization Required:

None

Page 89: IBM DB2 for z/OS Administration Basics

› Example:

-DB2P DISPLAY UTILITY (*)

DSNU100I -DB1G DSNUGDIS USER = SYSADM

MEMBER = DB2P

UTILID = RUNTS

PROCESSING UTILITY STATEMENT 1

UTILITY = RUNSTATS

PHASE = RUNSTATS

COUNT = 0

STATUS = STOPPED

Page 90: IBM DB2 for z/OS Administration Basics

-TERM UTILITY (DB2)

› terminates execution of a DB2 utility job step and

releases all resources associated with the step

› Authorization

DBMAINT authority

DBCTRL authority

DBADM authority

SYSOPR authority

SYSCTRL authority

SYSADM authority

Page 91: IBM DB2 for z/OS Administration Basics

› Example:

Terminate all utility jobs for which you are

authorized.

-TERM UTILITY (*)

Terminate all utility jobs whose utility ID begins

with SMITH.

-TERM UTILITY (SMITH*)

Page 92: IBM DB2 for z/OS Administration Basics

START DATABASE

› Makes a database or individual partitions

available.

STOP DATABASE

› Makes a database or individual partitions

unavailable after existing users have quiesced.

Page 93: IBM DB2 for z/OS Administration Basics

Starting an object with a specific status

Status Access Remarks

RW Read-write This is the

default value.

RO Read only You cannot

change the

data.

UT Utility only The object is

available only to

the DB2 utilities.

Page 94: IBM DB2 for z/OS Administration Basics

› Example: -START DATABASE (DSN8D91A) SPACENAM(TEMPTS)

-START DATABASE (DSN8D91A) SPACENAM(*)

ACCESS(RO)

The system responds with this message:

DSN9022I - DSNTDDIS ’-START DATABASE’ NORMAL

COMPLETION

Page 95: IBM DB2 for z/OS Administration Basics

STOP DATABASE command has several options that

you can use to control how the database stops.

› -STOP DATABASE (*)

Stops all databases for which you have STOPDB

authorization, except the DB2 directory (DSNDB01), the

DB2 catalog (DSNDB06), or the DB2 work file database

(called DSNDB07).

Page 96: IBM DB2 for z/OS Administration Basics

› -STOP DATABASE (dbname)

Stops a database and closes all of the data sets of the

table spaces and index spaces in the database.

› -STOP DATABASE (dbname) SPACENAM (*)

Stops and closes all of the data sets of the table spaces

and index spaces in the database. The status of the

named database does not change.

› -STOP DATABASE (dbname) SPACENAM (space-

name, ...)

Stops and closes the data sets of the named table

space or index space.

Page 97: IBM DB2 for z/OS Administration Basics

› Use the command DISPLAY DATABASE to obtain

information about the status of databases and

the table spaces and index spaces within each

database.

› If applicable, the output also includes

information about physical I/O errors for those

objects.

-DISPLAY DATABASE (dbname)

Page 98: IBM DB2 for z/OS Administration Basics
Page 99: IBM DB2 for z/OS Administration Basics
Page 100: IBM DB2 for z/OS Administration Basics

› An example of such a restriction is when the

table space is placed in COPY-pending status.

That status makes a table space or partition

unavailable until an image copy of the object is

taken.

Note:

These restrictions are a necessary part of protecting the

integrity of the data. If you start an object that has restrictions,

the data in the object might not be reliable.

Page 101: IBM DB2 for z/OS Administration Basics

› A table might contain test data whose

consistency is not critical.

› In those cases, start the objects by using the

ACCESS(FORCE) option of the START

DATABASE command.

-START DATABASE (DSN8D91A) SPACENAM (DSN8S91E)

ACCESS(FORCE)

Page 102: IBM DB2 for z/OS Administration Basics

Use the DISPLAY DATABASE command to

determine which programs are holding locks on an

object.

› Syntax:

-DISPLAY DATABASE(Dbname) SPACENAM(Tsname) LOCKS

Page 103: IBM DB2 for z/OS Administration Basics
Page 104: IBM DB2 for z/OS Administration Basics

Buffer pools are database objects used to cache

database data pages in memory.

Buffer pools are areas of virtual storage that

temporarily store pages of table spaces or indexes

If an object's data page is placed in a buffer pool,

physical input/output (I/O) access to disks will be

avoided.

Page 105: IBM DB2 for z/OS Administration Basics
Page 106: IBM DB2 for z/OS Administration Basics

Use the DISPLAY BUFFERPOOL command, which

displays the current status for one or more active or

inactive buffer pools.

› Example:

-DISPLAY BUFFERPOOL(BP0)

Page 107: IBM DB2 for z/OS Administration Basics
Page 108: IBM DB2 for z/OS Administration Basics

ALTER BUFFERPOOL alters attributes for active or

inactive buffer pools.

Authorization:

› SYSOPR authority

› SYSCTRL authority

› SYSADM authority

› Example:

-ALTER BUFFERPOOL(BP0) VPSIZE(2000)

Page 109: IBM DB2 for z/OS Administration Basics
Page 110: IBM DB2 for z/OS Administration Basics

The DB2 Catalog is the central repository for DB2

object and user meta data.

DB2 is constantly referring to that meta data as it

processes applications and queries.

Are updated by DB2 operations and SQL INSERT,

UPDATE and DELETE on some of the tables

Are used by DB2 to obtain information about the

system. Can be queried using SQL

Page 111: IBM DB2 for z/OS Administration Basics

�The tables in the DSNDB06 database

› Record information about

�objects

�authorization

�plans/packages/stored procedures

�recovery (image copy, REORG, etc.)

�statistics

�string translation

Page 112: IBM DB2 for z/OS Administration Basics

SYSIBM.SYSCOPY table

The SYSIBM.SYSCOPY table contains information

needed for recovery.

SYSIBM.SYSDATABASE table

The SYSIBM.SYSDATABASE table contains one row

for each database, except for database DSNDB01.

SYSIBM.SYSDBAUTH table

The SYSIBM.SYSDBAUTH table records the privileges

that are held by users over databases.

Page 114: IBM DB2 for z/OS Administration Basics

SYSIBM.SYSPLANAUTH table

The SYSIBM.SYSPLANAUTH table records the

privileges that are held by users over application

plans.

SYSIBM.SYSSTOGROUP table

The SYSIBM.SYSSTOGROUP table contains one row

for each storage group.

SYSIBM.SYSTABAUTH table

The SYSIBM.SYSTABAUTH table records the privileges

that users hold on tables and views.

Page 115: IBM DB2 for z/OS Administration Basics

SYSIBM.SYSTABLES table

The SYSIBM.SYSTABLES table contains one row for

each table, view, or alias.

SYSIBM.SYSTABLESPACE table

The SYSIBM.SYSTABLESPACE table contains one row

for each table space.

SYSIBM.SYSTABLESPACESTATS table

The SYSIBM.SYSTABLESPACESTATS table contains

real time statistics for table spaces.

Page 116: IBM DB2 for z/OS Administration Basics

SYSIBM.SYSTABSTATS table

The SYSIBM.SYSTABSTATS table contains one row for

each partition of a partitioned table space.

SYSIBM.SYSUSERAUTH table

The SYSIBM.SYSUSERAUTH table records the system

privileges that are held by users.

SYSIBM.SYSVOLUMES table

The SYSIBM.SYSVOLUMES table contains one row for

each volume of each storage group.

Page 117: IBM DB2 for z/OS Administration Basics

The DB2 Directory contains internal control

structures such as DBDs. skeleton cursor tables, and

skeleton package tables that can be accessed

only by DB2 itself.

The information in the DB2 Directory is critical for

database access, utility processing, plan and

package execution, and logging.

Page 118: IBM DB2 for z/OS Administration Basics

SCT02 Contains the internal form of SQL statements that are contained in an

application. If you bound a plan with SQL statements in a prior

release, DB2 created a structure in SCT02.

SPT01

Skeleton package

Contains the internal form of SQL statements that are contained in a

package.

SYSSPUXA Contains the contents of a package selection.

SYSSPUXB Contains the contents of a package explain block.

SYSLGRNX

Log range

Tracks the opening and closing of table spaces, indexes, or partitions.

By tracking this information and associating it with relative byte

addresses (RBAs) as contained in the DB2 log, DB2 can reduce

recovery time by reducing the amount of log that must be scanned

for a particular table space, index, or partition.

Page 119: IBM DB2 for z/OS Administration Basics

SYSUTILX

System utilities

Contains a row for every utility job that is running. The row persists

until the utility is finished. If the utility terminates without completing,

DB2 uses the information in the row when you restart the utility.

DBD01

Database descriptor

(DBD)

Contains internal information, called database descriptors (DBDs),

about the databases that exist within the DB2 subsystem.

Each database has exactly one corresponding DBD that describes

the database, table spaces, tables, table check constraints,

indexes, and referential relationships. A DBD also contains other

information about accessing tables in the database. DB2 creates

and updates DBDs whenever their corresponding databases are

created or updated.

SYSDBDXA Contains the contents of a DBD section.

Page 120: IBM DB2 for z/OS Administration Basics
Page 121: IBM DB2 for z/OS Administration Basics

The SPUFI panel is the first panel that you need to fill

out to run the SPUFI application.

After you complete any fields on the SPUFI panel

and press Enter, those settings are saved.

When the SPUFI panel displays again, the data

entry fields on the panel contain the values that

you previously entered.

Page 122: IBM DB2 for z/OS Administration Basics
Page 123: IBM DB2 for z/OS Administration Basics
Page 124: IBM DB2 for z/OS Administration Basics
Page 125: IBM DB2 for z/OS Administration Basics
Page 126: IBM DB2 for z/OS Administration Basics
Page 127: IBM DB2 for z/OS Administration Basics

http://www-

01.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/com.ibm.db2z11.doc.aps

g/src/tpc/db2z_executesqlspufi.dita

Page 128: IBM DB2 for z/OS Administration Basics
Page 129: IBM DB2 for z/OS Administration Basics