This utility inspects the database for architectural integrity, checking the pages of the database for page consistency. The inspection checks whether the structures of table objects and table spaces are valid.
In a single-partition system, the scope is that of a single partition only. In a partitioned database system, it is the collection of all logical partitions defined in db2nodes.cfg.
The user must be one of the following: sysadm, sysctrl, sysmaint, dbadm, or control privilege, if dealing with a single table.
Connection to the database is required.
Command parameters for the db2inspf utility:
data-file: The unformatted inspection results file to format
out-file: The output file for the formatted output
- - tsi n: Table space ID. Format out only for tables in this table space.
- - ti: n Table ID. Format out only for table with this ID; table space ID must also be provided.
- - e: Format out errors only
- - s: Summary only
Sample output from db2 inspect and db2inspf:
$ db2 connect to sample $ db2 inspect check database results inspect_sample.err
The online inspect check processing will write out unformatted inspection data results to the results file specified. The file will be written out to the diagnostic data directory path. If there is no error found by the check processing, this result output file will be erased at the end of INSPECT operation. If there are errors found by the check processing, this result output file will not be erased at the end of INSPECT operation. After check processing completes, to see inspection details, the inspection result data must be formatted out with the utility db2inspf. The results file will have a file extension of the database partition number.
In a partitioned database environment, each database partition will generate its own results output file with an extension corresponding to its database partition number. The output location for the results output file will be the database manager diagnostic data directory path. If the name of a file that already exists is specified, the operation will not be processed; the file will have to be removed before that file name can be specified.
You can use the option KEEP to always keep the result output file.
$ db2 inspect check database results keep inspect_sample.err $ db2inspf inspect_sample.err inspect_sample.fmt