search
HomeDatabaseMysql Tutorial DB2在线增量备份失败的案例分析

公司有一台DB2服务器在线增量备份失败,使用的备份软件为NETBACKUP7.5。具体报错如下:nbu报4号错误,在赛门铁克的官网上,对4号错误的描述是给出的解决方案是验

  公司有一台DB2服务器在线增量备份失败,使用的备份软件为NETBACKUP 7.5。具体报错如下:

1327.jpg

nbu报4号错误,在赛门铁克的官网上,对4号错误的描述是

1328.jpg

给出的解决方案是验证权限,是否可删除文件。如果你从这个思路去找原因解决问题,,就会很困惑。因为即使你把权限设成777,也还是会报这个错误。

换一个思路,还是看看DB2的db2diag.log日志吧。日志里有这样一段描述:

2013-06-19-15.22.29.980017-360 E437909183A905     LEVEL: Severe
PID     : 798772               TID  : 1           PROC : db2agent (idle) 0
INSTANCE: db2inst2             NODE : 000         DB   : PORTALDB
APPHDL  : 0-490                APPID: *LOCAL.db2inst2.130619212231
AUTHID  : DB2INST2
FUNCTION: DB2 UDB, database utilities, sqlubInitCheck, probe:310
MESSAGE : SQL2426N  The database has not been configured to allow the
incremental backup operation. Reason code = "".

这个信息告诉我们数据库没有配置允许增量备份的功能,在DB2中需要开启。在ORACLE中,则可以通过RMAN实现比较方便的增量和差异备份。

接下来我们查一下TRACKMOD参数

$ db2 get db cfg for portaldb|grep -i trackmod
Track modified pages                         (TRACKMOD) = OFF

发现此参数为OFF,这显然是导致DB2增量备份失败的最主要的原因。

因为db2的增量备份需要设置tracemod为on,这样数据库将在物理页上记录更改的部分页,做dirty标记。开启了增量备份意味着,不需要每次备份一个超大的数据库.同时意味着你可以将数据库恢复到崩溃前的状态,而不是你最后一次备份时的状态,最大可能的减少数据损失.

正确设置增量备份需要注意三个参数:

db2 update db cfg using logretain on(或者recovery); 启用归档日志
db2 update db cfg using trackmod on; 启用增量备份功能
db2 update db cfg using userexit on; 启用用户出口

对于这些配置参数,必须在所有应用程序都与此数据库断开连接之后(db2 force applications all),更改才会生效。另外在更改参数后,数据库处于backup pending状态,在执行增量、在线备份之前必须执行离线全备份一次,以使状态正常。

补充:如何进行在线备份、增量备份、差异备份?

db2 backup db testdb online to 备份路径(在线全备份) include logs
db2 backup db testdb online incremental to 备份路径(增量备份)
db2 backup db testdb online incremental delta to 备份路径(delta备份)

如何使用备份文件进行恢复?

1.查看备份文件的完整性,并验证是否可用

db2ckbkp -h /db2logs/PORTALDB.0.db2inst2.NODE0000.CATN0000.20130619001007.001

2.执行db2ckrst命令返回建议的必需的恢复操作命令。

db2ckrst -d portaldb -r database -t 20130619001007

3.执行上个命令给出的命令序列

db2 restore db portaldb incremental from /backup taken at 20130619001007 buffer 100

将会将数据库还原到备份的时刻,之后应该执行日志前滚(此时数据库处于前滚暂挂状态,将无法使用)

db2 rollforward db portaldb to end of logs and complete

当然如果你认为不需要前滚(这样将丢失最后一次备份之后的更改),也可以

db2 rollforward db portaldb stop

当你了解了这些知识,就能够正确有序的执行备份恢复,快速高效的解决问题。

 以上就是 DB2在线增量备份失败的案例分析的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQL String Data Types: A Comprehensive GuideMySQL String Data Types: A Comprehensive GuideMay 08, 2025 am 12:14 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

Mastering MySQL BLOBs: A Step-by-Step TutorialMastering MySQL BLOBs: A Step-by-Step TutorialMay 08, 2025 am 12:01 AM

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BLOB Data Type in MySQL: A Detailed Overview for DevelopersBLOB Data Type in MySQL: A Detailed Overview for DevelopersMay 07, 2025 pm 05:41 PM

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

How to Add Users to MySQL from the Command LineHow to Add Users to MySQL from the Command LineMay 07, 2025 pm 05:01 PM

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

What Are the Different String Data Types in MySQL? A Detailed OverviewWhat Are the Different String Data Types in MySQL? A Detailed OverviewMay 07, 2025 pm 03:33 PM

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool