DB2 Linux configuration

DB2 is now installed and certain  configurations are in order, so that it can be used for something. What should be done is to create certain groups and users for DB2 , create an DB2 instance and configure it to use TCP/IP and certain port.

Create groups and users

sudo groupadd -g 999 db2iadm1
sudo groupadd -g 998 db2fadm1
sudo groupadd -g 997 dasadm1

These groups are handy, if you need to give instance owner group rights to certain users etc. Then create instance owner user, fenced user and admin server user


sudo useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 -s /bin/bash db2inst1
sudo useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 -s /bin/bash db2fenc1
sudo useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 -s /bin/bash dasusr1

Then give each account a password


sudo passwd db2inst1
sudo passwd db2fenc1
sudo passwd dasusr1

Create instance and admin server
Now we are ready to create DB2 administration server instance. In the following the path for commands is /opt/ibm/db2/V9.7/. If you are using other version, then you should change this path accordingly.


sudo /opt/ibm/db2/V9.7.2/instance/dascrt -u dasusr1

Assuming this was successful, database admintration was created and started, and we create db2 instance


sudo /opt/ibm/db2/V9.7.2/instance/db2icrt -a server -u db2fenc1 db2inst1

Now we have to create certain links


sudo /opt/ibm/db2/V9.7.2/cfg/db2ln

Quite probably you will get some errors as a response to this command. Do not worry, it just happened that couple of symbolic links were not created correctly. You can correct them with


cd /usr/lib
sudo rm libdb2e.so.1.0
sudo ln -s libdb2e.so.1 libdb2e.so.1.0
sudo rm libdb2.so.1.0
sudo ln -s libdb2.so.1 libdb2.so.1.0
cd

Networking
DB2 has to able to communicate through network. Edit file /etc/services (as root, of course). Use one of of the following commands to open the file


sudo nano /etc/services
kdesudo kate /etc/services

and add line


db2comm_inst1 50001 # DB2 connection

at the end of the file. You can use other port number if you wish.

Now login as db2inst1 user and start instance.


su db2inst1
. ~/sqllib/db2profile
db2stop
db2start

You should get a message stating that db2 instance was started. It is possible that you get an error. This is because kernel parameter and memory configuration is not set yet. We will worry about that later. Just repeat db2start command, and now DB2 should start.

Now we change into DB2 command line and execute following commands


db2
update database manager configuration using svcename db2comm_inst1
db2stop
db2start
quit

Then execute commands


db2set DB2COMM=tcpip
db2stop
db2start

If everything went well, DB2 is now up and running. You can create a test database with command


db2sampl

If you installed version 9.7 you should now proceed with kernel parameter and memory configuration to ensure that DB2 work efficiently.

Advertisements
Comments
7 Responses to “DB2 Linux configuration”
  1. RastaMan says:

    Thanks for these instructions. There was lots of steps but in the end it worked. Keep up the good work

  2. Karthik raj says:

    after executing this
    db2set DB2COMM=tcpip
    db2stop
    db2start

    i got
    SQL5043N Support for one or more communications protocols failed to start successfully. However, core database manager functionality started successfully.

    • technomagus says:

      Error message means that DB2 is running, but some (unfortunately it does not say which) communication protocol is not working. I suppose that it could be tcpip. If it is TCPIP, then you cannot connect to DB2 using TCPIP protocol. Basically, this means that e.g. web-applications (using PHP etc.) cannot communicate with DB2. This renders DB2 quite useless. But without any other info, it is hard to say. Only way to be sure is to test, if you can make a tcpip connection to DB2.

      Even if you can connect to DB2 using command line processor (CLP) does not mean that TCPIP connection works. Try to connect to your Db2 installation with from IBM Data Studio from another machine, for example. Make sure that firewalls are not blocking any connections (port you specified previously should be let open). If you can connect then TCPIP is working and it was some other protocol that was not working.

      I am sorry, but without more specific information, I cannot give more assistance.

  3. Karthik raj says:

    is that a problem or db2 will be working fine????

  4. adam says:

    Instead of this line in /etc/services:
    db2comm_inst1 50001 # DB2 connection

    Make it this:
    db2comm_inst1 50001/tcp # DB2 connection

  5. Jun says:

    Everything in your blog is spot on!!! I just wish that the procedures of the technologies that we need to install and learn are as straight forward as your instructions. Before discovering your blog, we could only scratch our heads with DB2.. Thanks for the great work!!!

Trackbacks
Check out what others are saying...
  1. […] Installation program will ask for installation directory (just use the default). Installation takes a while, and if it is successful, you should get the message The Execution completed successfully. DB2 is now installed, but it is not yet ready for use. After this we continue with DB2 Linux Configuration. […]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 105 other followers

%d bloggers like this: