In this post i will give steps to create DB2 Instance and DB2 database.
DB2 9.7 HADR with TSA Part 00 - Introduction
DB2 9.7 HADR with TSA Part 1 : Installing and configuring VMWare environment
DB2 9.7 HADR with TSA Part 2 : Installing IBM tools for querying and monitoring purpose
DB2 9.7 HADR with TSA Part 3 : Installing IBM DB2 9.7 database
DB2 9.7 HADR with TSA Part 4: Installing DB2 9.7 Fixpack
DB2 9.7 HADR with TSA Part 00 - Introduction
DB2 9.7 HADR with TSA Part 1 : Installing and configuring VMWare environment
DB2 9.7 HADR with TSA Part 2 : Installing IBM tools for querying and monitoring purpose
DB2 9.7 HADR with TSA Part 3 : Installing IBM DB2 9.7 database
DB2 9.7 HADR with TSA Part 4: Installing DB2 9.7 Fixpack
A) Steps to Create DB2 Instance
Item# | Description | Command |
---|---|---|
1 | Create new DB2 OS group | 1) Instance Owner Group groupadd -g 110 db2iadm1 2) Fence User Group groupadd -g 112 db2grp1 |
2 | Create DB2 instance ownere user | 1) DB2 Instance Owner user useradd -u 550 -g 110 -d /home/db2inst1 -m -c "DB2 Instance Owner" db2inst1 2) Set the instance owner password passwd db2inst1 |
3 | Create new DB2 fence user | 1) DB2 Fence user useradd -u 551 -g 112 -d /home/db2fenc1 -m -c "DB2 Fence User" db2fenc1 2) Set Fence user password passwd db2fenc1 |
4 | Create DB2 Instance | 1) Login as "root" user 2) Change directory to db2 install path cd /opt/ibm/db2/V9.7/instance 3) Create DB2 instance ./db2icrt -u db2fenc1 db2inst1 |
5 | Start the DB2 instance | 1) Login as DB2 Instance Owner 2) Check the $DB2INSTANCE environment to reflect the instance name echo $DB2INSTANCE 3) Start the DB2 database manager (DBM) db2start 4) Check if DB2 database manager is started db2pd -edus |
6 | Check DB2 Database Manager Parameters | db2 get dbm cfg |
B) Steps to Create DB2 database
Item# | Description | Command |
---|---|---|
1 | Create DB2 Database | 1) Login as DB2 instance owner 2) Create SAMPLE database db2sampl 3) Activate the SAMPLE database db2 activate db sample 4) Check if the database is activate successfully db2pd -edus 5) Check the database parameters db2 get db cfg for sample |
C) Connecting to remote database using JDBC
Item# | Description | Command |
---|---|---|
1 | Check the port number associate to instance | more /etc/services | grep -i db2inst1 |
2 | Check if the required port is set in SVCENAME DBM parameter | get dbm cfg | grep i svcename |
3 | Check if the DB2COMM variable is set | db2set -all |
4 | Set DBM and registry variable variable and restart the instance | 1)Set DBM parameter update dbm cfg using svcename 60008 2) Set registry variable db2set DB2COMM=tcpip 3) Restart the DB2 instance db2stop force;db2start |
5 | JDBC Connection Details | 1) Hostname 2) Database Name 3) Instance Port number 4) Username 5) Password |
D) Dropping the instance and database
Item# | Description | Command |
---|---|---|
1 | Drop the database | 1) Login as instance owner user under which DB2 database is created 2) Check if it is the correct instance db2 get instance 3) Check the database that needs to be dropped db2 list db directory 4) Deactivate the database a) db2 force application all b) db2 terminate c) db2 deactivate db sample 5) Drop the appropriate database db2 DROP DATABASE sample |
2 | Drop the Instance | 1) Login as instance owner 2) Stop the instance db2stop force 3) Check if instance is stopped db2pd -edus 4) Login as "root" user 5) Change to DB2 Install directory /opt/ibm/db2/V9.7/instance 6) Drop the Instance ./db2idrop db2inst1 |
3 | Delete the instance user, fence user and DB user | 1) Delete the instance owner user userdel -f db2inst1 2) Delete the fence user userdel -f db2inst1 |
No comments:
Post a Comment