Saturday

DB2 UDB Installation Determination

When you are planning to create DB2 UDB environment you need to checkout UDB prerequisite for Linux/Unix/Solaris/Aix. For personal PC minimum RAM 256 recommended my experience if you are using GUI its good practice using minimum RAM 512.
I-st you have to create administrator/root account then create at least two userid which always work on system due to this if some reason account lock….etc issues you can rectify with Admin/root user account.[If you are new to work with DB2 UDB its good practice to work on Windows 2k/XP] Down load free trial S/w from IBM website and store/place it at location/directory say /abworkarea/images or whatever convenient name/directory for you. For practice/understand just go with default environment setup.

Create the file system /abworkarea with mount point /abworkarea on CAMPDB0101, which is DB2 Instance owner’s home directory.Now you have already created a directory called images within the /abworkarea file system on machine CAMPDB0101(or check machine name on Linux/Unix/Solaris/Aix as at command prompt type hostname.) This directory will then contain the DB2 install image and fixpak (Or you can create separate directory for Fixpak) and will be made available to install db2 udb
Step 1 - Verify the file system mounts
As root, verify that the required files systems are mounted verify that the file system /abworkarea, which was created ahead of time, is indeed mounted
Verify the file system mounts with command df -k or df -g you will get output like below
$ df -k /abworkarea
Filesystem 512-blocks Free %Used Iused % Iused Mounted on
/dev/lvabwork1 536870912 334583264 38% 3148 1% /abworkarea
Step 2 - Required Files and packages
As root, make the appropriate DB2 images available and verify that Linux/Unix/Solaris/Aix has all of the required packages installed
At CAMPDB0101 server :
Copy the DB2 udb Installation Image say Db2_udbV8_2.tar file for DB2 UDB EE V8.2 for 32 or 64-bit to the /abworkarea/images directory.
Copy the *.tar file for FixPak 11a to the /abworkarea/images directory.
cp Db2_udbV8_2.tar /abworkarea/images/
check file is copied or not as : ls –ltr /abworkarea/images/
output must show/look like : /abworkarea/images/ Db2_udbV8_2.tar
Step 3 - Starting NFS
As root, verify that NFS is running on CAMPDB0101(Server)
$ showmount -e CAMPDB0101
export list for CAMPDB0101: /abworkarea/db2inst1 (everyone)
Step 4 Creating required groups and users
As root on CAMPDB0101 perform the following to create the appropriate OS users and groups for DB2 (Note: user and group IDs on machine must be the same):
Create a group for the instance owner (for example, db2iadm1), Create a group for the user that will execute UDFs or stored procedures (for example, db2fadm1), and Create a group for the Administration Server (for example, dasadm1) by entering the following commands
To create groups on AIX, enter the following commands (please change group id 999,998,997,
user id 1004, 1003, 1002 as needed)
1. mkgroup id=999 db2iadm1
2 mkgroup id=998 db2fadm1
3. mkgroup id=997 dasadm1
Create users for each group:
4. mkuser id=1004 pgrp=db2iadm1 groups=db2iadm1 home=/ abworkarea /db2inst1 db2inst1
5. mkuser id=1003 pgrp=db2fadm1 groups=db2fadm1 home=/ abworkarea /db2fenc1 db2fenc1
6. mkuser id=1002 pgrp=dasadm1 groups=dasadm1 home=/ abworkarea /dasusr1 dasusr1
( Optional :Set an initial password for each user that you created by entering the following commands )
7. passwd db2inst1
8. passwd db2fenc1
9. passwd dasusr1
Step 5 - Install DB2 UDB V8.2 EE and FixPak on instance-owning machine
As root on CAMPDB0101, perform the following to install IBM DB2 UDB EE V8.2 and FixPak:
1.cd /abworkarea/images/
2.tar -xvf Db2_udbV8_2.tar #--------- for db2 udb v8.2
3.tar -xvf *.tar #--------- (udb_8.2fix11.tar for fix-pak)
4.Install DB2:
cd /abworkarea/images/
./db2_install
5.When db2_install prompts you for the product keyword, enter:
DB2.EE
6.Install the FixPak:
cd /abworkarea/images/FP11a
./installFixPak V*
The default installation directory for DB2 on Aix is /usr/opt/db2_08_02
Step 6 - Tasks on instance-owning machine
As root on CAMPDB0101, perform the following:
1.Create DB2 instance:
cd /usr/opt/db2_08_02/instance
./db2icrt –w 64 -u db2fenc1 db2inst1 #<===== for 64 bit address space or
./db2icrt -u db2fenc1 db2inst1 #<===== for 32 bit address space 2. Configure TCP/IP for DB2 instance by updating the /etc/services file to specify the service name and port number that DB2 server will listen on for client requests.
$cat /etc/services
Our file looked like the following:
db2c_db2inst1 50000/tcp # DB2 connections service port
3. Update the database manager configuration file and .profile on the server:
su - db2inst1
Set up the instance environment by running the db2profile script
./abworkarea/db2inst1/sqllib/db2profile
To set up the user environment every time the user logs on to the Aix system, add the following command to .profile:
vi /abworkarea/db2inst1/.profile file
./abworkarea/db2inst1/sqllib/db2profile
Update SVCENAME parameter in DBM configuration file:
db2 update dbm cfg using SVCENAME db2c_db2inst1
Set DB2COMM registry variable to tcpip:
db2set DB2COMM=tcpip
Stop and re-start the instance for these changes to take effect
db2stop
db2start
4. As root, create DB2 Administration Server (DAS)
su -
cd /usr/opt/db2_08_02/instance
./dascrt -u dasusr1
Note: DAS is required if you plan to use the DB2 GUI tools, such as Control Center and Task Center
Step 7 - Testing configuration
Create UDB database as below
$cd /abworkarea/db2inst1/sqllib/bin
$./db2sampl
Connect to database command at cmd prompt type :
$ db2 connect to sample or db2 connect to sample user db2inst1 using db2inst1
$ Select data from table : $ db2 "select * from sales"
Now you are ready to work with DB2 UDB EE V8.2. Play with all tables and try to find out different output with your logic using select command Terminate session by
db2 terminate
Try to understand
db2 activate database ;db2 deactivate database; db2 connect reset ;db2 list application commands
also checkout all file system/directory tree contents using cd or ls –ltr commands after finish your practice to stop db2 engine fire command at cmd prompt
$ db2stop
To start db2 fire command at cmd prompt: db2start
In next article we will discuss design UDB environment for practical/real word application.