DB2 V9.1 Installation on Linux using db2_install

Install the DB2 using db2_install

1) Create group and user IDs for a DB2 installation

a) Creation of Groups
[root@mercury db2v9.1]# groupadd -g 999 db2iadm1
[root@mercury db2v9.1]# groupadd -g 998 db2fadm1
[root@mercury db2v9.1]# groupadd -g 997 dasadm1

Validate the Creation of group ID
[root@mercury db2v9.1]# cat /etc/group
gdm:x:42:
pegasus:x:65:
dovecot:x:97:
named:x:25:
ldap:x:55:
;
;;;

db2iadm1:x:999:
db2fadm1:x:998:
dasadm1:x:997:

b) Creation of Users
[root@mercury db2v9.1]# mkdir /db2home
[root@mercury db2v9.1]# useradd -u 1004 -g db2iadm1 -d /db2home/db2inst1 db2inst1
[root@mercury db2v9.1]# useradd -u 1003 -g db2fadm1 -d /db2home/db2fenc1 db2fenc1
[root@mercury db2v9.1]# useradd -u 1002 -g dasadm1 -d /db2home/dasusr1 dasusr1

c) Set the Password for the users

[root@mercury db2v9.1]# passwd db2inst1
Changing password for user db2inst1.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@mercury db2v9.1]# passwd db2fenc1
Changing password for user db2fenc1.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@mercury db2v9.1]# passwd dasusr1
Changing password for user dasusr1.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Validate the Userid
[root@mercury db2v9.1]# more /etc/passwd
……..
……..

db2inst1:x:1004:999::/db2home/db2inst1:/bin/bash
db2fenc1:x:1003:998::/db2home/db2fenc1:/bin/bash
dasusr1:x:1002:997::/db2home/dasusr1:/bin/bash

2) Create a DB2 Administration Server (DAS)

a)Log in as user with root user authority.
b)Issue the  command to create the DAS:

DB2DIR/instance/dascrt -u DASuser

where
DB2DIR specifies the path where the DB2 database product was installed.
/opt/ibm/db2/V9.1 for Linux operating systems
-u specifies the DAS user you created when creating users and groups.

[root@mercury db2v9.1]# cd /opt/ibm/db2/V9.1/instance/
[root@mercury instance]# pwd
/opt/ibm/db2/V9.1/instance

[root@mercury instance]# ls -l dascrt
-r-xr-xr-x  1 bin bin 4239 Nov  6  2007 dascrt

[root@mercury instance]# ./dascrt -u dasusr1
SQL4406W  The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.

3) Create an instance using db2icrt

Log in with proper authority.
Run the db2icrt command. For example, on Linux or UNIX operating systems:

DB2DIR/instance/db2icrt -a AuthType -u FencedID InstName

where:

DB2DIR
is the DB2 installation directory.
On Linux operating systems, the default installation directory is /opt/ibm/db2/V9.7.
-a AuthType (Linux or UNIX)
Represents the authentication type for the instance.
AuthType can be one of SERVER, CLIENT, or SERVER_ENCRYPT. SERVER is the default. This parameter is optional.
-u FencedID
Represents the name of the user under which fenced user defined functions (UDFs) and fenced stored procedures will run.
InstName
Represents the name of instance. The name of the instance must be the same as the name of the instance owning user.

The instance will be created in the instance owning user’s home directory.

For eg :
[root@mercury instance]# pwd
/opt/ibm/db2/V9.1/instance
[root@mercury instance]#

[root@mercury instance]# ./db2icrt -a SERVER -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.

[root@mercury instance]# ./db2ilist
db2inst1
[root@mercury instance]#

Create links for DB2 files
Configure TCP/IP communications for a DB2 instance

4) Register the license key using the License Center

DB2 license files

On Linux® or UNIX® operating systems, register a DB2 license key by entering the following command:

INSTHOME/sqllib/adm/db2licm -a filename

where INSTHOME represents the home directory of the instance owner and filename is the full path name and file name for the license key that corresponds to the product or feature you have purchased.

