Personal tools
You are here: Home DB2 How To's How to identify the type of Index on DB2
Navigation
Log in


Forgot your password?
 
Document Actions

How to identify the type of Index on DB2

Type of index can be identified by inspect command.


Using the db2 inspect to discover the type of index



Before to use the db2inspect you need to connect on database

db2 connect to sample
db2 inspect check database results keep IndexCheck.log
DB20000I The INSPECT command completed successfully.

You then run the command

db2inspf $INSTHOME/sqllib/db2dump/IndexCheck.log IndexCheck.out

Then, you can view the inspect output:

$ more IndexCheck.out

Tablespace phase start. Tablespace ID: 2

Tablespace name: EMP
Tablespace Type: SMS - System Managed Space; Extent size: 24;
Page size: 8192; Number of containers: 1
Container name: /home/db2inst1/node0/employee/EMP
Table phase start (ID Signed: 5, Unsigned: 5; Tablespace ID: 2) :

Data phase start. Object: 5 Tablespace: 2

The index type is 1 for this table.
DAT Object Summary: Total Pages 532 - Used Pages 127 - Free Space 74 %

Data phase end.

Index phase start. Object: 5 Tablespace: 2
INX Object Summary: Total Pages 33 - Used Pages 33
Index phase end.

Table phase end.


Converting the type-1 to type-2


To convert the type1 to type2 is very simple.  You just  need to run the following command:

db2 reorg indexes all for table <SCHEMA_NAME>.<TABLE_NAME> convert

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls