第一次在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

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version
