Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2722696
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: DB2/Informix

2017-01-16 09:40:40

欢迎转载,请注明出处
一、升级前环境检查


1、查看当前安装版本及目录
[root@db2-node01 db2inst4]# db2ls 

Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID 
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7                 9.7.0.5        5                            Thu Dec 10 08:45:27 2015 EST             0 

2、查看详细已安装DB2版本
[root@db2-node01 db2inst4]#  /opt/ibm/db2/V9.7/bin/db2level 
DB21085I  实例 "db2inst4" 使用 "64" 位和 DB2 代码发行版
"SQL09075",级别标识为 "08060107"。
参考标记为 "DB2 v9.7.0.5"、"s111017" 和 "IP23292",修订包为 "5"。
产品是在 "/opt/ibm/db2/V9.7" 处安装的。


  3、查看当前运行实例
[root@db2-node01 db2inst4]#  /opt/ibm/db2/V9.7/instance/db2ilist 
db2inst4
[root@db2-node01 db2inst4]# su - db2inst4
[db2inst4@db2-node01 ~]$ db2level 
DB21085I  实例 "db2inst4" 使用 "64" 位和 DB2 代码发行版
"SQL09075",级别标识为 "08060107"。
参考标记为 "DB2 v9.7.0.5"、"s111017" 和 "IP23292",修订包为 "5"。
产品是在 "/opt/ibm/db2/V9.7" 处安装的。

4、查看当前授权许可
[db2inst4@db2-node01 ~]$ db2licm -L
产品名:                          "DB2 Enterprise Server Edition"
许可证类型:                     "CPU 选项"
到期日期:                        "永久"
产品标识:                       "db2ese"
版本信息:                        "9.7"
强制策略:                        "软停止"
功能部件:
DB2 性能优化 ESE:               "未许可"
DB2 存储器优化:                 "未许可"
DB2 高级访问控制:               "未许可"
DB2 地理数据管理:               "未许可"
IBM 同构复制 ESE:  "未许可"

5、查看当前数据库

[db2inst4@db2-node01 ~]$ db2 list db directory


 系统数据库目录


 目录中的条目数 = 2


数据库 1 条目:


 数据库别名                      = GZQDB233
 数据库名称                      = GZQDB
 节点名                          = NODE_233
 数据库发行版级别                = d.00
 注释                            =
 目录条目类型                    = 远程
 目录数据库分区号                = -1
 备用服务器主机名                =
 备用服务器端口号                =


数据库 2 条目:


 数据库别名                      = TEST
 数据库名称                      = TEST
 本地数据库目录                  = /home/db2inst4
 数据库发行版级别                = d.00
 注释                            =
 目录条目类型                    = 间接
 目录数据库分区号                = 0
 备用服务器主机名                =
 备用服务器端口号                =

二、安装装DB210.5

1、使用root用户解压安装
[root@db2-node01 db2inst4]# tar -zxvf v10.5_linuxx64_server_t.tar.gz 

2、升级前环境检查
[db2inst4@db2-node01 ~]$  /home/db2inst4/server_t/db2ckupgrade  -e -l ~/1.log
DBT5508I  db2ckupgrade 实用程序已成功完成。可以对数据库进行升级。
[db2inst4@db2-node01 ~]$ 
  Run installation with the option "-f sysreq" parameter to force the installation.
3、安装db210.5软件
[root@db2-node01 db2inst4]# /home/db2inst4/server_t/db2_install 
DBI1324W  Support of the db2_install command is deprecated. For
      more information, see the DB2 Information Center.

Default directory for installation of products - /opt/ibm/db2/V10.5


***********************************************************
Install into default directory (/opt/ibm/db2/V10.5) ? [yes/no] //指定安装目录
yes
 
Specify one of the following keywords to install DB2 products.

  SERVER  --》选择SERVER
  CONSV 
  EXP 
  CLIENT 
  RTCL 
 
Enter "help" to redisplay product names.


Enter "quit" to exit.


***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no] 
NO
Do you want to install the DB2 pureScale Feature? [yes/no] 
no
DB2 installation is being initialized.

