search
HomeDatabaseMysql Tutorial suse linux上安装DB2 数据库手记

因生产需要,在一台IBMX3850服务器上安装DB2数据库,下面是具体过程。软硬件系统配置:操作系统:suseenterprise10linux(64bit)sp3硬件配置:32G内存数据库软件:

 因生产需要,网站空间,在一台IBM X3850服务器上安装DB2数据库,香港空间,下面是具体过程。
 

 软硬件系统配置:

 操作系统:suse enterprise 10 linux(64bit) sp3

 硬件配置:32G内存

 数据库软件:DB2 V9.7(64bit)

 

一、检查所需的环境和软件包
 

在 suse Linux 操作系统上安装DB2数据库之前,应确保系统满足必需的操作系统、硬件、软件和通信要求。

DB2数据库产品有若干不同版本。某些DB2数据库产品和功能部件仅在特定操作系统上可用。这个可参阅IBM官方网站来获取每个操作系统上可用的 DB2 数据库产品。 
 先用rpm -qa查找所需的软件包,没有的包可用yast2 -i来安装。

linux-uu1q:# rpm -qa|grep libaio

libaio-0.3.104-14.2

libaio-devel-0.3.104-14.2

linux-uu1q:# rpm -qa|grep libstdc

libstdc++-devel-4.1.2_20070115-0.29.6

libstdc++-4.1.2_20070115-0.29.6
 

linux-uu1q:# rpm -qa|grep nfs-utils

nfs-utils-1.0.7-36.36.47

 

linux-uu1q:/home/server # rpm -qa |grep compat-libstdc

 

compat-libstdc++-33-3.2.3-61

 

(检查是否有libstdc++.so.5
linux-uu1q:/usr/lib64 # ls -l libstdc++.so.*

lrwxrwxrwx 1 root root     18 Feb 22 03:34 libstdc++.so.5 -> libstdc++.so.5.0.7

-rwxr-xr-x 1 root root 825400 Apr  9  2007 libstdc++.so.5.0.7

lrwxrwxrwx 1 root root     18 Feb 21 21:57 libstdc++.so.6 -> libstdc++.so.6.0.8

-rwxr-xr-x 1 root root 969048 Sep  5  2009 libstdc++.so.6.0.8)

 

注意这个compat-libstdc++-33-3.2.3-61.x86_64.rpm的包在SUSE LINUX 10的光盘里并没有,需要自己下载并安装,另外如果没有安装这个包,则在安装DB2时会报找不到libstdc++.so.5的告警。(对于 DB2 数据库服务器和客户机,网站空间,libstdc++.so.5 是必需的。还有如果你在 RHEL 5 或 SLES 10 上使用 g++ 4.1 来编译 C++ 应用程序,那么将生成下列警告:libdb2.so 所需要的 libstdc++.so.5 可能与 libstdc++.so.6 冲突)

修改系统核心参数
vi /etc/sysctl.conf
kernel.msgmni = 16384
kernel.sem = 250 256000 32 4096
#sysctl -p

#vi /etc/security/limits.conf
*    soft nofile 10240
 

 二、开始进行安装和配置

# tar  -xvf  DB2v9.7_linux64_server.tar

# cd server

# ./db2setup (或也可使用db2_install)

安装到默认路径/opt/ibm/db2/V9.7下面,安装类型选择ESE

最后一步一步安装下去,直至完成。


 

三、添加用户和组

#groupadd -g 995 db2grp

#useradd -u 1000 -d /home/db2inst1 -g db2grp -m db2inst1

#groupadd -g 996 db2fgrp

#useradd -u 1001 -d /home/db2fenc1 -g db2fgrp  -m db2fenc1
的组)
 -m dasusr1

# passwd db2inst1

# passwd db2fenc1

# passwd dasusr1

 

四、在安装目录中找到许可证文件:db2ese.lic
检查license的内容
$db2licm -l

执行如下安装授权许可

 #/opt/ibm/db2/V9.7/adm/db2licm  -a  /mnt/cdrom/db2/license/db2ese.lic 

 

# cd /opt/ibm/db2/v9.7

# ls -l

#cd instance

# ./db2icrt -s ese -u db2fenc1 db2inst1 (建立数据库实例)

# ./dascrt -u dasusr1 (建立das)

#cd /opt/ibm/db2/V9.7/cfg

# ./db2ln ()

 

 

六、设定服务端口,配置数据库实例通信

以root用户

 vi /etc/services

 新增如下行

DB2_db2inst1          60000/tcp

DB2_db2inst1_1        60001/tcp

DB2_db2inst1_2        60002/tcp

DB2_db2inst1_END      60003/tcp

DB2c_db2inst1         60005/tcp

 保存退出

 

 七、启动实例

#su - db2inst1

$db2set DB2RSHCMD=/usr/bin/ssh

这里需要先设置DB2RSHCMD这个变量,再设置DB2COMM等变量

)
)
$db2set DB2AUTOSTART=YES(设置数据库自动启动)

 

$ db2start

 02/22/2013 01:40:54     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

(创建数据库之前需要指定数据库存放目录并配置相应的权限 

   #mkdir -p /db2data/database

   # chown -R db2inst1:db2grp /db2data/database)

创建数据库

$db2 "CREATE DATABASE testdb on /db2data/database USING CODESET GBK TERRITORY CN"


$db2 connect to testdb

注意在连接数据库时,如果报下述错误

SQL0332N  Character conversion from the source code page "1386" to the target

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

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.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)