1. 下载DB2
https://www-01.ibm.com/support/docview.wss?uid=swg27007053
选择DB2 10.5 FixPack 10
2.备份当前的dbm cfg和db cfg,db2support, db2look,packages, db backup, 强烈建议。
(1). dbm cfg: db2 get dbm cfg > db2inst1.dbm.cfg
(2). db cfg: db2 get db cfg for sample > sample.db.cfg
(3). db2support : db2support . -d sample -c -s
(4). db2look: db2look -d sample -a -l -e -x -o sample.ddl
(5). packages: db2 list packages for all show detail > sample_packages.txt
(6). db2 backup db sample
(7).诊断日志截断/归档: db2diag -A
3.停止实例,服务,应用。准备升级。
(1) su - db2inst1
(2). db2 force application all
(3). db2 terminate
(4). db2stop
(5). db2licd -end
如果启用了DAS需要切换到das用户,然后关闭das管理服务器
(6). su - dasusr1
(7). db2admin stop
4. 将下载的补丁包(其实就是安装包)放到主机上并解包/解压, 然后进入到其server_t路径:
/db2_softs_v10.5.0.10/server_t
5. 安装补丁包:
./installFixPack -b -f update -b /opt/ibm/db2/V10.5
具体执行如下:
[root@localhost server_t]# ./installFixPack -f update -b /opt/ibm/db2/V10.5
Requirement not matched for DB2 database "Server" . Version: "10.5.0.10".
Summary of prerequisites that are not met on the current system:
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*".
DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".
Do you want to choose a different installation directory for the fix pack? [yes/no]
------------------------------------------------------------------------------------
yes
Enter the full path for the fix pack installation directory:
------------------------------------------------------------
/opt/ibm/db2/V10.5_FP10
DBI1017I installFixPack is updating the DB2 product(s) installed in
location /opt/ibm/db2/V10.5.
DB2 installation is being initialized.
Total number of tasks to be performed: 43
Total estimated time for all tasks to be performed: 1732 second(s)
Task #1 start
Description: Preparing the system
Estimated time 120 second(s)
........
说明:
(1). -b 后面的路径/opt/ibm/db2/V10.5是需要升级的原低版本DB2的安装路径,后面安装的时候会询问要不要改一个路径,填yes,输入一个高版本的新的安装路径/opt/ibm/db2/V10.5_FP10 。
也可以不加-b /opt/ibm/db2/V10.5选项,在后面交互模式输入。
(2).可以加上-f update选项, 如果不加这个选项,安装就会由于DBT3514W的报错中止,这个报错的意思是缺少32bit的库文件(DBT3514W),由于我安装的是64bit的DB2,如果没有32bit的应用可以忽略这个报错。 加上-f update选项之后虽然也会有警告,但是可以安装成功。
6. 安装之后,检查:
[root@localhost server_t]# db2ls
Install Path Level Fix Pack Special Install Number Install Date Installer UID
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V10.5 10.5.0.8 8 Sun Jan 12 14:36:41 2020 CST 0
/opt/ibm/db2/V10.5_FP10 10.5.0.10 10 Thu Jan 16 00:34:22 2020 CST 0
[db2inst1@localhost V10.5_FP10]$ db2level
DB21085I This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL10058" with level
identifier "0609010E".
Informational tokens are "DB2 v10.5.0.8", "s160901", "IP23993", and Fix Pack
"8".
Product is installed at "/opt/ibm/db2/V10.5".
因为只是安装了补丁安装包软件,而还没有升级实例,所以db2level显示还是老版本的安装路径。下面还需要升级实例:
7. 升级实例:
进入到新安装的高版本DB2安装路径下的instance下, 给定要升级的实例db2inst1为入参:
cd /opt/ibm/db2/V10.5_FP10/instance
升级实例: ./db2iupdt db2inst1
如下:
[root@localhost instance]# pwd
/opt/ibm/db2/V10.5_FP10/instance
[root@localhost instance]# ./db2iupdt db2inst1
DBI1446I The db2iupdt 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
Task #2 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #2 end
Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)
Task #3 end
Task #4 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2iupdt.log.44087".
DBI1070I Program db2iupdt completed successfully.
8. 启动实例,检查发现实例升级成功。
[db2inst1@localhost V10.5_FP10]$ db2start
01/16/2020 00:55:17 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst1@localhost V10.5_FP10]$ db2level
DB21085I This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL1005A" with level
identifier "060B010E".
Informational tokens are "DB2 v10.5.0.10", "s180615", "IP24053", and Fix Pack
"10".
Product is installed at "/opt/ibm/db2/V10.5_FP10".
[db2inst1@localhost V10.5_FP10]$ db2 activate db sample
DB20000I The ACTIVATE DATABASE command completed successfully.
[db2inst1@localhost V10.5_FP10]$ db2 connect to sample
Database Connection Information
Database server = DB2/LINUXX8664 10.5.10
SQL authorization ID = DB2INST1
Local database alias = SAMPLE
需要注意的几个点:
1. 升级之前一定要停掉实例
2. 先安装补丁包./installFixPack , 再升级实例./db2iupdt
3. 安装补丁包./installFixPack的时候-b后面指定的路径为原先老版本数据库的路径(也可在后面的交互模式下指定),然后再指定新版本路径。