You are on page 1of 3

DB2 UTILITIES

------------------------------

1 . CHECK DATA COMMANDS

Using this utility used with tables having parent-child relationship, by using this utility we can get all the
relation violated records in a like table. if u give the delete option=yes , the violated records will be
deleted in the child table. The delete=no , the child table still having the
violated records.
CHECK DATA
TABLESPACE EDSDB.TRG7ETS
FOR EXCEPTION IN TRG007.EMPLOY
USE TRG007.LEXEMP
DELETE YES
--------------------------------------------------------------------------------------------------------------------------------2. COPY UTILITY

This utility is used to make full image copies.


COPY TABLESPACE EDSDB.TRG007TS
FULL YES
SHRLEVEL CHANGE
--------------------------------------------------------------------------------------------------------------------------------3. INCREMENTAL COPY UTILITY

This utility records the changes only as incremental image copy


COPY TABLESPACE EDSDB.TRG007TS
FULL NO
SHRLEVEL CHANGE
----------------------------------------------------------------------------------------------------------------------------- ---4. LOAD DATA UTILITY

This utility is used to load the data in to tables


RESUME =YES : Resumes all the records from 1st to last
RESUME=NO : It won't resumes old records from first.
(While using this the table must be empty i.e. table contains no data.)
REPLACE : It overrides the previous records set with current records set
LOAD DATA
RESUME (YES/NO)
[REPLACE ]
INTO TABLE EMP
(EMPNO
POSITION(6)
NUMERIC(6),
EMPNAME
POSITION(15)
VARCHAR(20),
SALARY
POSITION(30)
VARCHAR(20),
LOCATION
POSITION(40)
VARCJAR(20),
PHONE
POSITION(50)
NUMERIC(9))
--------------------------------------------------------------------------------------------------------------------------------5. MERGECOPY

UTILITY

It merges all incremental image copies along with full copy gives merged copy.
NEWCOPY=YES : It makes one full image copy ,by taking all incremental image copies with

existed full image copy.


NEWCOPY=NO : It prepares a single incremental image copy by taking all incremental image copies.
--------------------------------------------------------------------------------------------------------------------------------MERGECOPY TABLESPACE EDSDB.TRG007TS
NEWCOPY (YES/ NO)
----------------------------------------------------------------------------------------------------------------------------- ---6. MODIFY RECOVERY UTILITY
If DELETE =YES , deletes all the image copies created before specifying the date.

( Before using this utility we need to take full image copy)


---------------------------------------------------------------------------------------------------------------MODIFY RECOVERY
TABLESPACE EDSDB.TRG007TS DELETE DATE(YYYYMMDD)
---------------------------------------------------------------------------------------------------------------------------- ----7. QUIESCE UTILITY
QUIESCE TABLESPACE
EDSDB.TRG7ETS
----------------------------------------------------------------------------------------------------------------------------- ---8. REBUILD INDEX UTILITY
REBUILD INDEX ALL
TABLESPACE EDSDB.TRG7ETS
----------------------------------------------------------------------------------------------------------------------------- ---9. RECOVERY UTILITY

It recovers all the data which is u loosed to the specified image copy point.
or to a quiesce point thru TORBA.
RECOVER TABLESPACE EDSDB.TRG7ETS TOCOPY TRG007.FULL.COPY.RECOVER
TORBA(X'59940509440985')
--------------------------------------------------------------------------------------------------------------------------------10. REORG UTILITY

It reorganizes the unused spac in the tablespace


REORG TABLESPACE EDSDB.TRGETS
SHARLEVER CHANGE
----------------------------------------------------------------------------------------------------------------------------- ---11. REPORT UTILITY

Gives brief repot of all full image copies and all incremental image copies till date
REPORT RECOVERY
TABLESPACE EDSDB.TR007TS
----------------------------------------------------------------------------------------------------------------------------- ---12. STOSPACE UTILITY

It updates the catalog with current occquiped tablespace and storage space
STOSPACE STOGROUP <STORAGEGROUPNAME -EDSSG>
----------------------------------------------------------------------------------------------------------------------CREATE TABLESPACE COMMANDS
----------------------------------------------------------------------------------------------------------------------CREATE TABLESPACE < TBSNAME -TRG007TS>
IN <DBNAME -EDSDB>
USING STOGROUP <STORAGEGROUPNAME -EDSSG>
PRIQTY 50
SECQTY 25

LOCKSIZE PAGE OR TABLE


BUFFERPOOL BP0
CLOSE YES
----------------------------------------------------------------------------------------------------------CREATE TABLE COMMAND
----------------------------------------------------------------------------------------------------------CREATE TABLE <TBSNAME.TABLENAME>
(ORDID
CHAR(6) NOT NULL,
ORDDES
VARCHAR(20),
LOCATION
VARCHAR(20),
ORDTYPE
CHAR(2),
PRIMARY KEY(ORDID))
IN <DBNAME.TBSNAME>
-------------------------------------------------------------------------------------CREATE INDEX COMMAND
-------------------------------------------------------------------------------------CREATE UNIQUE INDEX <INDEXNAME> ON
<TBSNAME.TBNAME>(KEY -ORDID ASC)
-------------------------------------------------------------------------------------INSERT ROWS COMMAND
-------------------------------------------------------------------------------------INSERT INTO <TBNAME> VALUES (111,'AAAAAA','XXXXX');
--------------------------------------------------------------------------------------

You might also like