Db2 Inspect

Background

As we discussed in an earlier post, one has to be careful when restarting a box that houses a database server.

The post that discusses the proper steps are here :-

DB/2 LUW – Stopping DB2 Subsystem ( On MS Windows )
Link

Db2 Inspect

Introduction

There are a couple of options for validating Db2 databases.

Our options include :-

  1. Db2 Inspect
  2. db2dart

Outline

  1. Preparation
    • Get diag folder
  2. Inspect Database
    • db2 inspect
  3. Convent binary file from db2 inspect to text file
    • db2inspf
  4. Review prepared text file

Preparation

Outline

  1. Get diag folder

Get Diag Folder

Linux

db2 get dbm configuration | grep "DIAGPATH"

Windows

db2 get dbm configuration | find /i "DIAGPATH"

db2 inspect

Outline

The steps to take are :

  1. Launch db2cmd window by issuing db2cmd
  2. connect to the database ( connect database [database] )
  3. Issue db2 inspect command

Check Database

Sample


db2cmd
db2 connect to sample
db2 "inspect check database RESULTS KEEP db2_inspect_database_20180915_0810AM.txt ON DBPARTITIONNUM (1)"

Output


DB20000I  The INSPECT command completed successfully.

Check Table

Sample


db2cmd
db2 connect to sample
db2 "inspect check table NAME ACT SCHEMA DADENIJI RESULTS KEEP db2_inspect_table_act.txt ON DBPARTITIONNUM (1)"

Output


DB20000I  The INSPECT command completed successfully.

db2inspf

db2inspf ( No Parameters )

Sample


C:\>db2inspf db2_database_sample_20180915_0807AM.txt db2_database_sample_clear_20180915_0807AM.txt

Trouble Shooting

db2 inspect

SQL1143N The operation cannot complete because a file error occurred for the file “e:\db2temp\db2_inspect.txt”

Error

Error Image

SQL1143N_20180915_0851AM

Error Text

SQL1143N  The operation cannot complete because a file error occurred for the
file "e:\db2temp\db2_inspect.txt".
Remediation

One does not need to use the full file path.

The file is placed in the db2 dump directory.

BTW, issue “db2 get dbm configuration” to get database configuration and deduce the db2diag folder.

File Is Already In use

Error

Error Image

fileIsAlreadyInUse_20180915_0841AM.PNG

Error Text

SQL1142N  The operation cannot complete because the file "db2_database_sample.txt" is already in use.

Remediation

Please use a new file name

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s