DB2 V11.1 DPF小版本升级

1.备份数据库
使用NBU发起对数据库全备:NBU server端发起全量备份,全量备份时间和升级时间差<1天

db2pd -util
db2 list utilities show detail

2.备份配置

mkdir -p /yunwei/Release/db/$(date +%Y%m%d)
chmod a+w /yunwei/Release/db/$(date +%Y%m%d)
su - <instancename>
cd /yunwei/Release/db/$(date +%Y%m%d)
db2 get dbm cfg > /yunwei/Release/db/$(date +%Y%m%d)/db2dbm.cfg
db2 get db cfg for <dbname> > /yunwei/Release/db/$(date +%Y%m%d)/<dbname>.cfg
db2look -d <dbname> -a -e -l -x -ct -o /yunwei/Release/db/$(date +%Y%m%d)/db2look.ddl
db2 connect to <dbname>
db2 LIST PACKAGES FOR ALL  SHOW DETAIL  > /yunwei/Release/db/$(date +%Y%m%d)/pckg.txt
db2 get snapshot for  tablespaces on <dbname> global |grep -i  "Tablespace State" > /yunwei/Release/db/$(date +%Y%m%d)/tbstats.log
db2set -all > /yunwei/Release/db/$(date +%Y%m%d)/db2set.cfg

3.停止应用

如有双机先停双机
停应用:
两台机器分别执行:service rgmanager stop
两台机器分别执行:service cman stop

如果是pcs软件:
pcs cluster stop --all          关闭pcs双节点
pcs status                      查看是否关闭

4.停止数据库

db2 force application all
db2 terminate
db2stop force
检查DB2 进程:
ps -ef |grep -i db2
正常存在db2fmcd,如果存在db2fmcd 进程请操作一下的步骤

5.停止故障监视器https://www.cndba.cn/hbhe0316/article/4851

该步骤根据上面查看进程的结果进行判断性操作如果存在db2fmcd 则做一下操作,如果不存在则不用操作
禁止故障检查器(Fault Monitor):
su - <instancename>
/opt/<IBM/ibm>/db2/V11.1/bin/db2fm -i <instancename> -D
如果无法停止Fault Monitor,需要使用root用户执行以下命令:
/opt/<IBM/ibm>/db2/V11.1/bin/db2fmcu -d

验证没有db2的进程存在:
ps -ef |grep -i db2
如果仍然无法停止请
kill -9  <kill_id>
建议该步骤反复执行几次看是否会自动重启

cp  /etc/inittab /yunwei/Release/db/$(date +%Y%m%d)/
vi /etc/inittab
将存在db2fmcd将该行删除保存退出
验证没有db2的进程存在:
ps -ef |grep -i db2

6.备份实例目录https://www.cndba.cn/hbhe0316/article/4851

#检查实例目录:
su - <instancename>
db2 get dbm cfg | grep -i DIAGPATH 
#Diagnostic data directory path               (DIAGPATH) = /db2home/<instancename>/sqllib/db2dump/

cd /db2home/<instancename>
cp -pr sqllib sqllib_bak

7.准备介质

介质准备好:
mkdir -p  /yunwei/Release/DB/intallfile/
cd /yunwei/Release/DB/installfile
将安装介质上传到该目录下
sh /yunwei/sysShell/tools/bin/sendfile.sh get 21.244.88.129 /yunwei/Release/DB/intallfile <path> <Vxx.x.x>_linuxx64_<universal/server>.tar cibuser ftp
(如所取安装包异常则可以调整相关参数,重新下载安装包)
tar -xvf <Vxx.x.x>_linuxx64_<universal/server>.tar  
tar -xvf %$介质名称$%
tar -zxvf %$介质名称$%  
gzip -d %$介质名称$%

8.升级软件https://www.cndba.cn/hbhe0316/article/4851

使用静默安装方式安装数据库:
cd /yunwei/Release/DB/intallfile/
cd server_t
./installFixPack -b /opt/<IBM/ibm>/db2/V11.1
Do you want to choose a different installation directory for the fix pack? [yes/no] 

------------------------------------------------------------------------------------
no
检查/tmp目录下update日志,确认成功记录。/tmp/installFixPack.log.xxxx

9.升级实例

/opt/<IBM/ibm>/db2/<Vxx.x>/instance/db2iupdt -u <db2fence user> <instance name>

10.验证版本

https://www.cndba.cn/hbhe0316/article/4851
验证:
db2level
版本信息应为“版本信息应为“DB2 v11.1.4.x””查看数据库版本是否为所升级的版本。
检查DB2的db2diag.log的日志,查看是否有错误发生。 
如出现错误,查看/tmp目录更新版本日志,可重复升级产品和实例

11.启动数据库https://www.cndba.cn/hbhe0316/article/4851

db2start
db2 activate db <dbname>

12.升级库https://www.cndba.cn/hbhe0316/article/4851https://www.cndba.cn/hbhe0316/article/4851

db2 activate db <dbname>
#版本号:如9.7则输入97;如10.5输入105;如11.1输入111
db2updv111 -d <dbname>

13.绑包

