Upload
bharathi-raja-marimuthu
View
221
Download
0
Embed Size (px)
Citation preview
8/14/2019 DBA Course Day 2
1/46
DBA TrainingDBA Training
8/14/2019 DBA Course Day 2
2/46
Day 2:Day 2:
x Session 1 : DB2 environment dependentUtilities, Restricted states of DB2objects, independent utilities
8/14/2019 DBA Course Day 2
3/46
DB2 utilities EnvironmentDB2 utilities Environment
x Batch Utilities:LOAD REPAIRREORG RUNSTATSCOPY STOSPACEMERGECOPY CHECK(IND/DATA)QUIESCE MODIFYREPORT RECOVER
8/14/2019 DBA Course Day 2
4/46
LOAD UtilityLOAD Utilityx Used to load data into one or more
tablesx Input:x LOAD DATA statement describing the
data to be loadedx File containing datax Output:x
Loaded table or partition
8/14/2019 DBA Course Day 2
5/46
LOAD UtilityLOAD Utilityx Features:
x Automatic data conversion betweencompatible data types
x Data loaded in the sequence presented;no sort invoked
x Indexes built; duplicates checked
8/14/2019 DBA Course Day 2
6/46
LOAD UtilityLOAD Utilityx Phase Flow:x UTILINITx RELOADx SORTx
BUILDx INDEXVALx ENFORCEx DISCARD
8/14/2019 DBA Course Day 2
7/46
LOAD Utility (Example)LOAD Utility (Example)LOAD DATA INDDN(SYSREC)RESUME YES
ENFORCE CONSTRAINTS
INTO TABLE TRGD55.PROJ
(PROJNO POSITION(1) CHAR(6),
PROJNAME POSITION(8) VARCHAR,
DEPTNO POSITION(33) CHAR(3))
Data File contains : 31 8 3
PROJ01 08training TRG
PROJ02 07Support SSG
8/14/2019 DBA Course Day 2
8/46
REORG UtilityREORG Utilityx Reorganizes tablespace to reclaim
fragmented space and improve accessperformance
x Alter the physical space parameters forthe tablespace
x Unload data in a format acceptable bythe LOAD utility
8/14/2019 DBA Course Day 2
9/46
REORG UtilityREORG Utilityx Input:x Name of tablespace or partition or
index to be reorganized
x Output:x Reorganized tablespace and / or
indexes
8/14/2019 DBA Course Day 2
10/46
REORG UtilityREORG Utilityx Phase Flow:
x UTILINITx UNLOADx
RELOADx SORTx BUILDx UTILTERM
8/14/2019 DBA Course Day 2
11/46
RUNSTATS UtilityRUNSTATS Utilityx Gathers information about data in
tablespaces and indexes and updatesDB2 catalog.
x Use RUNSTATS whenx * a table is loadedx * a table is reorganizedx * an index is createdx * extensive modifications done on
tablespace
8/14/2019 DBA Course Day 2
12/46
RUNSTATS UtilityRUNSTATS Utilityx Input:x Tablespace for which statistics is to be
updated / reported
x Output:x Report containing new statisticsx
Updated DB2 catalog tables
8/14/2019 DBA Course Day 2
13/46
RUNSTATS UtilityRUNSTATS Utilityx Phase Flow:
x UTILINITx
RUNSTATSx UTILTERM
8/14/2019 DBA Course Day 2
14/46
Data Backup - StandardData Backup - Standard
Utilities - COPY overviewUtilities - COPY overviewx COPY generates imagecopies of a ts,ts
partition or a dataset within a ts.x You cannot copy a tablespace with the
CHKP or RECP status.x Does not copy an Indexspace.
8/14/2019 DBA Course Day 2
15/46
COPY UtilityCOPY Utilityx Creates backup copies of a tablespace or
a single partition
x Reset copy pending status
x Two types: Full image copy,
Incremental image copy
8/14/2019 DBA Course Day 2
16/46
COPY UtilityCOPY Utilityx Input:x Name of tablespace or partition to be
copied
x Output:x A sequential dataset containing the
imagecopyx
SYSIBM.SYSCOPY updated
8/14/2019 DBA Course Day 2
17/46
Data Backup - COPY Data Backup - COPY
Outputs:x Creates upto 4 imagecopiesx Rows in SYSIBM.SYSCOPY for catalog
and SYSUTILX , SYSLGRNX for direct.x Either FULL or INCREMENTALx Can generate 2 sets of ics - local and
remote setx
Used by RECOVER TABLESPACE
8/14/2019 DBA Course Day 2
18/46
COPY utility - FULLCOPY utility - FULL
x A Full imagecopy with SHRLEVELREFERENCE is required, to reset theCOPY pending state of a tablespace.
x Recommended to take a full imagecopyafter a LOAD or a REORG
x Page Validation - inconsistencies arechecked for.
8/14/2019 DBA Course Day 2
19/46
COPY utility - IncrementalCOPY utility - Incremental
x FULL NO SHRLEVEL CHANGEx Has to be taken only after a FULL icx For large tables with update rates of
10% or less, an incremented ic maybefaster than a full ic
8/14/2019 DBA Course Day 2
20/46
Using DFSMS ConcurrentUsing DFSMS Concurrent
COPY and Local/RemoteCOPY and Local/Remotex CONCURRENT option of COPYx Restrictions exist on using Concurrent
copiesx 2 copies at Local site and 2 at Recovery
site can be taken using COPYDDN andRECOVERYDDN
8/14/2019 DBA Course Day 2
21/46
MERGECOPY utility MERGECOPY utility
x All incremental ICs are merged with anentry for the new incrementalimagecopy.
x NEWCOPY YES creates a full ICx NEWCOPY NO creates an incremental
IC
8/14/2019 DBA Course Day 2
22/46
8/14/2019 DBA Course Day 2
23/46
REPORT UtilityREPORT Utility
x Report Tablespaceset reports tables andRIs.
x Report Recovery givesx Syscopy entriesx syslgrnx entries for log rangesx Archive log dataset infox DSNUM option for ts/partitionx History - CURRENTx Local Site/Recovery site
8/14/2019 DBA Course Day 2
24/46
QUIESCE UtilityQUIESCE Utility
x Stores a point of consistency for list oftablespaces
x Only concurrent read access is allowedfor QUIESCE utility
x SYSCOPY has ICTYPE Q and LogRBA in SYSIBM.SYSCOPY with timesta
x Run QUIESCE on all RI related tablesafter a REPORT
x Use QUIESCE at time of low activity
8/14/2019 DBA Course Day 2
25/46
CHECK INDEX CHECK INDEX
x Checks if indexes are consistent withthe data
x Used before CHECK DATA to ensurevalidity of indexes
x DBADM, DBCTRL , DBMAINT for dbx RECOVER INDEX can be used to re-
establish consistency.x Cannot be run for RECP objects
8/14/2019 DBA Course Day 2
26/46
CHECK DATA utilityCHECK DATA utility
x Verifies RIx Can be used to rectify RI violations by
deleting invalid rows from dependanttablespaces
8/14/2019 DBA Course Day 2
27/46
8/14/2019 DBA Course Day 2
28/46
RECOVER INDEX RECOVER INDEX
x Indexes are recreated based on thetables they use
x Can refer tox one indexx a list of indexesx all indexes of a table spacex one partition of a partitioning index
8/14/2019 DBA Course Day 2
29/46
Monitoring Utilities Monitoring Utilities
x -DISPLAY UTILITYx -TERM UTILITY
8/14/2019 DBA Course Day 2
30/46
Starting and StoppingStarting and Stopping
Database ObjectsDatabase Objectsx - Start db2 access(maint) -access to only
Install Sysadm and Install Sysoprx -start db2 access(*) - general accessx -start db(*) spacenam(*)
access(force/ut/ro)x -stop db2x -stop db(*) - all except dsndb01,dsndb06
and dsndb07x -sto db * at commit sets STOPP stat
8/14/2019 DBA Course Day 2
31/46
States of Database ObjectsStates of Database Objects
x Monitored by -DISPLAY DATABASESPACENAM
x RECP, STOP, STOPP, CHKP, COPY,REST, PSRCP, RO, UT,UTRO,UTRW,UTUT - Restricted States
x RW - normal state
8/14/2019 DBA Course Day 2
32/46
Restricted States - COPY Restricted States - COPY
Cause : LOAD LOG NO
REORG LOG NOIncorrect page during COPYRECOVER ..TORBA
Action : COPY FULL YES SHRLEVELREFERANCE
REPAIR..SET TABLESPACE...NOCOPYPEND
8/14/2019 DBA Course Day 2
33/46
COPY - copy pendingCOPY - copy pending
A COPY pending state prevents anyupdate on ts and you cannot recoveryour ts. It will be reported at -displaydatabase....
Restrictions:x No update operationsx No QUIESCE
8/14/2019 DBA Course Day 2
34/46
Restricted States - CHKPRestricted States - CHKP
Cause : LOAD REPLACEAction: CHECK DATA..Cause: RECOVER TORBAAction: (verify first)
Cause : CHECK..DELETE NOAction: LOAD REPLACE..ENFORCECONSTRAINTS
8/14/2019 DBA Course Day 2
35/46
CHKP- Check pendingCHKP- Check pending
CHKP is a state of dependent tablespacesonly. A dependant ts is placed in CHKPstatus whenever RI in in doubt - RIviolation on any of the tables in ts.CHECKFLAG columns of
SYSTABLEPART and SYSTABLES.Restrictions: - No DML operations
No COPY, REORG, QUIESCE,
MODIFY, REPORT, RUNSTATS,
8/14/2019 DBA Course Day 2
36/46
Restricted States- RECPRestricted States- RECP
Cause: Abnormal end of LOAD,RECOVER,REORG
Action: RECOVERLOAD REPLACE
Cause : RECOVER..TORBA
8/14/2019 DBA Course Day 2
37/46
RECP - Recover pendingRECP - Recover pending
RECP is a state of a ts or an index. This isset when consistency of data in the ts orpartition or index is in doubt.
Restrictions:- No DML ALTER operations- No CHECK, COPY, REORG, MODIFY,
QUIESCE, LOAD RESUME, REPORT,RUNSTATS, STOSPACE
8/14/2019 DBA Course Day 2
38/46
Pending States - ExceptionalPending States - Exceptional
casescasesIf no alternatives, usex REPAIR SET TABLESPACE
NOxxxxPENDx -START DB(..) SPACENAM(..)
ACCESS(FORCE)x DROP TABLESPACE/TABLE*** If cause is not removed,
inconsistencies exist.
8/14/2019 DBA Course Day 2
39/46
INDOUBT Database ObjectsINDOUBT Database Objects
x Objects in INDOUBT state are LOCKedfor READ and UPDATE.
x Result of incomplete UR after anabnormal term between db2 and CICS.
x After re-establishing connections, theseare resolved automatically
x -RECOVER INDOUBTx -RESET INDOUBT
8/14/2019 DBA Course Day 2
40/46
Deffered Database ObjectsDeffered Database Objects
x Objects on DEFER list and log recordsx Object was in DEFER state at
terminationx Objects to be restarted with log records
to be applied at restart but these cannotbe written
8/14/2019 DBA Course Day 2
41/46
DB2 independant utilitiesDB2 independant utilities
x DSNJU004 - Print Log inventoryx DSN1LOGP - Log Print utilityx DSN1COPYx DSN1PRNTx
DSN1CHKRTo be run when DB2 is downx DSN1JU003 - Change Log inventory
8/14/2019 DBA Course Day 2
42/46
DSN1COPY Service AidDSN1COPY Service Aid
x DB2 VSAM data sets to sequential ds
x DSN1COPY sequential ds to DB2VSAM ds
x DB2 IC ds to DB2 VSAM dsx DB2 VSAM ds to other DB2 VSAM ds
x DSN1COPY sequential ds to othersequential ds.
8/14/2019 DBA Course Day 2
43/46
8/14/2019 DBA Course Day 2
44/46
DSN1LOGP utilityDSN1LOGP utility
x A detailed report of individual logrecords
x Produces a summary report which aidsx perform conditional restartx resolve indoubt threads with a remote sitex Detect problems with data propogation
x Used on Archive log ds
8/14/2019 DBA Course Day 2
45/46
DSN1CHKR utilityDSN1CHKR utility
x Verifies the integrity of directory(DSNDB01) and catalog (DSNDB06)
tablespaces for broken links, brokenhash chains, and records that are notpart of any link or chain.
8/14/2019 DBA Course Day 2
46/46
DSN1PRNT DSN1PRNT
x Prints hex dumps ofx DB2 VSAM dsx IC dsx DSN1COPY sequential ds (ts or ix)
x Expands if data is compressed(EXPAND option)