如何在linux下安装db2,db2在LINUX下的安装

安装DB2

DB2的安装可以算是再各个数据库里面最简单的了。除了sqlite。

下载安装包,解压

[root@Enterprise tmp]# tar xvf DB2_V82_PE_LNX_32_NLV.tar

解开以后的文件都被放置在当前目录下的pe文件夹中。

开始安装:

[root@Enterprise tmp]# cd pe

[root@Enterprise pe]# ls

db2  db2_deinstall  db2_install  db2setup  doc

[root@Enterprise pe]# ./db2_install

Specify one or more of the following keywords,

separated by spaces, to install DB2 products.

选择自己要安装的产品,输入名字后回车。等待安装完成。

我们现在需要做的是,对数据库的初始化工作。包括安装授权文件和创建一个实例并运行它。

首先,我们安装授权文件。

不安装授权文件的话,则是评估版,九十天后就要过期。授权文件,在安装包已经有了。我们用下面的命令安装它:

[root@Enterprise pe]# /opt/IBM/db2/V8.2/adm/db2licm -a /tmp/pe/db2/lic

ense/db2pe.lic

如果没有db2pe.lic  文件。可以去网上找找。

我们需要创建一个用户。

[root@Enterprise pe]# useradd db2inst1

[root@Enterprise pe]# passwd db2inst1

开始创建实例:

[root@Enterprise pe]# /opt/IBM/db2/V8.2/instance/db2icrt -u db2inst1 db2inst1

这样,我们就创建了一个实例db2ins1。

[root@Enterprise pe]# su db2inst1

[db2inst1@Enterprise pe]$ db2start

07/26/2007 16:45:10     0   0   SQL1063N  DB2START processing was successful.

SQL1063N  DB2START processing was successful.

这样我们数据库就启动成功。

[db2inst1@Enterprise pe]$ db2

(c) Copyright IBM Corporation 1993,2002

Command Line Processor for DB2 SDK 8.2.0

You can issue database manager commands and SQL statements from the command

prompt. For example:

db2 => connect to sample

db2 => bind sample.bnd

For general help, type: ?.

For command help, type: ? command, where command can be

the first few keywords of a database manager command. For example:

? CATALOG DATABASE for help on the CATALOG DATABASE command

? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside

interactive mode, all commands must be prefixed with 'db2'.

To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 =>

创建一个最简单的数据库

db2 => create database testdb

DB20000I  The CREATE DATABASE command completed successfully.

查看本instance下有哪些database

db2 => list database directory

System Database Directory

Number of entries in the directory = 2

Database 1 entry:

Database alias                       = TESTDB

Database name                        = TESTDB

Local database directory             = /home/db2inst1

Database release level               = a.00

Comment                              =

Directory entry type                 = Indirect

Catalog database partition number    = 0

Alternate server hostname            =

Alternate server port number         =

Database 2 entry:

Database alias                       = OMNIDB

Database name                        = OMNIDB

Local database directory             = /home/db2inst1/data

Database release level               = a.00

Comment                              =

Directory entry type                 = Indirect

Catalog database partition number    = 0

Alternate server hostname            =

Alternate server port number         =

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值