在Linux 上安装DB2 8.1 并配置Windows 客户端连接
第一次在Linux上安装DB2,参考了很多的网上资源,但是主要的是ldquo;Linux下安装DB2 version 8.1 的详细步骤rdquo;。同时把自己
第一次在Linux上安装DB2,参考了很多的网上资源,但是主要的是“Linux下安装DB2 version 8.1 的详细步骤”。
同时把自己遇到的问题住了一个记录,以做学习之用。
VMWARE使用的是VMware server 1.0.6,Linux的内核版本是:Linux node1 2.6.18-53.el5PAE
Root 权限操作:
第一步:检查程序包及其版本
compat-libstdc++-7.3-2.96.118.i386.rpm
在linux的安装盘上,找到后使用rpm -i compat-libstdc++-7.3-2.96.118.i386.rpm 安装即可
第二步:配置 Linux 内核参数
/etc/sysctl.conf文件,添加内核参数
kernel.msgmni =1024
kernel.sem = 250 256000 32 1024
使更改激活:sysctl –p
第三步:安装
sh db2_install
按照提示做
第四步:创建用户
/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
第五步:创建实例
/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.
第六步:产品许可证
/opt/IBM/db2/V8.1/adm/db2licm -a /mnt/cdrom/db2/license/db2pe.lic
第七步:允许SMS的多页分配
/opt/IBM/db2/V8.1/cfg/db2ln
#第八步:添加DB2端口
# SU - root
# vi /etc/services 加入下面一行
# db2inst1 50000/tcp
这一步是不需要的,系统自定添加,但是有可能需要更改一下,我的是这样的:
DB2_db2inst1 50000/tcp
DB2_db2inst1_1 50001/tcp
DB2_db2inst1_2 50002/tcp
DB2_db2inst1_END 50003/tcp
以下是DB2 用户操作
第九步:DB2 配置
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
第十步:运行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.
第十一步:创建库
db2 "CREATE DATABASE test1 on /opt/IBM/tony/ USING CODESET ISO8859-1 TERRITORY CN"
以后就可以创建表和对表操作了,如 db2 "select * from sysibm.sysdummy1"
客户端操作:
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. DB2 的一个常见连接错误出现:
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
把dbm的VCENAME 的值和/etc/services中的端口号对应
db2 update dbm cfg using SVCENAME 50000
3. restart DB
db2stop force
db2start
db2 activate db test1
4. 参数确认
[db2inst1@node1 C]$ db2set -all
[i] DB2COMM=TCPIP
[g] DB2_EEE_LICENSE_POLICY=4295032864
[db2inst1@node1 C]$ netstat -an | grep 50000
确认DB2COMM 参数已经设置,同时50000端口已经启动
5.出现pagecode错误
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
**原因:连接的数据库使用的代码页设置(819)与本地客户端设置的代码页(1386)不同 之间无法进行双向转换,
即无法将GBK 编码的字符转换为ISO-8859-1字符,解决方法:
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.