To confirm that you have successfully registered the license key, issue the command db2licm -l or db2licm -l show detail.
[db2inst1@mercury adm]$ pwd
/db2home/db2inst1/sqllib/adm
[db2inst1@mercury adm]$ ls -l db2licm
-r-sr-x—  1 root db2iadm1 58261 May 22 15:31 db2licm
[db2inst1@mercury adm]$ ./db2licm -l
Product name:                     “DB2 Enterprise Server Edition”
License type:                     “Restricted”
Expiry date:                      “Permanent”
Product identifier:               “db2ese”
Version information:              “9.1”
Annotation:                       “-4;(_o)”

5) Create a sampleDB to test it

[db2inst1@mercury ~]$ db2sampl

Creating database “SAMPLE”…
Connecting to database “SAMPLE”…
Creating tables and data in schema “DB2INST1″…

‘db2sampl’ processing complete.

db2 => connect to sample

Database Connection Information

Database server        = DB2/LINUX 9.1.4
SQL authorization ID   = DB2INST1
Local database alias   = SAMPLE

db2 => select * from staff

ID     NAME      DEPT   JOB   YEARS  SALARY    COMM
—— ——— —— —– —— ——— ———
10 Sanders       20 Mgr        7  98357.50         –
20 Pernal        20 Sales      8  78171.25    612.45
30 Marenghi      38 Mgr        5  77506.75         –
40 O’Brien       38 Sales      6  78006.00    846.55

This ensures that the DB has been created sucessfully , we would drop the DB after this test

6) Drop Sample Database

[db2inst1@mercury ~]$ db2 drop database sample
DB20000I  The DROP DATABASE command completed successfully.
[db2inst1@mercury ~]$

7) Logs in DB

[db2inst1@mercury db2dump]$ pwd
/db2home/db2inst1/sqllib/db2dump

[db2inst1@mercury db2dump]$ ls -ltr
total 6272
drwxrwxr-t  2 db2inst1 db2iadm1    4096 May 22 15:44 stmmlog
-rw-r—–  1 db2inst1 db2iadm1 6291376 May 22 15:45 db2eventlog.000
-rw-rw-rw-  1 db2inst1 db2iadm1   16192 May 23 03:57 db2inst1.nfy
-rw-r—–  1 db2inst1 db2iadm1   66383 May 23 03:57 db2diag.log
-rw-r–r–  1 db2fenc1 db2iadm1    3420 May 23 03:57 db2sampl_Import.msg

[db2inst1@mercury db2dump]$ ls -l db2diag.log
-rw-r—–  1 db2inst1 db2iadm1 66383 May 23 03:57 db2diag.log

[db2inst1@mercury db2dump]$ tail -f db2diag.log
to lock intent “X” was successful.

2011-05-23-03.57.34.331468+330 E65905G478         LEVEL: Warning
PID     : 2710                 TID  : 3086313152  PROC : db2agent (SAMPLE) 0
INSTANCE: db2inst1             NODE : 000         DB   : SAMPLE
APPHDL  : 0-770                APPID: *LOCAL.db2inst1.110522222722
AUTHID  : DB2INST1
FUNCTION: DB2 UDB, data management, sqldEscalateLocks, probe:3
MESSAGE : ADM5502W  The escalation of “11” locks on table “SYSIBM  .SYSRELS” to
lock intent “X” was successful.

[db2inst1@mercury db2dump]$

Directory of Installation

[db2inst1@mercury ~]$ cd /opt/ibm/db2/V9.1/
[db2inst1@mercury V9.1]$ ls -ltr
total 248
dr-xr-xr-x   3 bin  bin   4096 Nov  6  2007 java
dr-xr-xr-x   4 bin  bin   4096 Nov  6  2007 conv
dr-xr-xr-x   2 bin  bin   4096 Nov  6  2007 icons

7) Check the Ports

[db2inst1@mercury db2dump]$ cat /etc/services



# Local services

DB2_db2inst1    60000/tcp
DB2_db2inst1_1  60001/tcp
DB2_db2inst1_2  60002/tcp
DB2_db2inst1_END        60003/tcp
[db2inst1@mercury db2dump]$

Leave a Reply

Your email address will not be published. Required fields are marked *