0% found this document useful (0 votes)
24 views3 pages

The DB2 Admin 004

Uploaded by

Devaraj Condoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

The DB2 Admin 004

Uploaded by

Devaraj Condoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Db2 standalone utilities are tools that operate independently of the Db2 database engine's

online and offline environments. They perform specific maintenance tasks such as backup,
recovery, and dataset management. These utilities are essential for managing Db2 databases,
especially in a batch processing context.

Db2 Standalone Utilities Overview

1. Backup and Restore Utilities:


o Purpose: Create backups of databases or restore them from backups to ensure
data integrity and recovery capabilities.
o Utilities/Programs:
 DSN1COPY: A utility used to copy data between Db2 tables or to
copy data into a new table.
 DSNUTILB: A utility for managing and processing backup and
restore activities.
 REORG (for offline REORGs): When not used online, it can be
considered a standalone utility for reorganization tasks.
2. Image Copy Utilities:
o Purpose: Create image copies of Db2 tables or indexes for backup purposes.
o Utilities/Programs:
 IKJTSOxx (for TSO commands): Execute image copy commands
using TSO.
 UNLOAD and LOAD: Utilities for unloading data from tables to flat
files and loading data into tables from flat files.
3. Data Set Management Utilities:
o Purpose: Manage and maintain Db2 datasets, including allocation and
deallocation.
o Utilities/Programs:
 DSN1PRNT: Prints out data from Db2 tables and indexes for
verification or auditing purposes.
 DSN1COPY: Can also be used for dataset management tasks such as
copying datasets.

Real-Time Scenarios and How They Work

1. Database Backup:
o Scenario: You need to perform a backup of your production database before
applying a major update.
o Action: You use DSNUTILB to create a backup of the database. The utility
will create a backup image that can be used to restore the database in case
something goes wrong during the update.
o Example JCL:

//BACKUP JOB (ACCT),'BACKUP JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
BACKUP DATABASE dbname TO 'backup.dataset';
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//```
2. Database Restore:
o Scenario: A recent database update caused data corruption, and you need to
restore from a backup.
o Action: You use DSNUTILB to restore the database from the backup created
previously.
o Example JCL:

//RESTORE JOB (ACCT),'RESTORE JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
RESTORE DATABASE dbname FROM 'backup.dataset';
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//```

3. Reorganizing Data:
o Scenario: A large table has become fragmented due to frequent updates, and
you need to reorganize it to improve performance.
o Action: You perform an offline REORG of the table to defragment the data.
This can be scheduled during a maintenance window to avoid downtime.
o Example JCL:

//REORG JOB (ACCT),'REORG JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
REORG TABLE schema.table_name;
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//```

4. Unloading Data:
o Scenario: You need to unload data from a table for reporting or data
migration purposes.
o Action: You use the UNLOAD utility to extract data from the table into a flat
file.
o Example JCL:

//UNLOAD JOB (ACCT),'UNLOAD JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
UNLOAD TABLE schema.table_name TO 'unload.file';
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//```

Programs and Utilities

1. DSNUTILB: A batch utility used for managing Db2 backup and restore operations. It
includes various functions for database administration.
2. DSN1COPY: A utility for copying data between datasets, useful for backup and
restoration tasks.
3. IKJTSOxx: Can be used to run image copy commands and other TSO-related Db2
tasks.
4. UNLOAD: Extracts data from Db2 tables to flat files, which can be used for
migrations or analysis.

JCL Syntax for Common Utilities

 DSNUTILB Example JCL:

//BACKUP JOB (ACCT),'BACKUP JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
BACKUP DATABASE dbname TO 'backup.dataset';
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*

 UNLOAD Example JCL:

//UNLOAD JOB (ACCT),'UNLOAD JOB',CLASS=A,MSGCLASS=X


//STEP1 EXEC PGM=DSNUTILB
//SYSIN DD *
UNLOAD TABLE schema.table_name TO 'unload.file';
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*

Each of these utilities plays a critical role in maintaining the health and performance of Db2
databases, especially in batch processing environments where downtime needs to be
minimized. Always consult the latest Db2 documentation for detailed usage instructions and
syntax tailored to your Db2 version and environment.

You might also like