数据库中重新绑定程序包:
1.重新绑定数据库SCHEMA.BND/UBIND.LST/CLI.LST
db2 connect to <dbname>
db2 "bind /db2home/<instancename>/sqllib/bnd/db2schema.bnd blocking all grant public SQLERROR continue"
db2 "bind /db2home/<instancename>/sqllib/bnd/@db2ubind.lst blocking all grant public action add"
db2 "bind /db2home/<instancename>/sqllib/bnd/@db2cli.lst blocking all grant public action add"
db2 terminate
2.在数据库中通过运行 db2rbind 命令来重新绑定所有无效程序包:
db2rbind <dbname> -l /tmp/logfile all
查看包绑定的日志,查看是否都绑定成功,如果不可以请考虑做相应处理

su - <instance name>
db2 connect to <dbname>
db2 "select pkgschema,pkgname from syscat.packages where valid='X'" 
#如果以上命令有结果输出,再执行以下步骤:
db2 -x "select 'rebind package ' || trim(pkgschema) || '.' || trim(pkgname) || ';' from syscat.packages where valid='X'" > /yunwei/Release/db/$(date +%Y%m%d)/rebind.sql
db2 -tvf /yunwei/Release/db/$(date +%Y%m%d)/rebind.sql | tee  /yunwei/Release/db/$(date +%Y%m%d)/rebind.out
db2 "select pkgschema,pkgname from syscat.packages where valid='X'" 
#如果rbind package时报SQL2453。则执行:
db2 "call sysproc.admin_revalidate_db_objects(null,null,null)"
db2 "select pkgschema,pkgname from syscat.packages where valid='X'" 
#检查是否还有invalid 或inoperative package。

14.验证表空间

db2pd -d <dbname> -tab -alldbp查看表空间状态是否为0x00000000

15.验证表https://www.cndba.cn/hbhe0316/article/4851

db2 connect to <dbname>
db2 "select * from <schemaname>.<tabname> fetch first 10 row only"
db2 "select count(*) from <schemaname>.<tabname>"
db2 terminate

16.启动监视器https://www.cndba.cn/hbhe0316/article/4851

注册Fault Monitor:( root 用户 )
/opt/ibm/db2/V11.1/bin/db2fmcu -u -p /opt/ibm/db2/V11.1/bin/db2fmcd 
开启Fault Monitor:( 实例用户 )
su - <DB2 instance name>
/opt/ibm/db2/V11.1/bin/db2fm -i db2inst1 -U

17.启动双机软件

https://www.cndba.cn/hbhe0316/article/4851
#如果是linux:
A、B 同时:
service cman start
A:
service rgmanager start
B:
service rgmanager start
如果是pcs软件
pcs cluster start  --all
pcs status

18.验证服务
通过appmon监控菜单检查系统各服务是否正常

19.替换驱动包
将db2最新版本以后为保证应用驱动程序保持在同一版本需要进行替换驱动包,操作主要步骤:
1、备份应用中调用的原驱动包;
2、将/db2home/ /sqllib/java/ 下的db2java.zip、db2jcc.jar、db2jcc_license_cu.jar、db2jcc4.jar,替换应用原使用的驱动包。
3、登录WAS控制台-》资源-》JDBC-》数据源-》选择相应的数据源-》“点击测试连接
默认不替换驱动的原因:
多个数据源共用一套驱动程序,一经更新将影响所有应用程序连接数据库
提示:如果程序本身没有使用WAS数据源,请进行应用验证

版权声明:本文为博主原创文章,未经博主允许不得转载。

DB2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Mastering material for dealing with DBA certification exams Key Features Prepare yourself for the IBM C2090-600 certification exam Cover over 50 Db2 procedures including database design, performance, and security Work through over 150 Q&As; to gain confidence on each topic Book Description IBM Db2 is a relational database management system (RDBMS) that helps you store, analyze, and retrieve data efficiently. This comprehensive book is designed to help you master all aspects of IBM Db2 database administration and prepare you to take and pass IBM's Certification Exams C2090-600. Building on years of extensive experience, the authors take you through all areas covered by the test. The book delves deep into each certification topic: Db2 server management, physical design, business rules implementation, activity monitoring, utilities, high availability, and security. IBM Db2 11.1 Certification Guide provides you with more than 150 practice questions and answers, simulating real certification examination questions. Each chapter includes an extensive set of practice questions along with carefully explained answers. This book will not just prepare you for the C2090-600 exam but also help you troubleshoot day-to-day database administration challenges. What you will learn Configure and manage Db2 servers, instances, and databases Implement Db2 BLU Acceleration and a DB2 pureScale environment Create, manage, and alter Db2 database objects Use the partitioning capabilities available within Db2 Enforce constraint checking with the SET INTEGRITY command Utilize the Db2 problem determination (db2pd) and dsmtop tools Configure and manage HADR Understand how to encrypt data in transit and at rest Who This Book Is For The IBM Db2 11.1 Certification Guide is an excellent choice for database administrators, architects, and application developers who are keen to obtain certification in Db2. Basic understanding of Db2 is expected in order to get the most out of this guide.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值