安装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 =
找 IBM 买一套。不过需要花不少钱。不然自己下载一个 D 版。Linux 下面没有虚拟光驱的。不过 Linux 支持直接挂载 iso 镜像文件(使用起来和光驱里面放张盘效果一样,准确的说 Linux 直接自带虚拟光驱的功能,不过仅限 iso 文件)
怎么挂载楼主可以搜索,地球上很多,至于 db2 的下载,应该也很多。
----------------------
刚发现,db9 在 IBM 官方网站直接可以下载试用。
http://www.ibm.com/developerworks/cn/db2/v9/index_download.html
是个 tar.gz 文件,需要解压缩,解压缩之后怎么安装,应该里面有介绍安装的文档。
我就不下载测试了啊……
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)