CentOS under the DB2 database installation process detailed _DB2

Source: Internet
Author: User
Tags chmod db2 db2 connect db2 connect to centos

Recently because the work needs to study the DB2 database, this tutorial explains the DB2 database installs the procedure under Inux.

Before installing, please check the DB2 version and license description to increase understanding, first understand what version to install, here I use the latest express-c version, this version is provided for personal learning version.

The management client has no control center since the v9.7 version, but instead uses Data Studio client.

Linux version:

Linux version of the DB2 database using the official free version of the operating system with the CentOS6.2.

Installation process:

1, Download: db2_v101_linuxia32_expc.tar.gz

2, decompression, after the completion of the current directory will have a./expc folder

code as follows:

[Root@localhost opt]# TAR-ZXVF db2_v101_linuxia32_expc.tar.gz

3. Enter this catalogue

code as follows:

[Root@localhost opt]# CD expc/

4. Perform installation

code as follows:

[Root@localhost expc]#./db2_install

5, add groups and users:

Group (user name)

DB2IADM1 (Db2inst1)

code as follows:

[Root@localhost expc]# groupadd-g DB2IADM1
[Root@localhost expc]# groupadd-g 2001 DB2FADM1
[Root@localhost expc]# useradd-m-G db2iadm1-d/home/db2inst1 Db2inst1
[Root@localhost expc]# useradd-m-G db2fadm1-d/home/db2fenc1 db2fenc1
[Root@localhost expc]# passwd Db2inst1
[Root@localhost expc]# passwd db2fenc1

6, install license (product license) PS: If it is EXPRESSC version do not have to do

code as follows:

[Root@localhost adm]# pwd 

[Root@localhost adm]# chmod-r 775 *
[Db2inst1@localhost adm]$./db2licm-a/tmp/seagull/db2v10/license/db2ese_c.lic

7. Create instance and sample database

code as follows:

[Root@localhost instance]# pwd
[Root@localhost instance]# chmod-r 775 *
[Root@localhost instance]#./db2icrt-p 50000-u db2fenc1 Db2inst1
[Root@localhost instance]# Su-db2inst1
[Db2inst1@localhost ~]$ Db2sampl
Creating database "SAMPLE" ...
Connecting to Database "SAMPLE" ...
Creating tables and data in schema "Db2inst1" ...
Creating tables with XML columns and XML data in Schema "Db2inst1" ...
' Db2sampl ' processing complete.
[Db2inst1@localhost ~]$ Db2start
sql1026n The database manager is already active.
[Db2inst1@localhost ~]$ DB2 connect to sample
Database Connection Information
Database Server = Db2/linux 10.1.2
SQL Authorization ID = Db2inst1
Local Database alias = SAMPLE
[Db2inst1@localhost ~]$ DB2 "SELECT * from Staff"

8. Create DAS Management Server

In order for remote clients to use Control center to control the database server, you need to install DAS on the database server, of course, if only remote connection instead of remote management, you can not install, here I installed.

code as follows:

[Root@localhost expc]# groupadd-g 2002 DB2ASGRP
[Root@localhost expc]# useradd-m-G db2asgrp-d/home/db2as db2as
[Root@localhost expc]# passwd db2as
[Db2as@localhost ~]$ su-db2as # Here test the new user
[Db2as@localhost ~]$ su # here goes to root privileges
[Root@localhost ~]# cd/opt/ibm/db2/v10.1/instance/
[Root@localhost instance]#./dascrt-u db2as
Dbi1070i program DASCRT completed successfully.
[Root@localhost instance]# Su-db2as
[Db2as@localhost ~]$ db2admin start
sql4409w The DB2 administration Server is already active.

9, set the port number

code as follows:

At the end add a line of # Ps:vim shortcuts, enter "G" in command mode to jump to the last line.
code as follows:
Db2inst1 50000/tcp

10, DB2 configuration, to switch to the user Db2inst1

code as follows:

Db2set Db2_extended_optimization=on
Db2set Db2_disable_flush_log=on
Db2set Autostart=yes
Db2set Db2_striped_containers=on
Db2set db2_hash_join=y
Db2set Db2comm=tcpip
Db2set db2_parallel_io=*
Db2set db2codepage=819 PS: This place is more important
# DB2 Update Database Manager configuration using Svcename Db2inst1

11. Set Svcename to the port number or service name in/etc/services?

code as follows:

[Db2inst1@localhost ~]$ DB2 get dbm Cfg|grep SVCENAME
TCP/IP Service name (SVCENAME) =
SSL Service Name (ssl_svcename) =
Locate Svcename, and update settings if the current value is not a server-side port number or service name. 

[Db2inst1@localhost ~]$ DB2 update dbm CFG using SVCENAME db2inst1
# DB2 update dbm CFG using Indexrec ACCESS
[Db2inst1@localhost ~]$ DB2 get dbm Cfg|grep SVCENAME
TCP/IP Service name (SVCENAME) = 50000

SSL Service Name (ssl_svcename) = 

# Ps:svcename needs to be used when connecting to clients

12. You need to shut down the firewall before starting DB2 , otherwise you can't connect at all (this place has been a long time of negligence), under the root User: service iptables stop

13. Open DB2, execute: db2start, if already open state, then stop First, execute: db2stop.

Set up view:

PS: Reboot the machine encountered a problem, that is, shutdown Firewall no response, open shutdown database unresponsive, remote can not connect to the database, the solution is to restart the server, and then in order to shut down the firewall, and then restart the DB2 database.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.