Search This Blog

Thursday, January 30, 2014

DB2 Table and Index Commands

Look at columns and data types of a table
=>db2 describe table schema.tabelename
Look at one column's data type.
=>db2 "describe select from schema.tablename"
Look at indexes on a table:
=>db2 describe indexes for table schema.tablename
Export data to a file in ixf format:
  • =>db2 export to tablename.ixf of ixf messages tablename.txt select * from SCHEMA.TABNAME
Import data from an ixf file:
  • =>db2 import from filename.ixf of ixf messages tablename.txt insert into SCHEMA.TABNAME
Import using Load which is faster (doesn't check constraints) and NONRECOVERABLE doesn't log anything.
  • =>db2 load from filename.ixf of ixf insert into SCHEMA.TABNAME nonrecoverable;
Build a file to set integrity on all tables that are in set integrity pending state.
=>db2 "select 'set integrity for '||tabschema||'.'||tabname ||' immediate checked;' from syscat.tables where type = 'T' and status = 'C'" > file.out

No comments:

Post a Comment

How to increase jms file store size in MAS

  Steps In order to increase the file store size we need to update the server.xml for the jmsserver bundle. The server.xml is added in ...