DB2 DPF备份到TSM

DB2 DPF备份到TSM

2023年7月30日发(作者:)

简介

TSMSEVER服务器

TSM

DB2 服务器

db2test1 服务器上有0和1 分区

db2test2服务器上有2和3 分区

一、配置TSMSERVER端

策略层:含以下概念

- 策略域:相同或相似节点数据保留需求的一个集合体,其下包含策略集。

- 策略集:策略域的子集,每个策略域中可以有多个策略集,但只有1个是激活的。

- 管理类:策略集的子类,一个策略集中可有多个管理类,但只有1个是默认的。

- 副本组:管理类的子类,每个管理类中最多只有2个副本组,按功能分备份副本组和归档副本组。副本组中指定数据存放的策略,并执行存放的位置-存储池

1、定义策略域:dbdomain

define domain dbdomain

2、定义策略集:dbpoly

define policy dbdomain dbpoly

3、定义管理类:dbmgmt

用于存放数据库备份的管理类

define mgmt dbdomain dbpoly dbmgmt 用于存放归档日志的管理类

define mgmt dbdomain dbpoly logmgmt

4、指派缺省管理类:dbmgmt

assign defmgmt dbdomain dbpoly dbmgmt

5、定义存储池:bakpool

存放数据库备份和归档的存储池(需预先定义disk设备类,我已定义,在这直接用)

define stgpool dbbakpool disk --mgmt管理的的备份池

define stgpool dbarcpool disk--mgmt管理的的归档池

define stgpool dblogpool disk --logmgmt管理的的备份池

define stgpool dblogpool2 disk --logmgmt管理的的归档池

6、定义存储池的卷

define volume dbbakpool /tsmdata/diskpool/

formatsize=51200 wait=yes

define volume dbbakpool /tsmdata/diskpool/

formatsize=51200 wait=yes

define volume dbarcpool /tsmdata/diskpool/

formatsize=51200 wait=yes define volume dblogpool /tsmdata/diskpool/ formatsize=5120

wait=yes

define volume dblogpool2 /tsmdata/diskpool/

formatsize=5120 wait=yes

7、定义存储池空间触发器

define spacetrigger stg stgpool=dbbakpool spaceexpansion=50

expansionprefix=/tsmdata/diskpool/

8、定义副本组

define copy dbdomain dbpoly dbmgmt type=backup dest=dbbakpool

verdeleted=0 retonly=0

define copy dbdomain dbpoly dbmgmt type=archive dest=dbarcpool

define copy dbdomain dbpoly logmgmt type=backup dest=dblogpool

verdeleted=0 retonly=0

define copy dbdomain dbpoly logmgmt

type=archive dest=dblogpool2

9、激活策略集

activate policyset dbdomain dbpoly

10、注册客户端节点(采用代理节点方式)

register node cdb2test cdb2test ##target node

register node db2test1 db2test1 domain=DBDOMAIN passe=0

maxnummp=8 compr=client Dedup=Clientorserver ##agent node

register node db2test2 db2test2 domain=DBDOMAIN passe=0

maxnummp=8 compr=client Dedup=Clientorserver ##agent node grant proxynode target=cdb2test agent=db2test1,db2test2

二、DB2 SERVER上的配置

1、安装tsm客户端(省略)

2、配置/db2home/db2inst1/sqllib/userprofile

cat /db2home/db2inst1/sqllib/userprofile

export DSMI_CONFIG=/opt/tivoli/tsm/client/ba/bin/

export DSMI_LOG=/db2home/db2inst1

export DSMI_DIR=/opt/tivoli/tsm/client/api/bin64

3、配置

(db2test1和db2test2上文件一致)

cat

cat << EOF > /opt/tivoli/tsm/client/ba/bin/

SE tsms

EOF

4、配置

在节点db2test1上配置

cat << EOF > /opt/tivoli/tsm/client/api/bin64/

servername tsms commmethod tcpip

tcpport 1500

tcpserveraddress 10.172.90.222

passwordaccess generate

passworddir /opt/tivoli/tsm/client/api/bin64

nodename db2test1

enableinstrumentation no

errorlogname /opt/tivoli/tsm/client/api/bin64/

schedlogname /opt/tivoli/tsm/client/api/bin64/

asnodename cdb2test

EOF

chmod 777 /opt/tivoli/tsm/client/api/bin64/

--chmod 777 /opt/tivoli/tsm/client/api/bin64/

在节点db2test2上配置

cat << EOF > /opt/tivoli/tsm/client/api/bin64/

servername tsms

commmethod tcpip

tcpport 1500 tcpserveraddress 10.172.90.222

passwordaccess generate

passworddir /opt/tivoli/tsm/client/api/bin64

nodename db2test2

enableinstrumentation no

errorlogname /opt/tivoli/tsm/client/api/bin64/

schedlogname /opt/tivoli/tsm/client/api/bin64/

asnodename cdb2test

EOF

5、配置生成访问tsm服务端的密码文件

用root用户 设置密码

source /db2home/db2inst1/sqllib/db2profile

/db2home/db2inst1/sqllib/adsm/dsmapipw

6、配置数据库参数

获取缺省值

db2 get db cfg for testdb | grep REC_HIS_RETENTN

db2 get db cfg for testdb | grep NUM_DB_BACKUPS

db2 get db cfg for testdb | grep AUTO_DEL_REC_OBJ db2 get db cfg for testdb | grep BLK_LOG_DSK_FUL

db2 get db cfg for testdb | grep FAILARCHPATH

db2 get db cfg for testdb | grep LOGARCHMETH1

