CommVault 针对DB2增量备份恢复测试记录.docx
《CommVault 针对DB2增量备份恢复测试记录.docx》由会员分享,可在线阅读,更多相关《CommVault 针对DB2增量备份恢复测试记录.docx(19页珍藏版)》请在冰豆网上搜索。
CommVault针对DB2增量备份恢复测试记录
DB2增量备份恢复测试纪录
朱晓凯
2013年9月30日
一、环境介绍
●备份服务器:
IP地址:
192.168.1.3
主机名:
cs
操作系统:
windows2008X64
CommVault版本:
Simpana9.0SP10b
●介质服务器:
IP地址:
192.168.1.3
主机名:
cs
操作系统:
windows2008X64
CommVault版本:
Simpana9.0SP10b
●测试服务器:
IP地址:
192.168.1.21
主机名:
linux-tesu
操作系统:
redhat5.4
数据库:
DB29.7.0.1
CommVault版本:
Simpana9.0SP10
二、数据环境准备及备份纪录
2.1、第一次全备份份时的数据
1、新建表tb100
db2"createtablet100(col1char(100),colchar(100))"
db2"beginatomicdeclareiintdefault0;
while(i<10000)doinsertintot100values('知行合一'||char(i),'王守仁'||char(i));
seti=i+1;endwhile;end"
[db2inst1@db2-2~]$
2、查看表纪录
[db2inst1@linux-tesuC0000002]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01-10-19.19.06.148500
T100DB2INST1T2013-09-29-17.40.29.579708
T11DB2INST1T2013-02-16-14.20.04.642974
T12DB2INST1T2013-02-16-14.20.52.366899
TB1DB2INST1T2013-01-06-11.09.38.101713
TESTDB2INST1T2013-01-05-13.18.56.672707
3、采用CommVault进行备份
2.2、第一次增量备份
1、插入表tb200
db2"createtablet200(col1char(100),colchar(100))"
db2"beginatomicdeclareiintdefault0;
while(i<10000)doinsertintot200values('知行合一'||char(i),'王守仁'||char(i));
seti=i+1;endwhile;end"
2、查看表纪录
[db2inst1@linux-tesuC0000002]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01-10-19.19.06.148500
T100DB2INST1T2013-09-29-17.40.29.579708
T11DB2INST1T2013-02-16-14.20.04.642974
T12DB2INST1T2013-02-16-14.20.52.366899
T200DB2INST1T2013-09-29-17.44.42.100103
TB1DB2INST1T2013-01-06-11.09.38.101713
TESTDB2INST1T2013-01-05-13.18.56.672707
7record(s)selected.
3、采用CommVault进行备份:
2.3、第二次增量备份
1、插入表tb300
db2"createtablet300(col1char(100),colchar(100))"
db2"beginatomicdeclareiintdefault0;
while(i<10000)doinsertintot300values('知行合一'||char(i),'王守仁'||char(i));
seti=i+1;endwhile;end"
2、查看表纪录
[db2inst1@linux-tesuC0000002]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01-10-19.19.06.148500
T100DB2INST1T2013-09-29-17.40.29.579708
T11DB2INST1T2013-02-16-14.20.04.642974
T12DB2INST1T2013-02-16-14.20.52.366899
T200DB2INST1T2013-09-29-17.44.42.100103
T300DB2INST1T2013-09-29-17.49.43.269689
TB1DB2INST1T2013-01-06-11.09.38.101713
TESTDB2INST1T2013-01-05-13.18.56.672707
8record(s)selected.
3、采用CommVault进行备份
2.4、第二次全全备份
1、插入表tb400
db2"createtablet400(col1char(100),colchar(100))"
db2"beginatomicdeclareiintdefault0;
while(i<10000)doinsertintot400values('知行合一'||char(i),'王守仁'||char(i));
seti=i+1;endwhile;end"
2、查看表纪录
[db2inst1@linux-tesuC0000002]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01-10-19.19.06.148500
T100DB2INST1T2013-09-29-17.40.29.579708
T11DB2INST1T2013-02-16-14.20.04.642974
T12DB2INST1T2013-02-16-14.20.52.366899
T200DB2INST1T2013-09-29-17.44.42.100103
T300DB2INST1T2013-09-29-17.49.43.269689
T400DB2INST1T2013-09-29-17.56.38.437426
TB1DB2INST1T2013-01-06-11.09.38.101713
TESTDB2INST1T2013-01-05-13.18.56.672707
9record(s)selected.
3、采用CommVault进行全备份
三、数据库损坏模拟
删除库mydb
1、停止数据库
[db2inst1@db2-2~]$db2stopforce;
SQL1064NDB2STOPprocessingwassuccessful.
[db2inst1@db2-2~]$db2start
SQL1063NDB2STARTprocessingwassuccessful.
2、删除myddb数据库
[db2inst1@db2-2~]$db2dropdbmydb;
DB20000ITheDROPDATABASEcommandcompletedsuccessfully.
四、数据恢复
4.1、恢复到第二次新增量备份时的数据
4.1.1、恢复数据文件
1、首先需要创建一个新的数据库
[db2inst1@linux-tesuC0000002]$db2createdbmydb
DB20000ITheCREATEDATABASEcommandcompletedsuccessfully.
[db2inst1@linux-tesuC0000002]$
2、修改CommVault参数
[db2inst1@linux-tesuC0000002]$db2updatedbcfgformydbusingVENDOROPT'"CvSrcClientName=linux-tesu,CvSrcDb2InstanceName=db2inst1,CvClientName=linux-tesu,CvInstanceName=Instance001"'
DB20000ITheUPDATEDATABASECONFIGURATIONcommandcompletedsuccessfully.
注:
如果不创建数据库,不修改参数,只能进行全备份的恢复,不能进行增量+全备份的恢复
即把数据直接恢复到第二个增量备份
3、取消勾选“恢复DB”
3、设置恢复参数,选择需要恢复的映像
注:
这里需要把最新的增量备份和与之对应的全备份进行选择。
4、设置恢复的目标计算机,这里是本机恢复选择默认即可
5、点击高级选项,在前滚选项中,取消勾选“前滚”,并勾选“保持前滚未决状态”
6、在日志文件中,取消勾选“恢复日志文件”
注:
这里先不恢复日志,下面单独进行日志的恢复
7、设置完成后,点击“OK”,开始恢复
4.1.2、恢复日志文件
1、查看第一个活动日志
[db2inst1@linux-tesuC0000002]$db2getdbcfgformydb|grep-ilog
Logretainforrecoverystatus=RECOVERY
Userexitforloggingstatus=YES
Catalogcachesize(4KB)(CATALOGCACHE_SZ)=203
Logbuffersize(4KB)(LOGBUFSZ)=256
Logfilesize(4KB)(LOGFILSIZ)=1024
Numberofprimarylogfiles(LOGPRIMARY)=13
Numberofsecondarylogfiles(LOGSECOND)=4
Changedpathtologfiles(NEWLOGPATH)=
Pathtologfiles=/log/cv/db2_arch/db2inst1/MYDB/NODE0000/C0000001/
Overflowlogpath(OVERFLOWLOGPATH)=
Mirrorlogpath(MIRRORLOGPATH)=
Firstactivelogfile=S0000145.LOG
Blocklogondiskfull(BLK_LOG_DSK_FUL)=NO
Blocknonloggedoperations(BLOCKNONLOGGED)=NO
Percentmaxprimarylogspacebytransaction(MAX_LOG)=0
Num.ofactivelogfilesfor1activeUOW(NUM_LOG_SPAN)=0
Percentlogfilereclaimedbeforesoftchckpt(SOFTMAX)=520
Logretainforrecoveryenabled(LOGRETAIN)=RECOVERY
Userexitforloggingenabled(USEREXIT)=OFF
HADRlogwritesynchronizationmode(HADR_SYNCMODE)=NEARSYNC
Firstlogarchivemethod(LOGARCHMETH1)=VENDOR:
/opt/simpana/Base/libDb2Sbt.so
Optionsforlogarchmeth1(LOGARCHOPT1)=CvClientName=linux-tesu,CvInstanceName=Instance001
Secondlogarchivemethod(LOGARCHMETH2)=OFF
Optionsforlogarchmeth2(LOGARCHOPT2)=
Failoverlogarchivepath(FAILARCHPATH)=
Numberoflogarchiveretriesonerror(NUMARCHRETRY)=5
LogarchiveretryDelay(secs)(ARCHRETRYDELAY)=20
Logpagesduringindexbuild(LOGINDEXBUILD)=OFF
2、取消勾选“恢复DB”
3、在常规选项中,取消“恢复数据”
4、点击高级选项,在前滚选项卡中,取消勾选“前滚”,并勾选“保持前滚未决状态”。
5、在日志文中,设置按日志序列号,进行恢复
6、设置完成后,点击“OK”开始恢复
7、查看恢复出来的日志
[db2inst1@linux-tesuC0000004]$ls
S0000147.LOG
[db2inst1@linux-tesuC0000004]$pwd
/log/cv/db2_ret/db2inst1/MYDB/NODE0000/C0000004
4.1.3、前滚数据库
1、利用归档日志文件进行数据库的前滚
[db2inst1@linux-tesuC0000002]$db2"rollforwarddbmydbtoendoflogsandstopoverflowlogpath(/log/cv/db2_ret/db2inst1/MYDB/NODE0000/C0000004)"
RollforwardStatus
Inputdatabasealias=mydb
Numberofnodeshavereturnedstatus=1
Nodenumber=0
Rollforwardstatus=notpending
Nextlogfiletoberead=
Logfilesprocessed=S0000147.LOG-S0000151.LOG
Lastcommittedtransaction=2013-09-29-10.00.42.000000UTC
DB20000ITheROLLFORWARDcommandcompletedsuccessfully.
2、连接数据库
[db2inst1@linux-tesuC0000004]$db2connecttomydb;
DatabaseConnectionInformation
Databaseserver=DB2/LINUX9.7.1
SQLauthorizationID=DB2INST1
Localdatabasealias=MYDB
3、查看表纪录
[db2inst1@linux-tesuC0000004]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01-10-19.19.06.148500
T100DB2INST1T2013-09-29-17.40.29.579708
T11DB2INST1T2013-02-16-14.20.04.642974
T12DB2INST1T2013-02-16-14.20.52.366899
T200DB2INST1T2013-09-29-17.44.42.100103
T300DB2INST1T2013-09-29-17.49.43.269689
T400DB2INST1T2013-09-29-17.56.38.437426
TB1DB2INST1T2013-01-06-11.09.38.101713
TESTDB2INST1T2013-01-05-13.18.56.672707
注:
可以看到,数据恢复到第二次全备份的状态,因为我们是按日志滚的,最后一个日志是同样是第二次全备份时的数据。
4.2、恢复到第一次增量备份时的数据
前面的恢复步骤相同
这一次采用按时间点恢复
1、利用日志进行数据库前滚
db2"rollforwarddbmydbto2013-09-29-17.44.42.100103usinglocaltime"
[db2inst1@linux-tesuC0000004]$db2"rollforwarddbmydbto2013-09-29-17.44.42.100103usinglocaltime"
SQL1275NThestoptimepassedtoroll-forwardmustbegreaterthanorequalto
"2013-09-29-17.45.49.000000Local",becausedatabase"MYDB"onnode(s)"0"
containsinformationlaterthanthespecifiedtime.
[db2inst1@linux-tesuC0000004]$db2"rollforwarddbmydbto2013-09-29-17.45.49.000000usinglocaltime"
RollforwardStatus
Inputdatabasealias=mydb
Numberofnodeshavereturnedstatus=1
Nodenumber=0
Rollforwardstatus=DBworking
Nextlogfiletoberead=S0000147.LOG
Logfilesprocessed=S0000145.LOG-S0000146.LOG
Lastcommittedtransaction=2013-09-29-17.45.49.000000Local
DB20000ITheROLLFORWARDcommandcompletedsuccessfully.
[db2inst1@linux-tesuC0000004]$
2、连接数据库
[db2inst1@linux-tesuC0000004]$db2connecttomydb;
SQL1117NAconnectiontooractivationofdatabase"MYDB"cannotbemade
becauseofROLL-FORWARDPENDING.SQLSTATE=57019
[db2inst1@linux-tesuC0000004]$db2connecttomydb;
SQL1117NAconnectiontooractivationofdatabase"MYDB"cannotbemade
becauseofROLL-FORWARDPENDING.SQLSTATE=57019
注:
因为我们还没有结束日志前滚状态,我们需要结束日志前滚状态,才能正常连接数据库。
3、结束日志前滚状态
[db2inst1@linux-tesuC0000004]$db2"rollforwarddbmydbstop"
RollforwardStatus
Inputdatabasealias=mydb
Numberofnodeshavereturnedstatus=1
Nodenumber=0
Rollforwardstatus=notpending
Nextlogfiletoberead=
Logfilesprocessed=S0000145.LOG-S0000147.LOG
Lastcommittedtransaction=2013-09-29-17.45.49.000000Local
DB20000ITheROLLFORWARDcommandcompletedsuccessfully.
4、再次连接数据库
[db2inst1@linux-tesuC0000004]$db2connecttomydb;
DatabaseConnectionInformation
Databaseserver=DB2/LINUX9.7.1
SQLauthorizationID=DB2INST1
Localdatabasealias=MYDB
[db2inst1@linux-tesuC0000004]$db2listtables;
Table/ViewSchemaTypeCreationtime
-----------------------------------------------------------------------------
MYTABDB2INST1T2013-01