您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > DB2备份与恢复的精华内容
目录实战演练-01........................................................................................................2实战演练-02........................................................................................................7实战演练-03......................................................................................................15实战演练-04......................................................................................................18实战演练-05......................................................................................................23实战演练-06......................................................................................................27实战演练-07......................................................................................................31实战演练-08......................................................................................................36实战演练-09......................................................................................................42实战演练-10......................................................................................................45实战演练-11......................................................................................................49以下要为大家推荐一些DB2备份与恢复的精华内容,本内容由cedarbird版主耗时数月而成,本次内容共分为两个部分——环境构筑篇和实战演练篇,两个部分共有16篇文章组成,是大家学习和掌握DB2备份与恢复不可或缺的内容。有关本次内容的详细介绍如下:环境构筑篇:VMWARE上CentOS5.4(64bit)最小服务器环境构筑=blog&id=8113DB29.764bit在CentOS5.464bit上的安装=blog&id=8114DAS建立=blog&id=8115vmware-tools安装=blog&id=8116无废话DB2备份和恢复-基础篇(上)无废话DB2备份和恢复-基础篇(上).pdf(672.49KB)实战演练-01一、循环日志下的版本恢复概要:(图例略)最简单最基本的一个例子-循环日志下的离线备份和恢复。要点:做了动作后,别忘了做检查来验证动作的正确性。认真、细心是DBA最基本的素质。很多时候能救命的并不是多高级的技术。问题:问题1:实际上这里还故意遗漏一些在生产环境中必须要做的重要步骤,那是?问题2:这一过程的操作流程图?操作过程:1.注册login(user:db2inst1)2.连接db2connecttosample3.查看备份数据库设定&确认日志模式db2getdbcfg/mnt/hgfs/F/backup/database.cfg.bakdb2terminateLOGARCHMETH1=OFFLOGARCHMETH2=OFFLOGRETAIN=OFFUSEREXIT=OFF4.全备份CMD:db2backupdatabasesampleto/mnt/hgfs/F/backup/RESULT:Backupsuccessful.Thetimestampforthisbackupimageis:201005051607245.检查备份镜像文件CMD:db2ckbkp-h/mnt/hgfs/F/backup/SAMPLE.0.db2inst1.NODE0000.CATN0000.20100505160724.001RESULT:=====================MEDIAHEADERREACHED:=====================ServerDatabaseName--SAMPLEServerDatabaseAlias--SAMPLEClientDatabaseAlias--SAMPLETimestamp--20100505160724DatabasePartitionNumber--0Instance--db2inst1SequenceNumber--1ReleaseID--D00DatabaseSeed--BED6FFF2DBComment'sCodepage(Volume)--0DBComment(Volume)--DBComment'sCodepage(System)--0DBComment(System)--AuthenticationValue---1BackupMode--0IncludesLogs--0Compression--0BackupType--0BackupGran.--0StatusFlags--1SystemCatsinc--1CatalogPartitionNumber--0DBCodeset--UTF-8DBTerritory--LogID--1272190778LogPath--/home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/BackupBufferSize--4460544NumberofSessions--1Platform--1ETheproperimagefilenamewouldbe:SAMPLE.0.db2inst1.NODE0000.CATN0000.20100505160724.001[1]Buffersprocessed:###################################ImageVerificationComplete-successful.6。查看恢复历史记录CMD:db2listhistoryallforsampleRESULT:部分OpObjTimestamp+SequenceTypeDevEarliestLogCurrentLogBackupID--------------------------------------------------------------------BD20100505160724001FDS0000000.LOGS0000000.LOG----------------------------------------------------------------------------Contains5tablespace(s):00001SYSCATSPACE00002USERSPACE100003IBMDB2SAMPLEREL00004IBMDB2SAMPLEXML00005SYSTOOLSPACE----------------------------------------------------------------------------Comment:DB2BACKUPSAMPLEOFFLINEStartTime:20100505160724EndTime:20100505160735Status:A----------------------------------------------------------------------------EID:5Location:/mnt/hgfs/F/backup7.误删除障碍!删除前的备份db2exporttofile01.delofdelselect*fromact==18rows删除数据db2deletefromact确认db2selectcount(*)fromact==0row8.恢复和结果确认CMD:db2restoredatabasesamplefrom/mnt/hgfs/F/backup/RESULT:DB20000ITheRESTOREDATABASEcommandcompletedsuccessfully.确认db2exporttofile01.delofdelselect*fromactdifffile01.delfile02.del恢复历史记录CMD:db2listhistoryallforsampleRESULT:部分OpObjTimestamp+SequenceTypeDevEarliestLogCurrentLogBackupID--------------------------------------------------------------------RD20100505171611001FS0000000.LOGS0000000.LOG20100505160724----------------------------------------------------------------------------Contains5tablespace(s):00001SYSCATSPACE00002USERSPACE100003IBMDB2SAMPLEREL00004IBMDB2SAMPLEXML00005SYSTOOLSPACE----------------------------------------------------------------------------Comment:RESTORESAMPLENORFStartTime:20100505171611EndTime:20100505171639Status:A实战演练-02分享循环日志下的数据库重定向可以利用备份镜像重定向功能建立新的数据库1.重定向恢复CMD:db2restoredatabasesamplefrom/mnt/hgfs/F/backup/INTOSAMPLE2REDIRECTWITHOUTROLLINGFORWARDRESULT:SQL1277WAredirectedrestoreoperationisbeingperformed.Tablespaceconfigurationcannowbeviewedandtablespacesthatdonotuseautomaticstoragecanhavetheircontainersreconfigured.DB20000ITheRESTOREDATABASEc
本文标题:DB2备份与恢复的精华内容
链接地址:https://www.777doc.com/doc-5201912 .html