db2 get db cfg for testdb | grep FAILARCHPATH

db2 get db cfg for testdb | grep LOGARCHOPT1

db2 get db cfg for testdb | grep LOGARCHCOMPR1

db2 get db cfg for testdb | grep NUMARCHRETRY

db2 get db cfg for testdb | grep ARCHRETRYDELAY

db2 get db cfg for testdb | grep TSM_MGMTCLASS

db2 get db cfg for testdb | grep TRACKMOD

Recovery history retention (days) (REC_HIS_RETENTN) = 366

Number of database backups to retain (NUM_DB_BACKUPS) = 12

Auto deletion of recovery objects (AUTO_DEL_REC_OBJ) = OFF

Block log on disk full (BLK_LOG_DSK_FUL) = NO

Failover log archive path (FAILARCHPATH) =

Options for logarchmeth1 (LOGARCHOPT1) =

Failover log archive path (FAILARCHPATH) =

Archive compression for logarchmeth1 (LOGARCHCOMPR1) =

OFF Number of log archive retries on error (NUMARCHRETRY) = 5

Log archive retry Delay (secs) (ARCHRETRYDELAY) = 20

7、修改数据库相关参数

db2 update db cfg for testdb using LOGPRIMARY 20

db2 update db cfg for testdb using REC_HIS_RETENTN 30 文件里记录备份保留天数

db2 update db cfg for testdb using NUM_DB_BACKUPS 20 全备保留个数

db2 update db cfg for testdb using AUTO_DEL_REC_OBJ off 自动删除备份文件

db2 update db cfg for testdb using LOGARCHMETH1 tsm:logmgmt --直接归档到tsm的logmgmt管理类

db2 update db cfg for testdb using LOGARCHMETH1

DISK:/home/db2arc --归档到磁盘路径,归档到磁盘,可以再采用 dsmc

archive /home/db2arc -subdir=yes 备份归档文件

db2 update db cfg for testdb using

FAILARCHPATH /home/FAILARCHPATH

db2 update db cfg for testdb using BLK_LOG_DSK_FUL YES

db2 update db cfg for testdb using TRACKMOD ON db2 update db cfg for testdb using LOGARCHCOMPR1 ON

db2 update db cfg for DBNAME using TSM_MGMTCLASS dbmgmt --此参数必须指定

db2 update db cfg for testdb using LOGARCHMETH1 tsm:logmgmt

LOGARCHOPT1 "'-asnodename=cdb2test'"

三、备份数据库

1、全备

只能在catalog node上执行备份

db2 backup db testdb on all dbpartitionnums online use tsm

db2 backup db testdb on all dbpartitionnums online use tsm options

"'-asnodename=cdb2test'"

2、增量delta备份

db2 backup db testdb on all dbpartitionnums online incremental delta

use tsm options "'-asnodename=cdb2test' include logs"

如果不在 BACKUP DATABASE 命令中指定 -asnodename 选项,那么可以改为更新 vendoropt 数据库配置参数。

db2 update db cfg for testdb using VENDOROPT

"'-asnodename=cdb2test'"

db2adutl query db testdb options "-asnodename=cdb2test"

db2 backup db testdb use tsm db2 get db cfg for testdb | grep LOGARCHMETH1

db2 get db cfg for testdb | grep TSM_MGMTCLASS

db2 update db cfg for testdb using logarchmeth1 TSM --默认管理类

db2 update db cfg for testdb using logarchmeth1 TSM:logmgmt --指定管理类

db2 update db cfg for testdb using TSM_MGMTCLASS dbmgmt --全备管理类

对于归档设置为磁盘,则可以用dsmc归档到tsm,然后删除文件,释放磁盘空间

dsmc archive /home/db2arc/ -subdir=yes -deletefiles

dsmc archive /home/FAILARCHPATH/ -subdir=yes -deletefiles

3、查询备份

db2ckbkp -H --查询磁盘上的备份

db2adutl query db testdb --查询TSM上的备份

db2pd -db testdb -logs 4、如需异机恢复

使用下列命令允许计算机 db2test3 和用户 db2inst1 进行访问

db2adutl grant user db2inst1 on nodename db2test3 for db testdb

5、备份到磁盘

db2 backup db testdb on all dbpartitionnums online to

/db2home/db2inst1/db2backup/dpf_backup/

四、恢复(restore)数据库

1、查询恢复数据库需要的步骤

db2ckrst -d testdb -t 29 -r database

Suggested restore order of images using timestamp

29 for

database testdb.

====================================================================

restore db testdb incremental taken at 29

restore db testdb incremental taken at 22

restore db testdb incremental taken at 24

restore db testdb incremental taken at 29

==================================================================== 2、编写恢复数据库需要的命令

db2_all "<<+0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 29 logtarget

/home/db2arc/ without prompting"

db2_all "<<-0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 29 logtarget

/home/db2arc/ without prompting"

db2_all "<<+0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 22 without

prompting"

db2_all "<<-0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 22 without

prompting"

db2_all "<<+0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 24 without

prompting"

db2_all "<<-0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 24 without

prompting"

db2_all "<<+0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 29 without

prompting"

db2_all "<<-0< db2 restore db testdb incremental use tsm options

"'-asnodename=cdb2test'" taken at 29 without

prompting"

3、查询前滚状态

db2 => rollforward database testdb query status

[db2inst1@db2test1 ~]$ 4、前滚数据库

db2 => rollforward database testdb to end of logs and complete

数据库恢复完成

发布者:admin,转转请注明出处:http://www.yc00.com/news/1690655553a387763.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信