Installation and configuration of the DB2 database under Linux

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

A Installation and configuration of the DB2 database: 1. After the installation is complete, you need to add three operating system groups and three operating system users, as follows: Groupadd-g 999 db2iadm1  # (Group managing instances) Groupadd-g 998 db2fadm1  # (Set of installed instances) Groupadd-g 997 db2asgrp   # (Group installing DB2 Administration server)   #建立管理数据库实例的用户useradd-U 1004-g Db2iadm1-g db2iadm1-m-d/home/db2inst1 db2inst1-p "a" #建立安装实例的用户useradd-u 1003-g db2.fadm1-g db2fadm1-m-d/home/db 2fenc1 db2fenc1-p "A" #建立安装DB2 Administration server (DAS) user useradd-u 1002-g db2asgrp-g db2asgrp-m-d/home/dasusr1 da Susr1-p "A"   #为新建的三个用户分别修改密码passwd db2inst1passwd db2fenc1passwd dasusr16. #Creating a DB2 administration Server (DAS)-establishes the DAS and executes the following command:/opt/ibm/db2/v8.1/instance/dascrt-u dasusr17. #Creating an instance--set up a DB instance named Db2inst1 and execute the command as follows:   /OPT/IBM/DB2/V8.1/INSTANCE/DB2ICRT-A Server-u Db2fenc1 db2inst18. #Creating links for DB2 files--to establish a link to the DB2 file, with the following command:/opt/ibm/db2/v8.1/cfg/db2ln9. #Updating the DB2 product license key--registration software/opt/ibm/db2/v8.1/adm/db2licm–a /mnt/cdrom/db2/license/ Db2ese.lic create three user groups [[email&Nbsp;protected] adm]# groupadd-g 901 db2iadm1[[email protected] adm]# groupadd-g 902 db2fadm1[[email  Protected] adm]# groupadd-g 903 db2dadm1 Create three users (respectively, the user who owns the instance, the protected user, the DAS User) and specify the corresponding user group [[email protected] adm]# Useradd-g db2iadm1-u 101-d /home/db2inst1-m  db2inst1[[email protected] adm]# useradd-g db2fadm1-u 1 02-d /home/db2fenc1-m  db2fenc1[[email protected] adm]# useradd-g db2dadm1-u 103-d /home/db2das usr1-m  db2dasusr1 7. Add a password for three users add an instance user password [[[email protected] adm]# passwd db2inst1changing password for User Db2inst1. New UNIX Password: Enter a newer password (such as sunrier) bad Password:it are based on a dictionary wordretype new UNIX password: then enter a new password (such as Sunrier, Same as first input) Passwd:all authentication tokens updated successfully. [[[email protected] adm] #添加受防护的用户密码 [[email protected] adm]# passwd db2fenc1changing password for user Db2fenc1. New UNIX Password: Enter the password bad password:it are based on a dictionary wordretype new UNIX password: Then enter the new password (two times the same, otherwise you need to re-enter) Passwd:all authentication tokens updated successfully. [[[email protected] adm] #添加DAS用户密码 [[email protected] adm]# passwd db2dasusr1changing password for user DB2DASUSR1. New UNIX Password: Enter password bad password:it be based on a dictionary wordretype new UNIX password: Enter new password again (two times need to be the same, otherwise need to re-enter) pass Wd:all authentication tokens updated successfully. [[email protected] adm] #8. Check whether user groups and users create successful user groups: More/etc/group | grep DB2 User:  MORE/ETC/PASSWD | grep db2[[email protected] adm]# more/etc/group | grep db2db2iadm1:x:901:db2fadm1:x:902:db2dadm1:x:903:[[email protected] adm]# more/etc/passwd | grep db2db2inst1:x:101:901::/home/db2inst1:/bin/shdb2fenc1:x:102:902::/home/db2fenc1:/bin/shdb2dasusr1:x : 103:903::/home/db2dasusr1:/bin/sh[[email protected] adm]# 9. Creating an instance into the/opt/ibm/db2/v9.7/instance directory [[ Email protected] adm]# cd/opt/ibm/db2/v9.7/instance[[email protected] instance]# pwd/opt/ibm/db2/V9.7/ Instance[[email protected] Instance]#./dascrt-u DB2DASUSR1 (Note: Creating a DB2 Management Server) [[email protected] instance]#./db2icrt-u db2fenc1 Db2inst1 (Note: Creating DB2 instances)

10. #config Server communication--Configuration DB instance communication, as follows:

Vi/ect/services #修改services文件, at the end of the file, add the following:

Db2c_db2inst1 50000/tcp #TCP/IP Services for Db2inst1

11. Log in to the operating system as user Db2inst1, with the following command:

Su-db2inst1

12. Execute the following command:

#设置DB2的通信方式为tcpip

Db2set Db2comm=tcpip

#设置dbm参数SVCENAME为db2c_db2inst1

DB2 update dbm CFG using SVCENAME db2c_db2inst1

#设置数据库自动启动

Db2set Db2autostart=yes

#可以通过命令 env | grep db2instance to view the current instance name

13. Once the instance is installed, you can start the current instance with the Db2start command, db2stop the command to stop the current instance

14. After launching the instance, you can create a new database with the following command:

DB2 CREATE DATABASE DatabaseName using CodeSet GBK territory CN

#建立数据库databasename, and specifies that the character set type is GBK and the zone is CN.

#也可以执行命令db2samp来建立DB2自带的范例数据库sample

15. Connect to the database:

DB2 Connect to DatabaseName

16. This completes the installation of the database, then the database can be operated by itself;

Installation and configuration of the DB2 database under Linux

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.