For the first time, I installed DB2 on Linux. I have referenced a lot of online resources, But I mainly used "detailed steps for installing DB2 version 8.1 in Linux ".
At the same time, I kept a record of my problems for learning.
VMWARE uses VMware server 1.0.6 and Linux kernel version: Linux node1 2.6.18-53. el5PAE
Root permission operation:
Step 1: Check the package and its version
Compat-libstdc ++-7.3-2.96.118.i386.rpm
Find the linux installation disk and use rpm-I compat-libstdc ++-7.3-2.96.118.i386.rpm to install it.
Step 2: Configure Linux Kernel Parameters
/Etc/sysctl. conf file to add Kernel Parameters
Kernel. msgmni= 1024
Kernel. sem = 250 256000 32 1024
Activate the change: sysctl-p
Step 3: Install
Sh db2_install
Follow the prompts
Step 4: create a user
/Usr/sbin/groupadd db2iadm1
/Usr/sbin/groupadd db2fadm1
/Usr/sbin/useradd-m-g db2iadm1-d/home/db2inst1 db2inst1
/Usr/sbin/useradd-m-g db2fadm1-d/home/db2fenc1 db2fenc1
Step 5: Create an instance
/Opt/IBM/db2/V8.1/instance/db2icrt-a server-u db2fenc1 db2inst1
** Please can go into/opt/IBM/db2/V8.1/instance, find file db2iutil
And replace all 'Tail + 2' with 'Tail-n + 2' if you meet error.
Step 6: Product License
/Opt/IBM/db2/V8.1/adm/db2licm-a/mnt/cdrom/db2/license/db2pe. lic
Step 7: Allow multi-page distribution of SMS
/Opt/IBM/db2/V8.1/cfg/db2ln
# Step 8: Add a DB2 Port
# SU-root
# Add vi/etc/services to the following line
# Db2inst1 50000/tcp
This step is not required. You can add it by yourself, but you may need to change it as follows:
DB2_db2inst1 50000/tcp
DB2_db2inst1_1 50001/tcp
DB2_db2inst1_2 50002/tcp
Db2_db2instanceend 50003/tcp
DB2 user operations
Step 9: DB2 Configuration
Su-db2inst1
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
# Update dbm cfg
Db2 update dbm cfg using SVCENAME db2inst1
Db2 update dbm cfg using INDEXREC ACCESS
Step 10: Run DB2
Db2start
If raised error message:
Please check $ DB2_home/sqllib/db2nodes. cfg,/etc/hosts uname-n, confirm that all the node name is same.
Step 2: Create a database
Db2 "create database test1 on/opt/IBM/tony/using codeset ISO8859-1 territory cn"
You can create tables and operate on tables later, for example, db2 "select * from sysibm. sysdummy1"
Client operation:
1. catalog DB
Db2 catalog tcpip node DS_NODE remote 192.168.102.128 server 50000
Db2 catalog db test1 as ds_test1 at node ds_node
2. A common DB2 connection error occurs:
Db2 connect to ds_test1 user db2inst1 using 123456
SQL30081N A communication error has been detected. Communication protocol
Being used: "TCP/IP". Communication API being used: "SOCKETS". Location
Where the error was detected: "192.168.102.128". Communication function
Detecting the error: "connect". Protocol specific error code (s): "10061 ","*",
"*". SQLSTATE = 08001
Map the VCENAME value of dbm to the port number in/etc/services.
Db2 update dbm cfg using SVCENAME 50000
3. restart DB
Db2stop force
Db2start
Db2 activate db test1
4. Confirm Parameters
[Db2inst1 @ node1 C] $ db2set-all
[I] DB2COMM = TCPIP
[G] DB2_EEE_LICENSE_POLICY = 4295032864
[Db2inst1 @ node1 C] $ netstat-an | grep 50000
Make sure that the DB2COMM parameter has been set and port 50000 has been enabled.
5. pagecode Error
Db2 connect to ds_test1 user db2inst1 using 123456
SQL0332N Character conversion from the source code page "1114" to the target
Code page "UNKNOWN" is not supported. SQLSTATE = 57017
** Cause: two-way conversion is not allowed between the code page setting (819) used by the connected database and the code page (1386) set by the local client,
That is, you cannot convert GBK-encoded characters to ISO-8859-1 characters. solution:
Db2set DB2CODEPAGE = 819
Db2 terminate
DB20000I The TERMINATE command completed successfully.
Db2 connect to ds_test1 user db2inst1 using 123456
Database Connection Information
Database server = DB2/LINUX 8.1.0
SQL authorization ID = DB2INST1
Local database alias = DS_TEST1