Professional Documents
Culture Documents
Db2utilities 160404165531
Db2utilities 160404165531
• UNLOAD
• LOAD
• REBUILD
• COPY
• RECOVER
• RUNSTATS
• MODIFY RECOVERY
• QUIESCE
• REORG
UNLOAD Utility:
Following are the tasks of the UNLOAD utility
• //SYSREC00 DD DSN=UD330574.UNLOAD.REC,
// DISP=(,CATLG),
// SPACE=(TRK,(100,20),RLSE),
// UNIT=SYSDA
//SYSPUNCH DD DSN=UD330574.UNLOAD.PUN,
// DISP=(,CATLG),
// SPACE=(CYL,(5,1),RLSE),
// UNIT=SYSDA
//SYSIN DD *
SELECT * FROM DB0KNRX0.TABLE24;
CREATOR NAME.TABLE NAME.
LOAD :
• Use Load utility to load one or more tables of a tablespace. 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 date
• LOAD operates on a table space level, so you must have authority for all tables in the
table space when you perform LOAD.
• NOCOPYPEND
Specifies that LOAD is not to set the table space in the COPY-pending status
• RESUME
Indicates whether records are to be loaded into an empty or non-empty table
Space
• RESUME YES
Loads records into a non-empty table space.
• RESUME NO
Loads records into an empty table space.
• REPLACE
Indicates whether the table space and all its indexes need to be reset to empty
before NEW records are loaded.
• 7 Example 1:
• Sample JCL :
• LOAD DATA
• RESUME YES
• INTO TABLE DSN8910.DEPT
(DEPTNO POSITION (1:3) CHAR(3),
• DEPTNAME POSITION (4:39) CHAR(36),
MGRNO POSITION (40:45) CHAR(6),
ADMRDEPT POSITION (46:48) CHAR(3),
LOCATION POSITION (49:64) CHAR(16))
• Example 2:
o The following control statement specifies that data from the data set that is defined
by the SYSREC DD statement is to be loaded into the table DSN8810.DEPT.
• Rebuilding index:
Two types:
Full image copy
Incremental image copy
• Full Image copy – Which is a copy of all pages in table space, index
space
• Incremental Image copy – Which is a copy only of those data pages that
have been modified since the last use of the copy utility and system pages
• Rows will be inserted into SYSIBM.SYSCOPY catalog table that describes the image
copy data sets that are available to the RECOVER utility .
• The RECOVER utility uses these copies when recovering a table space or index space
to the most recent time
• Before running COPY, check that the table spaces and index spaces that you
want to copy are not in any restricted states.
Example Full image copy
Sample JCL :
Sample JCL :
TOCOPY DB2P.FULLCOPY.DATASET.D090909
• Recovering a table space to the last image copy that was taken
• 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.
• Example 2:
Updating index statistics
• Example 3:
• The MODIFY utility with the RECOVERY option deletes records from the
SYSIBM.SYSCOPY catalog table, related log records from the
SYSIBM.SYSLGRNX directory table.
• You can remove records that were written before a specific date, or you can
remove records of a specific age. You can delete records for an entire table
space, partition, or data set.
• Example 2 :
• A Quiesce point is the current log RBA or Log Record Sequence Number(LRSN)
Quiesce then records the Quiesce point in the SYSIBM.SYSCOPY catalog table.
• A row with ICTYPE = ‘Q’ is inserted into SYSIBM.SYSCOPY for each tablespace that is
quiesced.
QUIESCE
• Example 1 :
• Sample JCL :