Db2 简明教程
DB2 - Server Installation
本章介绍了 DB2 服务器的安装步骤。
This chapter describes installation steps of DB2 server.
Introduction
您可以从 www.ibm.com 下载 DB2 服务器试用版或购买产品许可证。有两种独立的 DB2 服务器可供下载,具体取决于计划在其上执行操作的操作系统的规模。例如,如果您想下载适用于 32 位 Linux 或 UNIX 操作系统的 DB2 服务器,则需要下载 32 位 DB2 服务器。64 位 DB2 服务器也适用此规则。
You can download the DB2 Server trial version or purchase the product license from www.ibm.com. There are two separate DB2 servers available for downloading, depending upon the size of operating system, on which it is intended to execute. For example, if you want to download a DB2 server for 32bit Linux or UNIX operating system, then you need to download a 32 bit DB2 server. The same applies for 64bit DB2 server.
Hardware requirements
处理器:最低 Core 2Duo
Processor : Minimum Core 2Duo
RAM:最低 1GB
Ram : 1GB minimum
硬盘:最低 30GB
Hard disk : 30GB minimum
Software requirements
在安装 DB2 服务器之前,您的系统需要做好准备,其中需要包含所需的软件。对于 Linux,您需要安装“libstdc++6.0”。
Before installing the DB2 server, your system needs to get ready with the required software on it. For Linux, you need to install “libstdc++6.0”.
Checking system compatibility
在安装 DB2 服务器之前,您需要验证您的系统是否与 DB2 服务器兼容。若要确认兼容性,您需要在命令控制台上调用“db2prereqcheck”命令。
Before installing DB2 Server, you need to verify if your system is compatible with the DB2 server. For confirming the compatibility, you need to call 'db2prereqcheck' command on command console.
Installing DB2 on Linux operating system
打开终端并在控制台上使用“CD <DB2 安装文件夹>”命令设置 db2 安装映像文件夹路径。然后键入“./db2prereqcheck”命令,该命令会确认您的系统与 DB2 服务器的兼容性。
Open the Terminal and set the db2 installation image folder path on console using “CD <DB2 installation folder>” command. Then type “./db2prereqcheck” command, which confirms the compatibility of your system with DB2 server.
./db2prereqcheck
图 1 显示了 Linux 操作系统和硬件系统的兼容性要求。
Figure-1 shows the compatibility requirements of Linux operating system and hardware system.
按照给定的步骤在您的 Linux 系统上安装 DB2:
Follow the given steps for installing DB2 on your Linux system:
-
Open the terminal.
-
Login as root user.
-
Open DB2 Installation folder.
-
Type “./db2setup” and press Enter.
该进程将启动 DB2 服务器设置的执行。
This process will start execution of DB2 server setup.
在根终端键入“./db2setup”并按 Enter 键以启动 DB2 服务器的设置流程。
Type “./db2setup” and press Enter on root terminal to start setup process of DB2 Server.
执行此操作后,将出现“设置 LaunchPad”屏幕。[图 2]
On doing so, the “Set up Launch Pad” screen appears. [Figure-2]
在设置 LaunchPad 页面上,从左侧菜单中选择“安装产品”选项。选择“DB2 高级企业服务器版”选项。选择“新建安装”按钮。
On Setup Launch pad page, select “Install a Product” option from left side menu. Select option “DB2 Advanced Enterprise Server Edition”. Select “Install New” Button.
将出现一个名为“DB2 设置向导”的新框架。单击“下一步”。[图 3]
A new frame appears with name “DB2 setup wizard”. Click “Next”. [Figure-3]
将出现下一个屏幕并显示 DB2 许可协议。选择“我接受条款…”单击“下一步”。[图 4]
The next screen appears with DB2 license agreement. Select “I accept the terms…” Click “Next”. [Figure-4]
下一个屏幕会显示安装类型选项,该选项默认设置为“典型”。
Next screen comes up with offer of Installation type, which is set to “Typical” by default.
保持同样的选择。单击“下一步”。[图 5]
Keep the same selection. Click “Next”. [Figure-5]
下一个屏幕将显示安装操作。
The next screen appears with installation action.
选择“安装 DB2 高级企业服务器版…”
Select “Install DB2 Advanced Enterprise Server Edition…”
单击“下一步”。[图 6]
Click “Next”. [Figure-6]
在下一个屏幕上,设置程序会要求您选择安装目录。
On the next screen, the setup program asks for selection of installation directory.
保持默认,然后单击“下一步”。
Keep the default and click “Next”.
下一个屏幕会显示用户身份验证。输入“dasusr1”用户的密码。
The next screen comes up with the user authentication. Enter your password for “dasusr1” user.
(您的密码可以与用户名相同,这样便于记忆。)
(Your password can be identical to username so that it is convenient to remember.)
在以下屏幕中,设置会要求您创建 DB2 服务器实例。
On the following screen, the setup asks you for creation of DB2 Server Instance.
在此处,它会创建一个名为“db2ins1”的 DB2 实例。
Here, it is creating a DB2 instance with name “db2inst1”.
下一个屏幕询问您默认实例需要的分区数。
The next screen asks you the number of partitions you require for your default instance.
您可以选择“单一或多重”分区。
You have a choice of “single or Multiple” partitions.
选择“单一分区实例”。单击"下一步"。
Select “single partition instance”. Click “next”.
在下一个屏幕,该设置会要求您为正创建的 DB2 实例进行身份验证。
On the next screen, the setup asks you for authentication for DB2 instance being created.
此处,默认情况下,用户名被创建为“db2inst1”。您可以输入相同于用户名的密码。
Here, by default username is created as “db2inst1”. You can enter password same as username.
单击“下一步”。
Click “Next”.
在下一个屏幕,该设置要求输入“db2fenc”用户的身份验证信息。
On the next screen, the setup asks to enter authentication information for “db2fenc” user.
此处,您可以输入相同于用户名的密码。
Here, you can enter password same as username.
单击“下一步”。
Click “Next”.
在下一个屏幕,您可以选择“现在不为您的 db2 服务器设置发送通知”选项。
On the next screen, you can select “Do not setup your db2 server to send notifications at this time” option.
单击“下一步”。
Click ”Next”.
下一个屏幕向您显示有关 db2 设置的信息。
The next screen shows you the information about db2 setup.
单击“完成”。
Click “Finish”.
此时,DB2 安装过程已完成。
The DB2 Installation procedure is complete at this stage.
Verifying DB2 installation
您需要验证 DB2 服务器的安装,以进行实用性检查。完成 DB2 服务器安装后,注销当前用户模式并登录到“db2inst1”用户。在“db2inst1”用户环境中,您可以打开终端并执行以下命令来验证您的 db2 产品是否安装正确。
You need to verify the installation of DB2 server for its usefulness. On completing the DB2 Server installation, logout from current user mode and login to “db2inst1” user. In “db2inst1” user environment, you can open terminal and execute the following commands to verify if your db2 product is installed properly or not.
db2level
该命令显示当前实例中已安装 DB2 产品的当前版本和服务级别。
This command shows the current version and service level of the installed DB2 product for current instance.
Syntax:
Syntax:
db2level
Example:
Example:
db2level
Output:
Output:
DB21085I Instance "db2inst2" uses "64" bits
And DB2 code release "SQL10010" with level
identifier "0201010E". Informational tokens
are "DB2 v10.1.0.0", "s120403",
"LINUXAMD64101", and Fix Pack "0".
Product is installed at "/home/db2inst2/sqllib".
db2licm
此命令显示我们 DB2 产品的所有许可相关信息。
This command shows all the license related information of our DB2 Product.
Syntax:
Syntax:
db2licm <parameter>
Example:
Example:
db2licm -l
Output:
Output:
Product name: "DB2 Advanced Enterprise Server Edition"
License type: "Trial"
Expiry date: "10/02/2014"
Product identifier: "db2aese"
Version information: "10.1"
Product name: "DB2 Connect Server"
License type: "Trial"
Expiry date: "10/02/2014"
Product identifier: "db2consv"
Version information: "10.1"
Command Line Processor (CLP)
CLP 可以在三种模式中的一种中启动:
The CLP can be started in one of the three modes:
-
Command mode: In this mode, each command and SQL statement must be prefixed by “db2”. For example, query “db2 activate database sample”.
-
Interactive input mode: you can launch this mode by using the “db2” command. Here, you can pass SQL statements without prefix. For example, “activate database sample”.
-
Batch mode: Here, you need to create a script file, which contains all SQL queries of requirements and save the file with “.db2” extension. You can call this in command line using syntax “db2 –tf <filename.db2>”.