Archive | db2 RSS feed for this section

DB2 problems

2 Nov

If DB2 isn’t starting, look for log files in /tmp and also in the db2 user’s dir: e.g. /home/db2inst1/sqlib/log

Powered by ScribeFire.


DB2 problems

4 Oct

If DB2 isn’t starting, look for log files in /tmp and also in the db2 user’s dir: e.g. /home/db2inst1/sqlib/log

V9.1 Enterprise Edition on Linux (CentOS) i was having troubles with commands hanging or freezing. It appeared that db2sysc would lock up with 100% of the CPU.

To fix this I did:

$> su - db2inst1
$> cd sqllib/bin
$> db2_kill
$> ipclean

then.. kill any remaining db2 processes (use

ps -ef | grep db2

and kill the PID’s)

then (as root):

$> cd /opt/IBMdb2/V7.1/instance

I got this from:


2 Jul

DB2v9 install:
I needed to install X on CentOS so I could get vmtools going:
– Need to install X-org and Kernel sources (for vmtools)

– For the GUI to work you need to install openmotif
– Probably need to install compat-libstdc++-33-3.2.3-47.3 and compat-db-4.1.25-9

db2 basic commands

29 Jun

need to start database manager in db2 before isntalling Information Server
or if it is says “No start database manager command was issued”
$> start database manager

to stop:
$> stop database manager

need to create database “xmeta” in db 2 before isntalltion IS
$> create database xmeta

to start the database you probably need to be the db2inst1 user and then:
$> db2start

need to grant permissions on xmeta to xmeta

 $> grant on  to 
 $> grant DBADM on database to user  # This is if you have already connected to the database
 $> grant DBADM on database xmeta to xmeta   # note the password is used up on the system.. (DBADM is all privileges)

need to create unix user as “xmeta” and password
or if you are on windows, you can do “net use /add” to create a user that db2 can authenticate against

connect to database from within db2
$> connect to user using

disconnet to database from within db2
$> disconnect

list all databases
$> list db directory

list active database
$> list active databases

list or show tables
$> list tables

If you get “SQL1025N The database manager was not stopped because databases are still active.”
$> stop database manager

$> list active databases

And to stop everything:
$> force application all

To see db2 profile variables”
$> db2set -all
$> db2set -? # for help

You can set these variables:
$> db2set db2comm=tcpip

To see current configuration:
$> db2 get dbm cfg

I was getting the following error when running ‘db2start’:
“SQL5043N Support for one or more communications protocols failed to start successfully. However, core database manager funtionality started successfully”
– This was because TCP/IP stuff was not setup properly (i.e. you could not telnet to port 50000).
To fix:
1. $> db2set db2comm=tcpip
2. ensure that /etc/services has a line like: “db2cdb2inst1 50000/tcp” in it
3. $> db2 update database manager configuration using svcename db2cdb2inst1

Does DB2® for Linux®, Windows® and UNIX® have something like Oracle's DUAL table?

Yes, DB2 database products have a dummy table to select against: SYSIBM.SYSDUMMY1.

DB2 database products also support a VALUES statement.

Either of these can be used to query the values of special registers that can tell you the current time or connected user.

For example:

db2 connect to sample

db2 values user

db2 values current timestamp

db2 select user, current timestamp from sysibm.sysdummy1