Monday 15 December 2014

Exporting and importing data from specific tables

You export data from specific table/s using the command -


db2 export to filename of ixf select * from table 

where ixf is the file-type


You import into specific tables using the command -

db2 import from filename of fileformat import_mode into table

where there are 3 import modes. The commonly used one, for backing up and versio - ning is-

REPLACE - to keep table structures and indexes, and replace data

Friday 12 December 2014

What to do when the transaction log becomes full

You have to run the following commands

Connect to database using -
     db2 connect to DBNAME USER <USERBANEM> USING <PASSWORD>

See the details for the database using -
    db2 get db cfg for DBNAME show detail

Increase the number of primary log files using -
    db2 update db cfg for DBNAME using logprimary 2

Increase the number of secondary log files using -
    update db cfg for DBNAME using logsecond 2

Increase the number of pages of size 4 kB each using -
   update db cfg for DBNAME using logfilsiz 100000

The total log size you saw in details and which you set, is number of pages x page size x (number of primary logs _ number of secondary logs)

Thursday 4 December 2014

Resolving Error Code 7



You might get error code 7 after altering a table. In that case run the command REORG TABLE <TABLE NAME> in the DB2 Command Line Processor (Command line client) to resolve the issue.