Centos6.8 install DB2 10.5

1. Copy tar to /opt, use the root account, and install the software package

cd / opt

 tar - zxvf v9.5fp3b_linuxx64_server.tar.gz (64

 cd server

./db2_install      

2. Create users and groups

groupadd -g 999 db2iadm1

groupadd -g 998 db2fadm1

groupadd -g 997 dasadm1
useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1

useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1

useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1
Ø Change the password for each user

passwd db2inst1 (enter password)

passwd db2fenc1 (enter password)

passwd dasusr1 (enter password)

3. Create a DB2 Administration Server (DAS)

/ opt / ibm / db2 / V9. 7 / instance / dascrt -u dasusr1

4. Create an instance using db2icrt

/opt/ibm/db2/V9.7/instance/db2icrt -a server -u db2fenc1db2inst1

5. Configure the communication protocol of the instance

su -   db2inst1

db2set DB2_SKIPINSERTED=ON

db2set DB2_EVALUNCOMMITTED=ON

db2set DB2_SKIPDELETED=ON

db2set DB2_HASH_JOIN=YES

db2set DB2_RR_TO_RS=YES

db2set DB2CODEPAGE=1386

db2set DB2COMM=TCPIP

db2set DB2_PARALLEL_IO=*

db2 update dbm cfg using svcename 50000

6. Update the license

Ø Crack and copy the db2ese_t.lic file to the DB2 server

/opt/ibm/db2/V9.5/adm/db2licm -a filename 

filename is the path to the copy of db2ese_t.lic

Ø Select language

#vi / home / db2inst1 / .bash_profile

export LANG =en_US -- add this to the last line of this file


Ø View the current DB2 license status

are db2inst1

d2licm -l

7. Create the sample database SAMPLE

Under db2inst1, directly enter the command db2sampl

8. Start and stop the database

start database db2start
stop database db2stop

9. Other commonly used SQL

#create database
$ db2 "CREATE DATABASE DBTEST1 ALIAS DBTEST1 USING CODESET ISO8859-1 TERRITORY US" 
$ db2 "CREATE DATABASE DBTEST2 ALIAS DBTEST2 USING CODESET UTF-8 TERRITORY CN" 
The above statement takes a long time to output "DB20000I The CREATE DATABASE command completed successfully."
$ db2 connect to DBTEST1
#create table
$ db2 "CREATE table mytaba(col1 INTEGER NOT NULL, col2 VARCHAR(40), col3 DECIMAL(9,2))"
#Add record
$ db2 "INSERT INTO mytaba(col1,col2,col3) VALUES(1,'hello',9.2)"
#Inquire
$ db2 "SELECT * FROM mytabaFETCH FIRST 10 ROWS ONLY"

 

Note: Execute the pre-detection script db2prereqcheck to check the system configuration 

 

Install the pam package (if the execution is unsuccessful, manually make a soft link for libpam.so)

Where --nodeps removes dependencies from package installation

Install compat-libstdc++ 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325476130&siteId=291194637