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
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
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
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.
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
update database manager configuration using svcename db2comm_inst1
Then execute commands
If everything went well, DB2 is now up and running. You can create a test database with command
If you installed version 9.7 you should now proceed with kernel parameter and memory configuration to ensure that DB2 work efficiently.