[root@db2-node01 db2inst4]# db2ls 


Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID 
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7                 9.7.0.5        5                            Thu Dec 10 08:45:27 2015 EST             0 
/opt/ibm/db2/V10.5               10.5.0.3        3                            Thu Jan 12 13:19:08 2017 EST             0 
[root@db2-node01 db2inst4]# 

4、升级指定实列
[root@db2-node01 db2inst4]# /opt/ibm/db2/V10.5/instance/db2iupgrade db2inst4
DBI1446I  The db2iupgrade command is running.

DB2 installation is being initialized.
 Total number of tasks to be performed: 4 
Total estimated time for all tasks to be performed: 309 second(s) 
Task #1 start
Description: Setting default global profile registry variables 
Estimated time 1 second(s) 
Task #1 end 

DBI1070I  Program db2iupgrade completed successfully.


[root@db2-node01 db2inst4]# su - db2inst4
[db2inst4@db2-node01 ~]$ db2level 
DB21085I  This instance or install (instance name, where applicable: 
"db2inst4") uses "64" bits and DB2 code release "SQL10053" with level 
identifier "0604010E".
Informational tokens are "DB2 v10.5.0.3", "s140203", "IP23551", and Fix Pack 
"3".
Product is installed at "/opt/ibm/db2/V10.5".

5、检查升级后实例
[db2inst4@db2-node01 ~]$ db2 connect to test
SQL1032N  No start database manager command was issued.  SQLSTATE=57019
[db2inst4@db2-node01 ~]$ db2start 
SQL8007W  There are "89" day(s) left in the evaluation period for the product 
"DB2 Advanced Enterprise Server Edition". For evaluation license terms and 
conditions, refer to the License Agreement document located in the license 
directory in the installation path of this product. If you have licensed this 
product, ensure the license key is properly registered. You can register the 
license by using the db2licm command line utility. The license key can be 
obtained from your licensed product CD.
01/12/2017 13:34:31     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

[db2inst4@db2-node01 ~]$ db2 connect to test
SQL5035N  The database must be upgraded to the current release.  
SQLSTATE=55001

6、需要更新数据库
[db2inst4@db2-node01 ~]$ db2 upgrade db test
DB20000I  The UPGRADE DATABASE command completed successfully.
[db2inst4@db2-node01 ~]$ 
[db2inst4@db2-node01 ~]$ db2 connect to test
   Database Connection Information
 Database server        = DB2/LINUXX8664 10.5.3
 SQL authorization ID   = DB2INST4
 Local database alias   = TEST

[db2inst4@db2-node01 ~]$ db2 "list tables"
Table/View                      Schema          Type  Creation time             
------------------------------- --------------- ----- --------------------------
TABLEA                          DB2INST4        T     2017-01-12-15.06.26.839064
TABLEB                          DB2INST4        T     2017-01-12-15.07.29.283349
  2 record(s) selected.
[db2inst4@db2-node01 ~]$ db2 "select count(*) from tablea"

1          
-----------
         20
  1 record(s) selected.
[db2inst4@db2-node01 ~]$ db2 "select count(*) from tableb"
1          
-----------
     131072

[db2inst4@db2-node01 ~]$ db2 list db directory

 System Database Directory

 Number of entries in the directory = 2


Database 1 entry:


 Database alias                       = GZQDB233
 Database name                        = GZQDB
 Node name                            = NODE_233
 Database release level               = d.00
 Comment                              =
 Directory entry type                 = Remote
 Catalog database partition number    = -1
 Alternate server hostname            =
 Alternate server port number         =

Database 2 entry:

 Database alias                       = TEST
 Database name                        = TEST
 Local database directory             = /home/db2inst4
 Database release level               = 10.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

注意:后续需使用db2licm - a 添加 DB2.10.5许可证,否则只有90天的试用版。
[db2inst4@db2-node01 ~]$ db2licm -l
Product name:                     "DB2 Advanced Enterprise Server Edition"
License type:                     "Trial"
Expiry date:                      "04/11/2017"
Product identifier:               "db2aese"
Version information:              "10.5"
阅读(4563) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

ghan2017-01-16 21:39:16

文明上网,理性发言...